Index: runtime/observatory/tests/service/isolate_lifecycle_test.dart |
diff --git a/runtime/observatory/tests/service/isolate_lifecycle_test.dart b/runtime/observatory/tests/service/isolate_lifecycle_test.dart |
index 4495269b596301069b5d0ed4131e5c2be655d3d8..a3ad5400f1b7d34e07427188fb744294b0db8a1b 100644 |
--- a/runtime/observatory/tests/service/isolate_lifecycle_test.dart |
+++ b/runtime/observatory/tests/service/isolate_lifecycle_test.dart |
@@ -4,6 +4,7 @@ |
// VMOptions=--error_on_bad_type --error_on_bad_override |
import 'dart:async'; |
+import 'dart:developer'; |
import 'dart:isolate' as I; |
import 'package:observatory/service_io.dart'; |
@@ -18,7 +19,8 @@ final isolates = []; |
void spawnEntry(int i) { |
} |
-Future before() async { |
+Future during() async { |
+ debugger(); |
// Spawn spawnCount long lived isolates. |
for (var i = 0; i < spawnCount; i++) { |
var isolate = await I.Isolate.spawn(spawnEntry, i); |
@@ -27,9 +29,6 @@ Future before() async { |
print('spawned all isolates'); |
} |
-Future during() async { |
-} |
- |
int numPaused(vm) { |
int paused = 0; |
for (var isolate in vm.isolates) { |
@@ -42,20 +41,33 @@ int numPaused(vm) { |
var tests = [ |
(VM vm) async { |
+ expect(vm.isolates.length, 1); |
+ await hasStoppedAtBreakpoint(vm.isolates[0]); |
+ }, |
+ |
+ (VM vm) async { |
Completer completer = new Completer(); |
var stream = await vm.getEventStream(VM.kIsolateStream); |
- if (vm.isolates.length < spawnCount + 1) { |
- var subscription; |
- subscription = stream.listen((ServiceEvent event) { |
- if (event.kind == ServiceEvent.kIsolateStart) { |
- if (vm.isolates.length == (spawnCount + 1)) { |
- subscription.cancel(); |
- completer.complete(null); |
- } |
- } |
- }); |
- await completer.future; |
- } |
+ var subscription; |
+ int startCount = 0; |
+ int runnableCount = 0; |
+ subscription = stream.listen((ServiceEvent event) { |
+ if (event.kind == ServiceEvent.kIsolateStart) { |
+ startCount++; |
+ } |
+ if (event.kind == ServiceEvent.kIsolateRunnable) { |
+ runnableCount++; |
+ } |
+ if (runnableCount == spawnCount) { |
+ subscription.cancel(); |
+ completer.complete(null); |
+ } |
+ }); |
+ expect(vm.isolates.length, 1); |
+ vm.isolates[0].resume(); |
+ await completer.future; |
+ expect(startCount, spawnCount); |
+ expect(runnableCount, spawnCount); |
expect(vm.isolates.length, spawnCount + 1); |
}, |
@@ -124,6 +136,5 @@ var tests = [ |
]; |
main(args) async => runVMTests(args, tests, |
- testeeBefore: before, |
testeeConcurrent: during, |
pause_on_exit: true); |