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

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

Issue 1217823009: Make VM event streams look like real dart streams. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge with master Created 5 years, 5 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 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:developer'; 10 import 'dart:developer';
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 var tests = [ 29 var tests = [
30 30
31 (Isolate isolate) async { 31 (Isolate isolate) async {
32 var lib = await isolate.rootLibrary.reload(); 32 var lib = await isolate.rootLibrary.reload();
33 33
34 var onPaused = null; 34 var onPaused = null;
35 var onResume = null; 35 var onResume = null;
36 36
37 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
37 var subscription; 38 var subscription;
38 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { 39 subscription = stream.listen((ServiceEvent event) {
39 print("Event $event"); 40 print("Event $event");
40 if (event.kind == ServiceEvent.kPauseException) { 41 if (event.kind == ServiceEvent.kPauseException) {
41 if (onPaused == null) throw "Unexpected pause event $event"; 42 if (onPaused == null) throw "Unexpected pause event $event";
42 var t = onPaused; 43 var t = onPaused;
43 onPaused = null; 44 onPaused = null;
44 t.complete(event); 45 t.complete(event);
45 } 46 }
46 if (event.kind == ServiceEvent.kResume) { 47 if (event.kind == ServiceEvent.kResume) {
47 if (onResume == null) throw "Unexpected resume event $event"; 48 if (onResume == null) throw "Unexpected resume event $event";
48 var t = onResume; 49 var t = onResume;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 103
103 await test("none", "doCaught()", false, true); 104 await test("none", "doCaught()", false, true);
104 await test("none", "doUncaught()", false, false); 105 await test("none", "doUncaught()", false, false);
105 106
106 subscription.cancel(); 107 subscription.cancel();
107 }, 108 },
108 109
109 ]; 110 ];
110 111
111 main(args) => runIsolateTests(args, tests); 112 main(args) => runIsolateTests(args, tests);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698