Disable engine calls doring layout_bench. (#18163)

This commit is contained in:
Florian Loitsch 2018-06-06 11:43:43 +02:00 committed by GitHub
parent b135fb3795
commit 211615fc63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,11 @@ Future<Null> main() async {
await tester.pump(); // Start drawer animation
await tester.pump(const Duration(seconds: 1)); // Complete drawer animation
// Disable calls from the engine which would interfere with the benchmark.
ui.window.onBeginFrame = null;
ui.window.onDrawFrame = null;
final TestViewConfiguration big = new TestViewConfiguration(size: const Size(360.0, 640.0));
final TestViewConfiguration small = new TestViewConfiguration(size: const Size(355.0, 635.0));
final RenderView renderView = WidgetsBinding.instance.renderView;
@ -47,8 +52,8 @@ Future<Null> main() async {
// frames are missed, etc.
// We use Timer.run to ensure there's a microtask flush in between
// the two calls below.
Timer.run(() { ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); });
Timer.run(() { ui.window.onDrawFrame(); });
Timer.run(() { binding.handleBeginFrame(new Duration(milliseconds: iterations * 16)); });
Timer.run(() { binding.handleDrawFrame(); });
await tester.idle(); // wait until the frame has run (also uses Timer.run)
iterations += 1;
}