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

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

Issue 2646093006: Fix debugger's calculation of the context level in async code. (Closed)
Patch Set: remove dead code Created 3 years, 11 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 | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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
5 import 'dart:async';
6 import 'test_helper.dart';
7 import 'service_test_common.dart';
8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart';
10
11 const int LINE_A = 28, LINE_B = 33;
12
13 class VMServiceClient {
14 VMServiceClient(this.x);
15 close() => new Future.microtask(() => print("close"));
16 var x;
17 }
18
19 collect() async {
20 var uri = "abc";
21 var vmService;
22 await new Future.microtask(() async {
23 try {
24 vmService = new VMServiceClient(uri);
25 await new Future.microtask(() => throw new TimeoutException("here"));
26 } on dynamic {
27 vmService.close();
28 rethrow; // LINE_A
29 }
30 });
31 }
32
33 test_code() async { // LINE_B
34 await collect();
35 }
36
37 Future<Isolate> stepThroughProgram(Isolate isolate) async {
38 Completer completer = new Completer();
39 int pauseEventsSeen = 0;
40
41 await subscribeToStream(isolate.vm, VM.kDebugStream,
42 (ServiceEvent event) async {
43 if (event.kind == ServiceEvent.kPauseBreakpoint) {
44 // We are paused: Step further.
45 pauseEventsSeen++;
46 isolate.stepInto();
47 } else if (event.kind == ServiceEvent.kPauseExit) {
48 // We are at the exit: The test is done.
49 expect(pauseEventsSeen > 20, true,
50 reason: "Saw only $pauseEventsSeen pause events.");
51 await cancelStreamSubscription(VM.kDebugStream);
52 completer.complete();
53 }
54 });
55 isolate.resume();
56 return completer.future;
57 }
58
59 var tests = [hasPausedAtStart,
60 setBreakpointAtLine(LINE_B),
61 resumeIsolate,
62 hasStoppedAtBreakpoint,
63 setBreakpointAtLine(LINE_A),
64 resumeIsolate,
65 hasStoppedAtBreakpoint,
66 stepOut,
67 stoppedAtLine(LINE_B),
68 resumeIsolate];
69
70 main(args) => runIsolateTestsSynchronous(args, tests,
71 testeeConcurrent: test_code, pause_on_start: true, pause_on_exit: false);
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698