Index: runtime/observatory/tests/service/test_helper.dart |
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart |
index 0e8b6e932af424b757e26dcf039252d1c5dd47f0..1a66047744b07f4c4d465c7f5891d0a0b17ea9d8 100644 |
--- a/runtime/observatory/tests/service/test_helper.dart |
+++ b/runtime/observatory/tests/service/test_helper.dart |
@@ -255,6 +255,63 @@ class _ServiceTesteeLauncher { |
} |
} |
+// A tester runner that doesn't spawn a process but instead connects to |
+// an already running flutter application running on a device. Assumes |
+// port 8100. This is only useful for debugging. |
+class _FlutterDeviceServiceTesterRunner { |
+ void run({List<String> mainArgs, |
+ List<VMTest> vmTests, |
+ List<IsolateTest> isolateTests, |
+ bool pause_on_start: false, |
+ bool pause_on_exit: false, |
+ bool trace_service: false, |
+ bool trace_compiler: false, |
+ bool verbose_vm: false, |
+ bool pause_on_unhandled_exceptions: false}) { |
+ var port = 8100; |
+ serviceWebsocketAddress = 'ws://localhost:$port/ws'; |
+ serviceHttpAddress = 'http://localhost:$port'; |
+ var name = Platform.script.pathSegments.last; |
+ runZoned(() async { |
+ var vm = |
+ new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); |
+ print('Loading VM...'); |
+ await vm.load(); |
+ print('Done loading VM'); |
+ |
+ // Run vm tests. |
+ if (vmTests != null) { |
+ var testIndex = 1; |
+ var totalTests = vmTests.length; |
+ for (var test in vmTests) { |
+ vm.verbose = verbose_vm; |
+ print('Running $name [$testIndex/$totalTests]'); |
+ testIndex++; |
+ await test(vm); |
+ } |
+ } |
+ |
+ // Run isolate tests. |
+ if (isolateTests != null) { |
+ var isolate = await vm.isolates.first.load(); |
+ var testIndex = 1; |
+ var totalTests = isolateTests.length; |
+ for (var test in isolateTests) { |
+ vm.verbose = verbose_vm; |
+ print('Running $name [$testIndex/$totalTests]'); |
+ testIndex++; |
+ await test(isolate); |
+ } |
+ } |
+ }, onError: (e, st) { |
+ if (!_isWebSocketDisconnect(e)) { |
+ print('Unexpected exception in service tests: $e $st'); |
+ throw e; |
+ } |
+ }); |
+ } |
+} |
+ |
class _ServiceTesterRunner { |
void run({List<String> mainArgs, |
List<VMTest> vmTests, |