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

Side by Side Diff: runtime/observatory/tests/service/isolate_lifecycle_test.dart

Issue 1152283005: Revert "Add the streamListen and streamCancel rpcs to the vm service." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:isolate' as I; 7 import 'dart:isolate' as I;
8 8
9 import 'package:observatory/service_io.dart'; 9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 running++; 47 running++;
48 } 48 }
49 } 49 }
50 return running; 50 return running;
51 } 51 }
52 52
53 var tests = [ 53 var tests = [
54 (VM vm) async { 54 (VM vm) async {
55 // Wait for the testee to start all of the isolates. 55 // Wait for the testee to start all of the isolates.
56 if (vm.isolates.length != spawnCount + 1) { 56 if (vm.isolates.length != spawnCount + 1) {
57 await processServiceEvents(vm, VM.kIsolateEventStreamId, 57 await processServiceEvents(vm, (event, sub, completer) {
58 (event, sub, completer) {
59 if (event.eventType == ServiceEvent.kIsolateStart) { 58 if (event.eventType == ServiceEvent.kIsolateStart) {
60 if (vm.isolates.length == spawnCount + 1) { 59 if (vm.isolates.length == spawnCount + 1) {
61 sub.cancel(); 60 sub.cancel();
62 completer.complete(null); 61 completer.complete(null);
63 } 62 }
64 } 63 }
65 }); 64 });
66 } 65 }
67 expect(vm.isolates.length, spawnCount + 1); 66 expect(vm.isolates.length, spawnCount + 1);
68 }, 67 },
69 68
70 (VM vm) async { 69 (VM vm) async {
71 // Load each isolate. 70 // Load each isolate.
72 for (var isolate in vm.isolates) { 71 for (var isolate in vm.isolates) {
73 await isolate.load(); 72 await isolate.load();
74 } 73 }
75 }, 74 },
76 75
77 (VM vm) async { 76 (VM vm) async {
78 // Wait for all spawned isolates to hit pause-at-exit. 77 // Wait for all spawned isolates to hit pause-at-exit.
79 if (numPaused(vm) != spawnCount) { 78 if (numPaused(vm) != spawnCount) {
80 await processServiceEvents(vm, VM.kDebugEventStreamId, 79 await processServiceEvents(vm, (event, sub, completer) {
81 (event, sub, completer) {
82 if (event.eventType == ServiceEvent.kPauseExit) { 80 if (event.eventType == ServiceEvent.kPauseExit) {
83 if (numPaused(vm) == spawnCount) { 81 if (numPaused(vm) == spawnCount) {
84 sub.cancel(); 82 sub.cancel();
85 completer.complete(null); 83 completer.complete(null);
86 } 84 }
87 } 85 }
88 }); 86 });
89 } 87 }
90 expect(numPaused(vm), spawnCount); 88 expect(numPaused(vm), spawnCount);
91 expect(numRunning(vm), 1); 89 expect(numRunning(vm), 1);
92 }, 90 },
93 91
94 92
95 (VM vm) async { 93 (VM vm) async {
96 var resumedReceived = 0; 94 var resumedReceived = 0;
97 var eventsDone = processServiceEvents(vm, VM.kIsolateEventStreamId, 95 var eventsDone = processServiceEvents(vm, (event, sub, completer) {
98 (event, sub, completer) {
99 if (event.eventType == ServiceEvent.kIsolateExit) { 96 if (event.eventType == ServiceEvent.kIsolateExit) {
100 resumedReceived++; 97 resumedReceived++;
101 if (resumedReceived == resumeCount) { 98 if (resumedReceived == resumeCount) {
102 sub.cancel(); 99 sub.cancel();
103 completer.complete(null); 100 completer.complete(null);
104 } 101 }
105 } 102 }
106 }); 103 });
107 var resumesIssued = 0; 104 var resumesIssued = 0;
108 var isolateList = vm.isolates.toList(); 105 var isolateList = vm.isolates.toList();
(...skipping 15 matching lines...) Expand all
124 (VM vm) async { 121 (VM vm) async {
125 expect(numPaused(vm), spawnCount - resumeCount); 122 expect(numPaused(vm), spawnCount - resumeCount);
126 expect(numRunning(vm), 1); 123 expect(numRunning(vm), 1);
127 }, 124 },
128 ]; 125 ];
129 126
130 main(args) async => runVMTests(args, tests, 127 main(args) async => runVMTests(args, tests,
131 testeeBefore: before, 128 testeeBefore: before,
132 testeeConcurrent: during, 129 testeeConcurrent: during,
133 pause_on_exit: true); 130 pause_on_exit: true);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/gc_test.dart ('k') | runtime/observatory/tests/service/source_location_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698