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

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

Issue 2751423005: Run dartfmt on all files under runtime. (Closed)
Patch Set: Run dartfmt on all files under runtime. 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'service_test_common.dart'; 8 import 'service_test_common.dart';
9 import 'test_helper.dart'; 9 import 'test_helper.dart';
10 import 'dart:developer'; 10 import 'dart:developer';
11 11
12 const int LINE_A = 24; 12 const int LINE_A = 24;
13 const int LINE_B = 27; 13 const int LINE_B = 27;
14 const int LINE_C = 30; 14 const int LINE_C = 30;
15 15
16 testFunction() { 16 testFunction() {
17 debugger(); 17 debugger();
18 var a; 18 var a;
19 try { 19 try {
20 var b; 20 var b;
21 try { 21 try {
22 for (int i = 0; i < 10; i++) { 22 for (int i = 0; i < 10; i++) {
23 var x = () => i + a + b; 23 var x = () => i + a + b;
24 return x; // LINE_A 24 return x; // LINE_A
25 } 25 }
26 } finally { 26 } finally {
27 b = 10; // LINE_B 27 b = 10; // LINE_B
28 } 28 }
29 } finally { 29 } finally {
30 a = 1; // LINE_C 30 a = 1; // LINE_C
31 } 31 }
32 } 32 }
33 33
34 testMain() { 34 testMain() {
35 var f = testFunction(); 35 var f = testFunction();
36 expect(f(), equals(11)); 36 expect(f(), equals(11));
37 } 37 }
38 38
39 var tests = [ 39 var tests = [
40 40 hasStoppedAtBreakpoint,
41 hasStoppedAtBreakpoint,
42 41
43 // Add breakpoint 42 // Add breakpoint
44 (Isolate isolate) async { 43 (Isolate isolate) async {
45 await isolate.rootLibrary.load(); 44 await isolate.rootLibrary.load();
46 45
47 var script = isolate.rootLibrary.scripts[0]; 46 var script = isolate.rootLibrary.scripts[0];
48 await script.load(); 47 await script.load();
49 48
50 // Add 3 breakpoints. 49 // Add 3 breakpoints.
51 { 50 {
52 var result = await isolate.addBreakpoint(script, LINE_A); 51 var result = await isolate.addBreakpoint(script, LINE_A);
53 expect(result is Breakpoint, isTrue); 52 expect(result is Breakpoint, isTrue);
54 Breakpoint bpt = result; 53 Breakpoint bpt = result;
55 expect(bpt.type, equals('Breakpoint')); 54 expect(bpt.type, equals('Breakpoint'));
56 expect(bpt.location.script.id, equals(script.id)); 55 expect(bpt.location.script.id, equals(script.id));
57 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), 56 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos),
58 equals(LINE_A)); 57 equals(LINE_A));
59 expect(isolate.breakpoints.length, equals(1)); 58 expect(isolate.breakpoints.length, equals(1));
60 } 59 }
61 60
62 { 61 {
63 var result = await isolate.addBreakpoint(script, LINE_B); 62 var result = await isolate.addBreakpoint(script, LINE_B);
64 expect(result is Breakpoint, isTrue); 63 expect(result is Breakpoint, isTrue);
65 Breakpoint bpt = result; 64 Breakpoint bpt = result;
66 expect(bpt.type, equals('Breakpoint')); 65 expect(bpt.type, equals('Breakpoint'));
67 expect(bpt.location.script.id, equals(script.id)); 66 expect(bpt.location.script.id, equals(script.id));
68 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), 67 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos),
69 equals(LINE_B)); 68 equals(LINE_B));
70 expect(isolate.breakpoints.length, equals(2)); 69 expect(isolate.breakpoints.length, equals(2));
71 } 70 }
72 71
73 { 72 {
74 var result = await isolate.addBreakpoint(script, LINE_C); 73 var result = await isolate.addBreakpoint(script, LINE_C);
75 expect(result is Breakpoint, isTrue); 74 expect(result is Breakpoint, isTrue);
76 Breakpoint bpt = result; 75 Breakpoint bpt = result;
77 expect(bpt.type, equals('Breakpoint')); 76 expect(bpt.type, equals('Breakpoint'));
78 expect(bpt.location.script.id, equals(script.id)); 77 expect(bpt.location.script.id, equals(script.id));
79 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos), 78 expect(bpt.location.script.tokenToLine(bpt.location.tokenPos),
80 equals(LINE_C)); 79 equals(LINE_C));
81 expect(isolate.breakpoints.length, equals(3)); 80 expect(isolate.breakpoints.length, equals(3));
82 } 81 }
83 82
84 // Wait for breakpoint events. 83 // Wait for breakpoint events.
85 }, 84 },
86 85
87 resumeIsolate, 86 resumeIsolate,
88 87
89 hasStoppedAtBreakpoint, 88 hasStoppedAtBreakpoint,
90 89
91 // We are at the breakpoint on line LINE_A. 90 // We are at the breakpoint on line LINE_A.
92 (Isolate isolate) async { 91 (Isolate isolate) async {
93 ServiceMap stack = await isolate.getStack(); 92 ServiceMap stack = await isolate.getStack();
94 expect(stack.type, equals('Stack')); 93 expect(stack.type, equals('Stack'));
95 expect(stack['frames'].length, greaterThanOrEqualTo(1)); 94 expect(stack['frames'].length, greaterThanOrEqualTo(1));
96 95
97 Script script = stack['frames'][0].location.script; 96 Script script = stack['frames'][0].location.script;
98 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), 97 expect(script.tokenToLine(stack['frames'][0].location.tokenPos),
99 equals(LINE_A)); 98 equals(LINE_A));
100 }, 99 },
101 100
102 resumeIsolate, 101 resumeIsolate,
103 102
104 hasStoppedAtBreakpoint, 103 hasStoppedAtBreakpoint,
105 104
106 // We are at the breakpoint on line LINE_B. 105 // We are at the breakpoint on line LINE_B.
107 (Isolate isolate) async { 106 (Isolate isolate) async {
108 ServiceMap stack = await isolate.getStack(); 107 ServiceMap stack = await isolate.getStack();
109 expect(stack.type, equals('Stack')); 108 expect(stack.type, equals('Stack'));
110 expect(stack['frames'].length, greaterThanOrEqualTo(1)); 109 expect(stack['frames'].length, greaterThanOrEqualTo(1));
111 110
112 Script script = stack['frames'][0].location.script; 111 Script script = stack['frames'][0].location.script;
113 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), 112 expect(script.tokenToLine(stack['frames'][0].location.tokenPos),
114 equals(LINE_B)); 113 equals(LINE_B));
115 }, 114 },
116 115
117 resumeIsolate, 116 resumeIsolate,
118 117
119 hasStoppedAtBreakpoint, 118 hasStoppedAtBreakpoint,
120 119
121 // We are at the breakpoint on line LINE_C. 120 // We are at the breakpoint on line LINE_C.
122 (Isolate isolate) async { 121 (Isolate isolate) async {
123 ServiceMap stack = await isolate.getStack(); 122 ServiceMap stack = await isolate.getStack();
124 expect(stack.type, equals('Stack')); 123 expect(stack.type, equals('Stack'));
125 expect(stack['frames'].length, greaterThanOrEqualTo(1)); 124 expect(stack['frames'].length, greaterThanOrEqualTo(1));
126 125
127 Script script = stack['frames'][0].location.script; 126 Script script = stack['frames'][0].location.script;
128 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), 127 expect(script.tokenToLine(stack['frames'][0].location.tokenPos),
129 equals(LINE_C)); 128 equals(LINE_C));
130 }, 129 },
131 130
132 resumeIsolate, 131 resumeIsolate,
133
134 ]; 132 ];
135 133
136 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); 134 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/debugger_location_test.dart ('k') | runtime/observatory/tests/service/debugging_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698