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

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

Issue 1093043004: Do not JSON encode the 'result' of a service rpc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 5 years, 8 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
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 9acbdb94760e3efee518b33a6f113e00620d9692..be878a222ca6b9aa714ae88f93bdca806ef724e1 100644
--- a/runtime/observatory/tests/service/isolate_lifecycle_test.dart
+++ b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
@@ -30,29 +30,66 @@ Future before() async {
Future during() async {
}
+int numPaused(vm) {
+ int paused = 0;
+ for (var isolate in vm.isolates) {
+ if (isolate.paused) {
+ paused++;
+ }
+ }
+ return paused;
+}
+
+int numRunning(vm) {
+ int running = 0;
+ for (var isolate in vm.isolates) {
+ if (!isolate.paused) {
+ running++;
+ }
+ }
+ return running;
+}
+
var tests = [
(VM vm) async {
+ // Wait for the testee to start all of the isolates.
+ if (vm.isolates.length != spawnCount + 1) {
+ await processServiceEvents(vm, (event, sub, completer) {
+ if (event.eventType == ServiceEvent.kIsolateStart) {
+ if (vm.isolates.length == spawnCount + 1) {
+ sub.cancel();
+ completer.complete(null);
+ }
+ }
+ });
+ }
expect(vm.isolates.length, spawnCount + 1);
},
+
(VM vm) async {
// Load each isolate.
for (var isolate in vm.isolates) {
await isolate.load();
}
},
+
(VM vm) async {
- var pausedCount = 0;
- var runningCount = 0;
- for (var isolate in vm.isolates) {
- if (isolate.paused) {
- pausedCount++;
- } else {
- runningCount++;
- }
+ // Wait for all spawned isolates to hit pause-at-exit.
+ if (numPaused(vm) != spawnCount) {
+ await processServiceEvents(vm, (event, sub, completer) {
+ if (event.eventType == ServiceEvent.kPauseExit) {
+ if (numPaused(vm) == spawnCount) {
+ sub.cancel();
+ completer.complete(null);
+ }
+ }
+ });
}
- expect(pausedCount, spawnCount);
- expect(runningCount, 1);
+ expect(numPaused(vm), spawnCount);
+ expect(numRunning(vm), 1);
},
+
+
(VM vm) async {
var resumedReceived = 0;
var eventsDone = processServiceEvents(vm, (event, sub, completer) {
@@ -80,18 +117,10 @@ var tests = [
}
return eventsDone;
},
+
(VM vm) async {
- var pausedCount = 0;
- var runningCount = 0;
- for (var isolate in vm.isolates) {
- if (isolate.paused) {
- pausedCount++;
- } else {
- runningCount++;
- }
- }
- expect(pausedCount, spawnCount - resumeCount);
- expect(runningCount, 1);
+ expect(numPaused(vm), spawnCount - resumeCount);
+ expect(numRunning(vm), 1);
},
];
« no previous file with comments | « runtime/observatory/tests/service/gc_test.dart ('k') | runtime/observatory/tests/service/malformed_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698