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

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

Issue 1699153002: Add step OverAwait to service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose-debug
5
6 import 'dart:async';
7 import 'dart:developer';
8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart';
11
12 foo() {}
13
14 doSync() {
15 foo(); // Line 15
16 }
17
18 doAsync() async {
19 foo(); // Line 19
20 await null;
21 }
22
23 doAsyncStar() async* {
24 foo(); // Line 24
25 yield null;
26 }
27
28 testeeDo() {
29 debugger();
30
31 doSync();
32
33 doAsync();
34
35 doAsyncStar().listen((_) => null);
36 }
37
38 test(Isolate isolate) async {
39 await isolate.rootLibrary.load();
40 var script = isolate.rootLibrary.scripts[0];
41
42 var bp1 = await isolate.addBreakpoint(script, 15);
43 expect(bp1, isNotNull);
44 expect(bp1 is Breakpoint, isTrue);
45
46 var bp2 = await isolate.addBreakpoint(script, 19);
47 expect(bp2, isNotNull);
48 expect(bp2 is Breakpoint, isTrue);
49
50 var bp3 = await isolate.addBreakpoint(script, 24);
51 expect(bp3, isNotNull);
52 expect(bp3 is Breakpoint, isTrue);
53
54 isolate.resume();
55
56 var bp1_hit = new Completer();
57 var bp2_hit = new Completer();
58 var bp3_hit = new Completer();
59
60 var stream = await isolate.vm.getEventStream(VM.kDebugStream);
61 stream.listen((ServiceEvent event) async {
62 print("Event: $event");
63 if (event.kind == ServiceEvent.kPauseBreakpoint) {
64 var bp = event.breakpoint;
65 print('Hit $bp');
66 if (bp == bp1) {
67 await stoppedAtLine(15)(isolate);
68 print(event.asyncContinuation);
69 expect(event.asyncContinuation, equals(null));
70 isolate.resume();
71 bp1_hit.complete(null);
72 }
73 if (bp == bp2) {
74 await stoppedAtLine(19)(isolate);
75 print(event.asyncContinuation);
76 expect(event.asyncContinuation.isClosure, isTrue);
77 isolate.resume();
78 bp2_hit.complete(null);
79 }
80 if (bp == bp3) {
81 await stoppedAtLine(24)(isolate);
82 print(event.asyncContinuation);
83 expect(event.asyncContinuation.isClosure, isTrue);
84 isolate.resume();
85 bp3_hit.complete(null);
86 }
87 }
88 });
89
90 await bp1_hit.future;
91 await bp2_hit.future;
92 await bp3_hit.future;
93 }
94
95 main(args) => runIsolateTests(args, [test], testeeConcurrent: testeeDo);
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/tests/service/async_next_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698