Skip to content

Commit 9fe71d9

Browse files
Reverts "Fix flaky complex_layout_scroll_perf__memory test (flutter#150287)" (flutter#150293)
Reverts: flutter#150287 Initiated by: jtmcdole Reason for reverting: other memperf tests don't wait for or send a TAPPED; so they fail. Original PR Author: jtmcdole Reviewed By: {gaaclarke} This change reverts the following previous change: Initial tap is missing sometimes; either its never delivered or it is delivered before gesture controller is hooked up. 1: Update the two perf tests to output when TAPPED is received 2: Update the MemoryTest to keep tapping while waiting for TAPPED Tested on devicelab: * setting iterations=1 * removing the timeout before READY * running tests in a while loop Before this change, you could get the test to hang often. After this change you'll see "tapping device... [x]" where x is the counter. Fixes flutter#150096
1 parent 499c84c commit 9fe71d9

File tree

3 files changed

+10
-35
lines changed

3 files changed

+10
-35
lines changed

dev/benchmarks/complex_layout/test_memory/scroll_perf.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Future<void> main() async {
2323
final Completer<void> ready = Completer<void>();
2424
runApp(GestureDetector(
2525
onTap: () {
26-
debugPrint('==== MEMORY BENCHMARK ==== TAPPED ====');
26+
debugPrint('Received tap.');
2727
ready.complete();
2828
},
2929
behavior: HitTestBehavior.opaque,
@@ -32,14 +32,16 @@ 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));
3540
debugPrint('==== MEMORY BENCHMARK ==== READY ====');
3641

3742
await ready.future; // waits for tap sent by devicelab task
3843
debugPrint('Continuing...');
3944

40-
// Wait out any errant taps due to synchronization
41-
await Future<void>.delayed(const Duration(milliseconds: 200));
42-
4345
// remove onTap handler, enable pointer events for app
4446
runApp(GestureDetector(
4547
child: const IgnorePointer(

dev/devicelab/lib/tasks/perf_tests.dart

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,34 +2071,9 @@ 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-
21012074
prepareForNextMessage('DONE');
2075+
print('tapping device...');
2076+
await device!.tap(100, 100);
21022077
print('awaiting "done" message...');
21032078
await receivedNextMessage;
21042079

dev/integration_tests/flutter_gallery/test_memory/memory_nav.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Future<void> main() async {
2626
final Completer<void> ready = Completer<void>();
2727
runApp(GestureDetector(
2828
onTap: () {
29-
debugPrint('==== MEMORY BENCHMARK ==== TAPPED ====');
29+
debugPrint('Received tap.');
3030
ready.complete();
3131
},
3232
behavior: HitTestBehavior.opaque,
@@ -35,14 +35,12 @@ Future<void> main() async {
3535
),
3636
));
3737
await SchedulerBinding.instance.endOfFrame;
38+
await Future<void>.delayed(const Duration(milliseconds: 50));
3839
debugPrint('==== MEMORY BENCHMARK ==== READY ====');
3940

4041
await ready.future;
4142
debugPrint('Continuing...');
4243

43-
// Wait out any errant taps due to synchronization
44-
await Future<void>.delayed(const Duration(milliseconds: 200));
45-
4644
// remove onTap handler, enable pointer events for app
4745
runApp(GestureDetector(
4846
child: const IgnorePointer(

0 commit comments

Comments
 (0)