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

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

Issue 1761503002: Simplify pause_idle_isolate_test and add more debugging output. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « runtime/observatory/tests/service/pause_idle_isolate_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 4
5 library service_test_common; 5 library service_test_common;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:observatory/service_common.dart'; 8 import 'package:observatory/service_common.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 83
84 Future<Isolate> hasPausedFor(Isolate isolate, String kind) { 84 Future<Isolate> hasPausedFor(Isolate isolate, String kind) {
85 // Set up a listener to wait for breakpoint events. 85 // Set up a listener to wait for breakpoint events.
86 Completer completer = new Completer(); 86 Completer completer = new Completer();
87 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { 87 isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
88 var subscription; 88 var subscription;
89 subscription = stream.listen((ServiceEvent event) { 89 subscription = stream.listen((ServiceEvent event) {
90 if (event.kind == kind) { 90 if (event.kind == kind) {
91 print('Paused with $kind');
92 subscription.cancel();
93 if (completer != null) { 91 if (completer != null) {
94 // Reload to update isolate.pauseEvent. 92 // Reload to update isolate.pauseEvent.
93 print('Paused with $kind');
94 subscription.cancel();
95 completer.complete(isolate.reload()); 95 completer.complete(isolate.reload());
96 completer = null; 96 completer = null;
97 } 97 }
98 } 98 }
99 }); 99 });
100 100
101 // Pause may have happened before we subscribed. 101 // Pause may have happened before we subscribed.
102 isolate.reload().then((_) { 102 isolate.reload().then((_) {
103 if ((isolate.pauseEvent != null) && 103 if ((isolate.pauseEvent != null) &&
104 (isolate.pauseEvent.kind == kind)) { 104 (isolate.pauseEvent.kind == kind)) {
105 // Already waiting at a breakpoint. 105 // Already waiting at a breakpoint.
106 print('Paused with $kind');
107 subscription.cancel();
108 if (completer != null) { 106 if (completer != null) {
107 print('Paused with $kind');
108 subscription.cancel();
109 completer.complete(isolate); 109 completer.complete(isolate);
110 completer = null; 110 completer = null;
111 } 111 }
112 } 112 }
113 }); 113 });
114 }); 114 });
115 115
116 return completer.future; // Will complete when breakpoint hit. 116 return completer.future; // Will complete when breakpoint hit.
117 } 117 }
118 118
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 Future<Instance> rootLibraryFieldValue(Isolate isolate, 228 Future<Instance> rootLibraryFieldValue(Isolate isolate,
229 String fieldName) async { 229 String fieldName) async {
230 Library rootLib = await isolate.rootLibrary.load(); 230 Library rootLib = await isolate.rootLibrary.load();
231 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); 231 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName);
232 await field.load(); 232 await field.load();
233 Instance value = field.staticValue; 233 Instance value = field.staticValue;
234 await value.load(); 234 await value.load();
235 return value; 235 return value;
236 } 236 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/pause_idle_isolate_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698