From f1f83aa909c0d6bf39ad8274ac68e48c20825c2b Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Fri, 11 Oct 2024 09:34:24 -0700 Subject: [PATCH] [devicelab] handle missed lifecycle messages. (#156596) This test waits on the application to print a message before continuting, but that message does not reach the test post UI/platform thread merge. The test otherwise seems to function fine, and the app isn't crashing. --- .../bin/tasks/flutter_gallery__back_button_memory.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/devicelab/bin/tasks/flutter_gallery__back_button_memory.dart b/dev/devicelab/bin/tasks/flutter_gallery__back_button_memory.dart index 4e94b62d03..c4887a5501 100644 --- a/dev/devicelab/bin/tasks/flutter_gallery__back_button_memory.dart +++ b/dev/devicelab/bin/tasks/flutter_gallery__back_button_memory.dart @@ -32,7 +32,10 @@ class BackButtonMemoryTest extends MemoryTest { // Push back button, wait for it to be seen by the Flutter app. prepareForNextMessage('AppLifecycleState.paused'); await device!.shellExec('input', ['keyevent', 'KEYCODE_BACK']); - await receivedNextMessage; + + // Note: post UI/platform merge, we consistently miss this message. From + // local logcat it seems to be printed but it does not reach the tool. + await receivedNextMessage?.timeout(const Duration(seconds: 4), onTimeout: () {}); // Give Android time to settle (e.g. run GCs) after closing the app. await Future.delayed(const Duration(milliseconds: 100));