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

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

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: 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
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:observatory/models.dart' as M; 7 import 'package:observatory/models.dart' as M;
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'test_helper.dart'; 9 import 'test_helper.dart';
10 import 'service_test_common.dart'; 10 import 'service_test_common.dart';
11 11
12 const LINE_A = 37; 12 const LINE_A = 34;
13 13
14 class Foo { 14 class Foo {}
15
16 }
17 15
18 doThrow() { 16 doThrow() {
19 throw "TheException"; // Line 13. 17 throw "TheException"; // Line 13.
20 return "end of doThrow"; 18 return "end of doThrow";
21 } 19 }
22 20
23 asyncThrower() async { 21 asyncThrower() async {
24 doThrow(); 22 doThrow();
25 } 23 }
26 24
27 testeeMain() async { 25 testeeMain() async {
28 try { 26 try {
29 // caught. 27 // caught.
30 try { 28 try {
31 await asyncThrower(); 29 await asyncThrower();
32 } catch (e) { 30 } catch (e) {}
33 }
34 31
35 // uncaught. 32 // uncaught.
36 try { 33 try {
37 await asyncThrower(); // LINE_A. 34 await asyncThrower(); // LINE_A.
38 } on double catch (e) { 35 } on double catch (e) {}
39 } 36 } on Foo catch (e) {}
40 } on Foo catch (e) {
41 }
42 } 37 }
43 38
44 var tests = [ 39 var tests = [
45 hasStoppedWithUnhandledException, 40 hasStoppedWithUnhandledException,
46
47 (Isolate isolate) async { 41 (Isolate isolate) async {
48 print("We stoppped!"); 42 print("We stoppped!");
49 var stack = await isolate.getStack(); 43 var stack = await isolate.getStack();
50 expect(stack['asyncCausalFrames'], isNotNull); 44 expect(stack['asyncCausalFrames'], isNotNull);
51 var asyncStack = stack['asyncCausalFrames']; 45 var asyncStack = stack['asyncCausalFrames'];
52 expect(asyncStack[0].toString(), contains('doThrow')); 46 expect(asyncStack[0].toString(), contains('doThrow'));
53 expect(asyncStack[1].toString(), contains('asyncThrower')); 47 expect(asyncStack[1].toString(), contains('asyncThrower'));
54 expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker)); 48 expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker));
55 expect(asyncStack[3].toString(), contains('testeeMain')); 49 expect(asyncStack[3].toString(), contains('testeeMain'));
56 // We've stopped at LINE_A. 50 // We've stopped at LINE_A.
57 expect(await asyncStack[3].location.toUserString(), 51 expect(
58 contains('.dart:$LINE_A')); 52 await asyncStack[3].location.toUserString(), contains('.dart:$LINE_A'));
59 } 53 }
60 ]; 54 ];
61 55
62 main(args) => runIsolateTests(args, 56 main(args) => runIsolateTests(args, tests,
63 tests, 57 pause_on_unhandled_exceptions: true, testeeConcurrent: testeeMain);
64 pause_on_unhandled_exceptions: true,
65 testeeConcurrent: testeeMain);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698