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

Side by Side Diff: runtime/observatory/tests/service/break_on_activation_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 'test_helper.dart'; 8 import 'test_helper.dart';
9 9
10 genRepeater(value) { 10 genRepeater(value) {
(...skipping 29 matching lines...) Expand all
40 r2(); 40 r2();
41 r3(); 41 r3();
42 } 42 }
43 43
44 void testeeDoNamed() { 44 void testeeDoNamed() {
45 r1_named(y: 'Not a closure', x: 'Not a closure'); 45 r1_named(y: 'Not a closure', x: 'Not a closure');
46 r2_named(y: 'Not a closure', x: 'Not a closure'); 46 r2_named(y: 'Not a closure', x: 'Not a closure');
47 r3_named(y: 'Not a closure', x: 'Not a closure'); 47 r3_named(y: 'Not a closure', x: 'Not a closure');
48 } 48 }
49 49
50 var tests = [
51 (Isolate isolate) async {
52 var rootLib = await isolate.rootLibrary.load();
50 53
51 var tests = [ 54 var breaksHit = 0;
52 (Isolate isolate) async {
53 var rootLib = await isolate.rootLibrary.load();
54 55
55 var breaksHit = 0; 56 var subscriptionFuture =
57 isolate.vm.listenEventStream(VM.kDebugStream, (ServiceEvent event) {
58 if (event.kind == ServiceEvent.kPauseBreakpoint) {
59 print("Hit breakpoint ${event.breakpoint}");
60 breaksHit++;
61 isolate.resume();
62 }
63 });
56 64
57 var subscriptionFuture = isolate.vm.listenEventStream( 65 valueOfField(String name) async {
58 VM.kDebugStream, (ServiceEvent event) { 66 var field = rootLib.variables.singleWhere((v) => v.name == name);
59 if (event.kind == ServiceEvent.kPauseBreakpoint) { 67 await field.load();
60 print("Hit breakpoint ${event.breakpoint}"); 68 return field.staticValue;
61 breaksHit++; 69 }
62 isolate.resume();
63 }
64 });
65 70
66 valueOfField(String name) async { 71 var r1Ref = await valueOfField('r1');
67 var field = rootLib.variables.singleWhere((v) => v.name == name);
68 await field.load();
69 return field.staticValue;
70 72
71 } 73 var bpt1 = await isolate.addBreakOnActivation(r1Ref);
72 var r1Ref = await valueOfField('r1'); 74 print("Added breakpoint $bpt1");
75 expect(bpt1 is Breakpoint, isTrue);
76 expect(breaksHit, equals(0));
77 await r1Ref.reload();
78 expect(r1Ref.activationBreakpoint, equals(bpt1));
79 print("testeeDo()");
80 var res = await rootLib.evaluate("testeeDo()");
81 expect(res is Instance, isTrue); // Not error.
82 expect(breaksHit, equals(1));
73 83
74 var bpt1 = await isolate.addBreakOnActivation(r1Ref); 84 await isolate.removeBreakpoint(bpt1);
75 print("Added breakpoint $bpt1"); 85 print("Removed breakpoint $bpt1");
76 expect(bpt1 is Breakpoint, isTrue); 86 print("testeeDo()");
77 expect(breaksHit, equals(0)); 87 await r1Ref.reload();
78 await r1Ref.reload(); 88 expect(r1Ref.activationBreakpoint, equals(null));
79 expect(r1Ref.activationBreakpoint, equals(bpt1)); 89 res = await rootLib.evaluate("testeeDo()");
80 print("testeeDo()"); 90 expect(res is Instance, isTrue); // Not error.
81 var res = await rootLib.evaluate("testeeDo()"); 91 expect(breaksHit, equals(1));
82 expect(res is Instance, isTrue); // Not error.
83 expect(breaksHit, equals(1));
84 92
85 await isolate.removeBreakpoint(bpt1); 93 await cancelFutureSubscription(subscriptionFuture);
86 print("Removed breakpoint $bpt1"); 94 },
87 print("testeeDo()"); 95 (Isolate isolate) async {
88 await r1Ref.reload(); 96 var rootLib = await isolate.rootLibrary.load();
89 expect(r1Ref.activationBreakpoint, equals(null));
90 res = await rootLib.evaluate("testeeDo()");
91 expect(res is Instance, isTrue); // Not error.
92 expect(breaksHit, equals(1));
93 97
94 await cancelFutureSubscription(subscriptionFuture); 98 var breaksHit = 0;
95 },
96 99
97 (Isolate isolate) async { 100 var subscriptionFuture =
98 var rootLib = await isolate.rootLibrary.load(); 101 isolate.vm.listenEventStream(VM.kDebugStream, (ServiceEvent event) {
102 if (event.kind == ServiceEvent.kPauseBreakpoint) {
103 print("Hit breakpoint ${event.breakpoint}");
104 breaksHit++;
105 isolate.resume();
106 }
107 });
99 108
100 var breaksHit = 0; 109 valueOfField(String name) async {
110 var field = rootLib.variables.singleWhere((v) => v.name == name);
111 await field.load();
112 return field.staticValue;
113 }
101 114
102 var subscriptionFuture = isolate.vm.listenEventStream( 115 var r1Ref = await valueOfField('r1_named');
103 VM.kDebugStream, (ServiceEvent event) {
104 if (event.kind == ServiceEvent.kPauseBreakpoint) {
105 print("Hit breakpoint ${event.breakpoint}");
106 breaksHit++;
107 isolate.resume();
108 }
109 });
110 116
111 valueOfField(String name) async { 117 var bpt1 = await isolate.addBreakOnActivation(r1Ref);
112 var field = rootLib.variables.singleWhere((v) => v.name == name); 118 print("Added breakpoint $bpt1");
113 await field.load(); 119 expect(bpt1 is Breakpoint, isTrue);
114 return field.staticValue; 120 expect(breaksHit, equals(0));
115 } 121 await r1Ref.reload();
116 var r1Ref = await valueOfField('r1_named'); 122 expect(r1Ref.activationBreakpoint, equals(bpt1));
123 print("testeeDoNamed()");
124 var res = await rootLib.evaluate("testeeDoNamed()");
125 expect(res is Instance, isTrue); // Not error.
126 expect(breaksHit, equals(1));
117 127
118 var bpt1 = await isolate.addBreakOnActivation(r1Ref); 128 await isolate.removeBreakpoint(bpt1);
119 print("Added breakpoint $bpt1"); 129 print("Removed breakpoint $bpt1");
120 expect(bpt1 is Breakpoint, isTrue); 130 await r1Ref.reload();
121 expect(breaksHit, equals(0)); 131 expect(r1Ref.activationBreakpoint, equals(null));
122 await r1Ref.reload(); 132 print("testeeDoNamed()");
123 expect(r1Ref.activationBreakpoint, equals(bpt1)); 133 res = await rootLib.evaluate("testeeDoNamed()");
124 print("testeeDoNamed()"); 134 expect(res is Instance, isTrue); // Not error.
125 var res = await rootLib.evaluate("testeeDoNamed()"); 135 expect(breaksHit, equals(1));
126 expect(res is Instance, isTrue); // Not error.
127 expect(breaksHit, equals(1));
128 136
129 await isolate.removeBreakpoint(bpt1); 137 await cancelFutureSubscription(subscriptionFuture);
130 print("Removed breakpoint $bpt1"); 138 },
131 await r1Ref.reload(); 139 (Isolate isolate) async {
132 expect(r1Ref.activationBreakpoint, equals(null)); 140 var rootLib = await isolate.rootLibrary.load();
133 print("testeeDoNamed()");
134 res = await rootLib.evaluate("testeeDoNamed()");
135 expect(res is Instance, isTrue); // Not error.
136 expect(breaksHit, equals(1));
137 141
138 await cancelFutureSubscription(subscriptionFuture); 142 var breaksHit = 0;
139 },
140 143
141 (Isolate isolate) async { 144 var subscriptionFuture =
142 var rootLib = await isolate.rootLibrary.load(); 145 isolate.vm.listenEventStream(VM.kDebugStream, (ServiceEvent event) {
146 if (event.kind == ServiceEvent.kPauseBreakpoint) {
147 print("Hit breakpoint ${event.breakpoint}");
148 breaksHit++;
149 isolate.resume();
150 }
151 });
143 152
144 var breaksHit = 0; 153 valueOfField(String name) async {
154 var field = rootLib.variables.singleWhere((v) => v.name == name);
155 await field.load();
156 return field.staticValue;
157 }
145 158
146 var subscriptionFuture = isolate.vm.listenEventStream( 159 var r1Ref = await valueOfField('r1');
147 VM.kDebugStream, (ServiceEvent event) { 160 var r2Ref = await valueOfField('r2');
148 if (event.kind == ServiceEvent.kPauseBreakpoint) {
149 print("Hit breakpoint ${event.breakpoint}");
150 breaksHit++;
151 isolate.resume();
152 }
153 });
154 161
155 valueOfField(String name) async { 162 var bpt1 = await isolate.addBreakOnActivation(r1Ref);
156 var field = rootLib.variables.singleWhere((v) => v.name == name); 163 print("Added breakpoint $bpt1");
157 await field.load(); 164 expect(bpt1 is Breakpoint, isTrue);
158 return field.staticValue; 165 expect(breaksHit, equals(0));
159 } 166 await r1Ref.reload();
160 var r1Ref = await valueOfField('r1'); 167 expect(r1Ref.activationBreakpoint, equals(bpt1));
161 var r2Ref = await valueOfField('r2'); 168 print("testeeDo()");
169 var res = await rootLib.evaluate("testeeDo()");
170 expect(res is Instance, isTrue); // Not error.
171 expect(breaksHit, equals(1));
162 172
163 var bpt1 = await isolate.addBreakOnActivation(r1Ref); 173 var bpt2 = await isolate.addBreakOnActivation(r2Ref);
164 print("Added breakpoint $bpt1"); 174 print("Added breakpoint $bpt2");
165 expect(bpt1 is Breakpoint, isTrue); 175 expect(bpt2 is Breakpoint, isTrue);
166 expect(breaksHit, equals(0)); 176 expect(breaksHit, equals(1));
167 await r1Ref.reload(); 177 await r2Ref.reload();
168 expect(r1Ref.activationBreakpoint, equals(bpt1)); 178 expect(r2Ref.activationBreakpoint, equals(bpt2));
169 print("testeeDo()"); 179 print("testeeDo()");
170 var res = await rootLib.evaluate("testeeDo()"); 180 res = await rootLib.evaluate("testeeDo()");
171 expect(res is Instance, isTrue); // Not error. 181 expect(res is Instance, isTrue); // Not error.
172 expect(breaksHit, equals(1)); 182 expect(breaksHit, equals(3));
173 183
174 var bpt2 = await isolate.addBreakOnActivation(r2Ref); 184 await isolate.removeBreakpoint(bpt1);
175 print("Added breakpoint $bpt2"); 185 print("Removed breakpoint $bpt1");
176 expect(bpt2 is Breakpoint, isTrue); 186 await r1Ref.reload();
177 expect(breaksHit, equals(1)); 187 expect(r1Ref.activationBreakpoint, equals(null));
178 await r2Ref.reload(); 188 print("testeeDo()");
179 expect(r2Ref.activationBreakpoint, equals(bpt2)); 189 res = await rootLib.evaluate("testeeDo()");
180 print("testeeDo()"); 190 expect(res is Instance, isTrue); // Not error.
181 res = await rootLib.evaluate("testeeDo()"); 191 expect(breaksHit, equals(4));
182 expect(res is Instance, isTrue); // Not error.
183 expect(breaksHit, equals(3));
184 192
185 await isolate.removeBreakpoint(bpt1); 193 await isolate.removeBreakpoint(bpt2);
186 print("Removed breakpoint $bpt1"); 194 print("Removed breakpoint $bpt2");
187 await r1Ref.reload(); 195 await r2Ref.reload();
188 expect(r1Ref.activationBreakpoint, equals(null)); 196 expect(r2Ref.activationBreakpoint, equals(null));
189 print("testeeDo()"); 197 print("testeeDo()");
190 res = await rootLib.evaluate("testeeDo()"); 198 res = await rootLib.evaluate("testeeDo()");
191 expect(res is Instance, isTrue); // Not error. 199 expect(res is Instance, isTrue); // Not error.
192 expect(breaksHit, equals(4)); 200 expect(breaksHit, equals(4));
193 201
194 await isolate.removeBreakpoint(bpt2); 202 await cancelFutureSubscription(subscriptionFuture);
195 print("Removed breakpoint $bpt2"); 203 },
196 await r2Ref.reload();
197 expect(r2Ref.activationBreakpoint, equals(null));
198 print("testeeDo()");
199 res = await rootLib.evaluate("testeeDo()");
200 expect(res is Instance, isTrue); // Not error.
201 expect(breaksHit, equals(4));
202
203 await cancelFutureSubscription(subscriptionFuture);
204 },
205
206 ]; 204 ];
207 205
208 main(args) => runIsolateTests(args, tests, testeeBefore: testeeSetup); 206 main(args) => runIsolateTests(args, tests, testeeBefore: testeeSetup);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698