[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.
This commit is contained in:
Jonah Williams 2024-10-11 09:34:24 -07:00 committed by GitHub
parent 7424766f2c
commit f1f83aa909
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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', <String>['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<void>.delayed(const Duration(milliseconds: 100));