diff --git a/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart b/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart index 46e3f2daff..b06849c8a5 100644 --- a/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart +++ b/dev/benchmarks/complex_layout/test_memory/scroll_perf.dart @@ -23,7 +23,7 @@ Future main() async { final Completer ready = Completer(); runApp(GestureDetector( onTap: () { - debugPrint('==== MEMORY BENCHMARK ==== TAPPED ===='); + debugPrint('Received tap.'); ready.complete(); }, behavior: HitTestBehavior.opaque, @@ -32,14 +32,16 @@ Future main() async { ), )); await SchedulerBinding.instance.endOfFrame; + + /// Wait 50ms to allow the raster thread to actually put up the frame. (The + /// endOfFrame future ends when we send the data to the engine, before + /// the raster thread has had a chance to rasterize, etc.) + await Future.delayed(const Duration(milliseconds: 50)); debugPrint('==== MEMORY BENCHMARK ==== READY ===='); await ready.future; // waits for tap sent by devicelab task debugPrint('Continuing...'); - // Wait out any errant taps due to synchronization - await Future.delayed(const Duration(milliseconds: 200)); - // remove onTap handler, enable pointer events for app runApp(GestureDetector( child: const IgnorePointer( diff --git a/dev/devicelab/lib/tasks/perf_tests.dart b/dev/devicelab/lib/tasks/perf_tests.dart index 63570d705f..de9dfec8f1 100644 --- a/dev/devicelab/lib/tasks/perf_tests.dart +++ b/dev/devicelab/lib/tasks/perf_tests.dart @@ -2071,34 +2071,9 @@ class MemoryTest { await launchApp(); await recordStart(); - // Keep "tapping" the device till it responds with the string we expect, - // or throw an error instead of tying up the infrastructure for 30 minutes. - prepareForNextMessage('TAPPED'); - bool tapped = false; - int tapCount = 0; - await Future.any(>[ - () async { - while (true) { - if (tapped) { - break; - } - tapCount += 1; - print('tapping device... [$tapCount]'); - await device!.tap(100, 100); - await Future.delayed(const Duration(milliseconds: 100)); - } - }(), - () async { - print('awaiting "tapped" message... (timeout: 10 seconds)'); - try { - await receivedNextMessage?.timeout(const Duration(seconds: 10)); - } finally { - tapped = true; - } - }(), - ]); - prepareForNextMessage('DONE'); + print('tapping device...'); + await device!.tap(100, 100); print('awaiting "done" message...'); await receivedNextMessage; diff --git a/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart b/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart index 9b93de1310..5992b64b1a 100644 --- a/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart +++ b/dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart @@ -26,7 +26,7 @@ Future main() async { final Completer ready = Completer(); runApp(GestureDetector( onTap: () { - debugPrint('==== MEMORY BENCHMARK ==== TAPPED ===='); + debugPrint('Received tap.'); ready.complete(); }, behavior: HitTestBehavior.opaque, @@ -35,14 +35,12 @@ Future main() async { ), )); await SchedulerBinding.instance.endOfFrame; + await Future.delayed(const Duration(milliseconds: 50)); debugPrint('==== MEMORY BENCHMARK ==== READY ===='); await ready.future; debugPrint('Continuing...'); - // Wait out any errant taps due to synchronization - await Future.delayed(const Duration(milliseconds: 200)); - // remove onTap handler, enable pointer events for app runApp(GestureDetector( child: const IgnorePointer(