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

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

Issue 1244983002: Automatically step past async state-machine switch for 'anext'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
(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=--compile_all --error_on_bad_type --error_on_bad_override --verbos e_debug
5
6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart';
9 import 'dart:developer';
10
11 foo() async { }
12
13 doAsync(stop) async {
14 if (stop) debugger();
15 await foo(); // Line 15.
16 await foo(); // Line 16.
17 await foo(); // Line 17.
18 return null;
19 }
20
21 testMain() {
22 // With two runs of doAsync floating around, async step should only cause
23 // us to stop in the run we started in.
24 doAsync(false);
25 doAsync(true);
26 }
27
28 asyncStep(Isolate isolate) async {
29 await isolate.reload(); // isolate.pauseEvent may be stale
30 ServiceEvent event = isolate.pauseEvent;
31 print("Pause event is $event");
32 expect(event, isNotNull);
33 expect(event.kind, equals(ServiceEvent.kPauseBreakpoint));
34
35 // 1. Set breakpoint for the continuation and resume the isolate.
36 Instance continuation = event.asyncContinuation;
37 print("Async continuation is $continuation");
38 if (continuation == null) {
39 print(await isolate.getStack());
40 }
41 expect(continuation.isClosure, isTrue);
42
43 var bpt = await isolate.addBreakOnActivation(continuation);
44 print("Async step to $bpt");
45 expect(bpt is Breakpoint, isTrue);
46
47 await isolate.resume();
48 await hasStoppedAtBreakpoint(isolate);
49 print("Big step to: ${isolate.pauseEvent}");
50
51 // 2. Step past the state-machine dispatch.
52 await isolate.stepOver();
53 await hasStoppedAtBreakpoint(isolate);
54 print("Small step to: ${isolate.pauseEvent}");
55 }
56
57 var tests = [
58 hasStoppedAtBreakpoint,
59 stoppedAtLine(15),
60 asyncStep,
61 stoppedAtLine(16),
62 asyncStep,
63 stoppedAtLine(17),
64 resumeIsolate,
65 ];
66
67 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698