File tree Expand file tree Collapse file tree 3 files changed +35
-10
lines changed
benchmarks/complex_layout/test_memory
integration_tests/flutter_gallery/test_memory Expand file tree Collapse file tree 3 files changed +35
-10
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Future<void> main() async {
2323 final Completer <void > ready = Completer <void >();
2424 runApp (GestureDetector (
2525 onTap: () {
26- debugPrint ('Received tap. ' );
26+ debugPrint ('==== MEMORY BENCHMARK ==== TAPPED ==== ' );
2727 ready.complete ();
2828 },
2929 behavior: HitTestBehavior .opaque,
@@ -32,16 +32,14 @@ Future<void> main() async {
3232 ),
3333 ));
3434 await SchedulerBinding .instance.endOfFrame;
35-
36- /// Wait 50ms to allow the raster thread to actually put up the frame. (The
37- /// endOfFrame future ends when we send the data to the engine, before
38- /// the raster thread has had a chance to rasterize, etc.)
39- await Future <void >.delayed (const Duration (milliseconds: 50 ));
4035 debugPrint ('==== MEMORY BENCHMARK ==== READY ====' );
4136
4237 await ready.future; // waits for tap sent by devicelab task
4338 debugPrint ('Continuing...' );
4439
40+ // Wait out any errant taps due to synchronization
41+ await Future <void >.delayed (const Duration (milliseconds: 200 ));
42+
4543 // remove onTap handler, enable pointer events for app
4644 runApp (GestureDetector (
4745 child: const IgnorePointer (
Original file line number Diff line number Diff line change @@ -2071,9 +2071,34 @@ class MemoryTest {
20712071 await launchApp ();
20722072 await recordStart ();
20732073
2074+ // Keep "tapping" the device till it responds with the string we expect,
2075+ // or throw an error instead of tying up the infrastructure for 30 minutes.
2076+ prepareForNextMessage ('TAPPED' );
2077+ bool tapped = false ;
2078+ int tapCount = 0 ;
2079+ await Future .any (< Future <void >> [
2080+ () async {
2081+ while (true ) {
2082+ if (tapped) {
2083+ break ;
2084+ }
2085+ tapCount += 1 ;
2086+ print ('tapping device... [$tapCount ]' );
2087+ await device! .tap (100 , 100 );
2088+ await Future <void >.delayed (const Duration (milliseconds: 100 ));
2089+ }
2090+ }(),
2091+ () async {
2092+ print ('awaiting "tapped" message... (timeout: 10 seconds)' );
2093+ try {
2094+ await receivedNextMessage? .timeout (const Duration (seconds: 10 ));
2095+ } finally {
2096+ tapped = true ;
2097+ }
2098+ }(),
2099+ ]);
2100+
20742101 prepareForNextMessage ('DONE' );
2075- print ('tapping device...' );
2076- await device! .tap (100 , 100 );
20772102 print ('awaiting "done" message...' );
20782103 await receivedNextMessage;
20792104
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Future<void> main() async {
2626 final Completer <void > ready = Completer <void >();
2727 runApp (GestureDetector (
2828 onTap: () {
29- debugPrint ('Received tap. ' );
29+ debugPrint ('==== MEMORY BENCHMARK ==== TAPPED ==== ' );
3030 ready.complete ();
3131 },
3232 behavior: HitTestBehavior .opaque,
@@ -35,12 +35,14 @@ Future<void> main() async {
3535 ),
3636 ));
3737 await SchedulerBinding .instance.endOfFrame;
38- await Future <void >.delayed (const Duration (milliseconds: 50 ));
3938 debugPrint ('==== MEMORY BENCHMARK ==== READY ====' );
4039
4140 await ready.future;
4241 debugPrint ('Continuing...' );
4342
43+ // Wait out any errant taps due to synchronization
44+ await Future <void >.delayed (const Duration (milliseconds: 200 ));
45+
4446 // remove onTap handler, enable pointer events for app
4547 runApp (GestureDetector (
4648 child: const IgnorePointer (
You can’t perform that action at this time.
0 commit comments