From 18aed70e1c461f71c0170d6118ac166085576a1e Mon Sep 17 00:00:00 2001 From: Yegor Jbanov Date: Wed, 30 Mar 2016 22:41:31 -0700 Subject: [PATCH] [driver] switch to different pause event workaround --- packages/flutter_driver/lib/src/driver.dart | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/flutter_driver/lib/src/driver.dart b/packages/flutter_driver/lib/src/driver.dart index c89a7df162..4e733d3344 100644 --- a/packages/flutter_driver/lib/src/driver.dart +++ b/packages/flutter_driver/lib/src/driver.dart @@ -50,15 +50,19 @@ class FlutterDriver { _log.trace('Looking for the isolate'); VMIsolate isolate = await vm.isolates.first.loadRunnable(); - // TODO(yjbanov): for a very brief moment the isolate could report that it - // is resumed, right before it goes into "paused on start" state. There's no - // robust way to deal with it other than waiting and querying for the - // isolate data again. 300 millis should be sufficient as the isolate is in - // the runnable state (i.e. it loaded and parsed all the Dart code) and - // going from here to the `main()` method should be trivial. + // TODO(yjbanov): vm_service_client does not support "None" pause event yet. + // It is currently reported as `null`, but we cannot rely on it because + // eventually the event will be reported as a non-`null` object. For now, + // list all the events we know about. Later we'll check for "None" event + // explicitly. // - // See: https://github.com/dart-lang/sdk/issues/25902 - if (isolate.pauseEvent is VMResumeEvent) { + // See: https://github.com/dart-lang/vm_service_client/issues/4 + if (isolate.pauseEvent is! VMPauseStartEvent && + isolate.pauseEvent is! VMPauseExitEvent && + isolate.pauseEvent is! VMPauseBreakpointEvent && + isolate.pauseEvent is! VMPauseExceptionEvent && + isolate.pauseEvent is! VMPauseInterruptedEvent && + isolate.pauseEvent is! VMResumeEvent) { await new Future.delayed(new Duration(milliseconds: 300)); isolate = await vm.isolates.first.loadRunnable(); }