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

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

Issue 2829463003: Format all remaining unformatted runtime files other than multitests. (Closed)
Patch Set: Created 3 years, 8 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 --async_debugger 4 // VMOptions=--error_on_bad_type --error_on_bad_override --async_debugger
5 // VMOptions=--optimization-counter-threshold=5 --error_on_bad_type --error_on_b ad_override --async_debugger 5 // VMOptions=--optimization-counter-threshold=5 --error_on_bad_type --error_on_b ad_override --async_debugger
6 6
7 import 'package:observatory/service_io.dart'; 7 import 'package:observatory/service_io.dart';
8 import 'package:observatory/models.dart' as M; 8 import 'package:observatory/models.dart' as M;
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart'; 10 import 'test_helper.dart';
11 import 'service_test_common.dart'; 11 import 'service_test_common.dart';
12 12
13 const LINE_A = 36; 13 const LINE_A = 34;
14 14
15 class Foo { 15 class Foo {}
16
17 }
18 16
19 doThrow() { 17 doThrow() {
20 throw "TheException"; // Line 13. 18 throw "TheException"; // Line 13.
21 return "end of doThrow"; 19 return "end of doThrow";
22 } 20 }
23 21
24 asyncThrower() async { 22 asyncThrower() async {
25 doThrow(); 23 doThrow();
26 } 24 }
27 25
28 testeeMain() async { 26 testeeMain() async {
29 // Trigger optimization via OSR. 27 // Trigger optimization via OSR.
30 var s = 0; 28 var s = 0;
31 for (var i = 0; i < 100; i++) { 29 for (var i = 0; i < 100; i++) {
32 s += i; 30 s += i;
33 } 31 }
34 print(s); 32 print(s);
35 // No try ... catch. 33 // No try ... catch.
36 await asyncThrower(); // LINE_A 34 await asyncThrower(); // LINE_A
37 } 35 }
38 36
39 var tests = [ 37 var tests = [
40 hasStoppedWithUnhandledException, 38 hasStoppedWithUnhandledException,
41
42 (Isolate isolate) async { 39 (Isolate isolate) async {
43 print("We stoppped!"); 40 print("We stoppped!");
44 var stack = await isolate.getStack(); 41 var stack = await isolate.getStack();
45 expect(stack['asyncCausalFrames'], isNotNull); 42 expect(stack['asyncCausalFrames'], isNotNull);
46 var asyncStack = stack['asyncCausalFrames']; 43 var asyncStack = stack['asyncCausalFrames'];
47 expect(asyncStack[0].toString(), contains('doThrow')); 44 expect(asyncStack[0].toString(), contains('doThrow'));
48 expect(asyncStack[1].toString(), contains('asyncThrower')); 45 expect(asyncStack[1].toString(), contains('asyncThrower'));
49 expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker)); 46 expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker));
50 expect(asyncStack[3].toString(), contains('testeeMain')); 47 expect(asyncStack[3].toString(), contains('testeeMain'));
51 // We've stopped at LINE_A. 48 // We've stopped at LINE_A.
52 expect(await asyncStack[3].location.toUserString(), 49 expect(
53 contains('.dart:$LINE_A')); 50 await asyncStack[3].location.toUserString(), contains('.dart:$LINE_A'));
54 } 51 }
55 ]; 52 ];
56 53
57 main(args) => runIsolateTests(args, 54 main(args) => runIsolateTests(args, tests,
58 tests, 55 pause_on_unhandled_exceptions: true, testeeConcurrent: testeeMain);
59 pause_on_unhandled_exceptions: true,
60 testeeConcurrent: testeeMain);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698