Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Unified Diff: runtime/observatory/tests/service/isolate_lifecycle_test.dart

Issue 1293383011: Add an IsolateRunnable event to the service protocol. Improve service docs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698