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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/regress_28443_test.dart
diff --git a/runtime/observatory/tests/service/regress_28443_test.dart b/runtime/observatory/tests/service/regress_28443_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..09ffa798eea569cec9133a35c4cdb71698f0a69c
--- /dev/null
+++ b/runtime/observatory/tests/service/regress_28443_test.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'service_test_common.dart';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+const int LINE_A = 28, LINE_B = 33;
+
+class VMServiceClient {
+ VMServiceClient(this.x);
+ close() => new Future.microtask(() => print("close"));
+ var x;
+}
+
+collect() async {
+ var uri = "abc";
+ var vmService;
+ await new Future.microtask(() async {
+ try {
+ vmService = new VMServiceClient(uri);
+ await new Future.microtask(() => throw new TimeoutException("here"));
+ } on dynamic {
+ vmService.close();
+ rethrow; // LINE_A
+ }
+ });
+}
+
+test_code() async { // LINE_B
+ await collect();
+}
+
+Future<Isolate> stepThroughProgram(Isolate isolate) async {
+ Completer completer = new Completer();
+ int pauseEventsSeen = 0;
+
+ await subscribeToStream(isolate.vm, VM.kDebugStream,
+ (ServiceEvent event) async {
+ if (event.kind == ServiceEvent.kPauseBreakpoint) {
+ // We are paused: Step further.
+ pauseEventsSeen++;
+ isolate.stepInto();
+ } else if (event.kind == ServiceEvent.kPauseExit) {
+ // We are at the exit: The test is done.
+ expect(pauseEventsSeen > 20, true,
+ reason: "Saw only $pauseEventsSeen pause events.");
+ await cancelStreamSubscription(VM.kDebugStream);
+ completer.complete();
+ }
+ });
+ isolate.resume();
+ return completer.future;
+}
+
+var tests = [hasPausedAtStart,
+ setBreakpointAtLine(LINE_B),
+ resumeIsolate,
+ hasStoppedAtBreakpoint,
+ setBreakpointAtLine(LINE_A),
+ resumeIsolate,
+ hasStoppedAtBreakpoint,
+ stepOut,
+ stoppedAtLine(LINE_B),
+ resumeIsolate];
+
+main(args) => runIsolateTestsSynchronous(args, tests,
+ testeeConcurrent: test_code, pause_on_start: true, pause_on_exit: false);
« 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