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

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

Issue 2692803006: Track the 'awaiter return' call stack use it to detect uncaught exceptions in async functions (Closed)
Patch Set: rmacnak review Created 3 years, 9 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) 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 // VMOptions=--error_on_bad_type --error_on_bad_override
5
6 import 'package:observatory/service_io.dart';
7 import 'package:observatory/models.dart' as M;
8 import 'package:unittest/unittest.dart';
9 import 'test_helper.dart';
10 import 'service_test_common.dart';
11
12 const LINE_A = 29;
13
14 class Foo {
15
16 }
17
18 doThrow() {
19 throw "TheException"; // Line 13.
20 return "end of doThrow";
21 }
22
23 asyncThrower() async {
24 doThrow();
25 }
26
27 testeeMain() async {
28 // No try ... catch.
29 await asyncThrower();
30 }
31
32 var tests = [
33 hasStoppedWithUnhandledException,
34
35 (Isolate isolate) async {
36 print("We stoppped!");
37 var stack = await isolate.getStack();
38 expect(stack['asyncCausalFrames'], isNotNull);
39 var asyncStack = stack['asyncCausalFrames'];
40 expect(asyncStack[0].toString(), contains('doThrow'));
41 expect(asyncStack[1].toString(), contains('asyncThrower'));
42 expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker));
43 expect(asyncStack[3].toString(), contains('testeeMain'));
44 // We've stopped at LINE_A.
45 expect(await asyncStack[3].location.toUserString(),
46 contains('.dart:$LINE_A'));
47 }
48 ];
49
50 main(args) => runIsolateTests(args,
51 tests,
52 pause_on_unhandled_exceptions: true,
53 testeeConcurrent: testeeMain);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698