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

Side by Side Diff: test/inspector/debugger/stepping-with-natives-and-frameworks.js

Issue 2758483002: [debugger] tuned StepNext and StepOut at return position (Closed)
Patch Set: more tests 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 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 InspectorTest.log('Stepping with natives and frameworks.');
6
7 InspectorTest.addScript(`
8 function callAll() {
9 for (var f of arguments)
10 f();
11 }
12 //# sourceURL=framework.js`);
13
14 InspectorTest.setupScriptMap();
15 InspectorTest.dumpProtocolCommand('Debugger.pause');
16 InspectorTest.dumpProtocolCommand('Debugger.stepInto');
17 InspectorTest.dumpProtocolCommand('Debugger.stepOver');
18 InspectorTest.dumpProtocolCommand('Debugger.stepOut');
19 InspectorTest.dumpProtocolCommand('Debugger.resume');
20
21 Protocol.Debugger.enable();
22 Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']});
23 InspectorTest.runAsyncTestSuite([
24 async function testNativeCodeStepOut() {
25 Protocol.Debugger.pause();
26 Protocol.Runtime.evaluate({expression: '[1,2].map(v => v);'});
27 await logPauseLocation(await Protocol.Debugger.oncePaused());
28 Protocol.Debugger.stepInto();
29 await logPauseLocation(await Protocol.Debugger.oncePaused());
30 Protocol.Debugger.stepOut();
31 await logPauseLocation(await Protocol.Debugger.oncePaused());
32 await Protocol.Debugger.resume();
33 },
34
35 async function testNativeCodeStepOver() {
36 Protocol.Debugger.pause();
37 Protocol.Runtime.evaluate({expression: '[1,2].map(v => v);'});
38 await logPauseLocation(await Protocol.Debugger.oncePaused());
39 Protocol.Debugger.stepInto();
40 await logPauseLocation(await Protocol.Debugger.oncePaused());
41 Protocol.Debugger.stepOver();
42 await logPauseLocation(await Protocol.Debugger.oncePaused());
43 Protocol.Debugger.stepOver();
44 await logPauseLocation(await Protocol.Debugger.oncePaused());
45 Protocol.Debugger.stepOver();
46 await logPauseLocation(await Protocol.Debugger.oncePaused());
47 Protocol.Debugger.stepOver();
48 await logPauseLocation(await Protocol.Debugger.oncePaused());
49 await Protocol.Debugger.resume();
50 },
51
52 async function testNativeCodeStepInto() {
53 Protocol.Debugger.pause();
54 Protocol.Runtime.evaluate({expression: '[1,2].map(v => v);'});
55 await logPauseLocation(await Protocol.Debugger.oncePaused());
56 Protocol.Debugger.stepInto();
57 await logPauseLocation(await Protocol.Debugger.oncePaused());
58 Protocol.Debugger.stepInto();
59 await logPauseLocation(await Protocol.Debugger.oncePaused());
60 Protocol.Debugger.stepInto();
61 await logPauseLocation(await Protocol.Debugger.oncePaused());
62 Protocol.Debugger.stepInto();
63 await logPauseLocation(await Protocol.Debugger.oncePaused());
64 Protocol.Debugger.stepInto();
65 await logPauseLocation(await Protocol.Debugger.oncePaused());
66 await Protocol.Debugger.resume();
67 },
68
69 async function testFrameworkCodeStepInto() {
70 Protocol.Debugger.pause();
71 Protocol.Runtime.evaluate({expression: 'callAll(() => 1, () => 2);'});
72 await logPauseLocation(await Protocol.Debugger.oncePaused());
73 Protocol.Debugger.stepInto();
74 await logPauseLocation(await Protocol.Debugger.oncePaused());
75 Protocol.Debugger.stepInto();
76 await logPauseLocation(await Protocol.Debugger.oncePaused());
77 Protocol.Debugger.stepInto();
78 await logPauseLocation(await Protocol.Debugger.oncePaused());
79 Protocol.Debugger.stepInto();
80 await logPauseLocation(await Protocol.Debugger.oncePaused());
81 Protocol.Debugger.stepInto();
82 await logPauseLocation(await Protocol.Debugger.oncePaused());
83 await Protocol.Debugger.resume();
84 },
85
86 async function testFrameworkCodeStepOver() {
87 Protocol.Debugger.pause();
88 Protocol.Runtime.evaluate({expression: 'callAll(() => 1, () => 2);'});
89 await logPauseLocation(await Protocol.Debugger.oncePaused());
90 Protocol.Debugger.stepInto();
91 await logPauseLocation(await Protocol.Debugger.oncePaused());
92 Protocol.Debugger.stepOver();
93 await logPauseLocation(await Protocol.Debugger.oncePaused());
94 Protocol.Debugger.stepOver();
95 await logPauseLocation(await Protocol.Debugger.oncePaused());
96 Protocol.Debugger.stepOver();
97 await logPauseLocation(await Protocol.Debugger.oncePaused());
98 Protocol.Debugger.stepOver();
99 await logPauseLocation(await Protocol.Debugger.oncePaused());
100 await Protocol.Debugger.resume();
101 },
102
103 async function testFrameworkCodeStepOut() {
104 Protocol.Debugger.pause();
105 Protocol.Runtime.evaluate({expression: 'callAll(() => 1, () => 2);'});
106 await logPauseLocation(await Protocol.Debugger.oncePaused());
107 Protocol.Debugger.stepInto();
108 await logPauseLocation(await Protocol.Debugger.oncePaused());
109 Protocol.Debugger.stepOut();
110 await logPauseLocation(await Protocol.Debugger.oncePaused());
111 Protocol.Debugger.stepOut();
112 await logPauseLocation(await Protocol.Debugger.oncePaused());
113 await Protocol.Debugger.resume();
114 },
115
116 async function testFrameworkNextCallDeeperStepOut() {
117 Protocol.Debugger.pause();
118 Protocol.Runtime.evaluate({
119 expression: 'callAll(() => 1, callAll.bind(null, () => 2));'});
120 await logPauseLocation(await Protocol.Debugger.oncePaused());
121 Protocol.Debugger.stepInto();
122 await logPauseLocation(await Protocol.Debugger.oncePaused());
123 Protocol.Debugger.stepOut();
124 await logPauseLocation(await Protocol.Debugger.oncePaused());
125 Protocol.Debugger.stepOut();
126 await logPauseLocation(await Protocol.Debugger.oncePaused());
127 await Protocol.Debugger.resume();
128 },
129
130 async function testFrameworkNextCallDeeperStepOutSameFunction() {
131 await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});
132 Protocol.Debugger.pause();
133 Protocol.Runtime.evaluate({
134 expression: 'callAll(foo, callAll.bind(null, foo));'});
135 await logPauseLocation(await Protocol.Debugger.oncePaused());
136 Protocol.Debugger.stepInto();
137 await logPauseLocation(await Protocol.Debugger.oncePaused());
138 Protocol.Debugger.stepOut();
139 await logPauseLocation(await Protocol.Debugger.oncePaused());
140 await Protocol.Debugger.resume();
141 },
142
143 async function testFrameworkNextCallDeeperStepInto() {
144 Protocol.Debugger.pause();
145 Protocol.Runtime.evaluate({
146 expression: 'callAll(() => 1, callAll.bind(null, () => 2));'});
147 await logPauseLocation(await Protocol.Debugger.oncePaused());
148 Protocol.Debugger.stepInto();
149 await logPauseLocation(await Protocol.Debugger.oncePaused());
150 Protocol.Debugger.stepOver();
151 await logPauseLocation(await Protocol.Debugger.oncePaused());
152 Protocol.Debugger.stepOver();
153 await logPauseLocation(await Protocol.Debugger.oncePaused());
154 Protocol.Debugger.stepOver();
155 await logPauseLocation(await Protocol.Debugger.oncePaused());
156 Protocol.Debugger.stepOver();
157 await logPauseLocation(await Protocol.Debugger.oncePaused());
158 await Protocol.Debugger.resume();
159 },
160
161 async function testFrameworkNextCallDeeperStepOver() {
162 Protocol.Debugger.pause();
163 Protocol.Runtime.evaluate({
164 expression: 'callAll(() => 1, callAll.bind(null, () => 2));'});
165 await logPauseLocation(await Protocol.Debugger.oncePaused());
166 Protocol.Debugger.stepInto();
167 await logPauseLocation(await Protocol.Debugger.oncePaused());
168 Protocol.Debugger.stepOver();
169 await logPauseLocation(await Protocol.Debugger.oncePaused());
170 Protocol.Debugger.stepOver();
171 await logPauseLocation(await Protocol.Debugger.oncePaused());
172 Protocol.Debugger.stepOver();
173 await logPauseLocation(await Protocol.Debugger.oncePaused());
174 Protocol.Debugger.stepOver();
175 await logPauseLocation(await Protocol.Debugger.oncePaused());
176 await Protocol.Debugger.resume();
177 },
178
179 async function testFrameworkCurrentCallDeeperStepOut() {
180 Protocol.Debugger.pause();
181 Protocol.Runtime.evaluate({
182 expression: 'callAll(callAll.bind(null, () => 1), () => 2);'});
183 await logPauseLocation(await Protocol.Debugger.oncePaused());
184 Protocol.Debugger.stepInto();
185 await logPauseLocation(await Protocol.Debugger.oncePaused());
186 Protocol.Debugger.stepOut();
187 await logPauseLocation(await Protocol.Debugger.oncePaused());
188 Protocol.Debugger.stepOut();
189 await logPauseLocation(await Protocol.Debugger.oncePaused());
190 await Protocol.Debugger.resume();
191 },
192
193 async function testFrameworkCurrentCallDeeperStepOutSameFunction() {
194 await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});
195 Protocol.Debugger.pause();
196 Protocol.Runtime.evaluate({
197 expression: 'callAll(callAll.bind(null, foo), foo);'});
198 await logPauseLocation(await Protocol.Debugger.oncePaused());
199 Protocol.Debugger.stepInto();
200 await logPauseLocation(await Protocol.Debugger.oncePaused());
201 Protocol.Debugger.stepOut();
202 await logPauseLocation(await Protocol.Debugger.oncePaused());
203 await Protocol.Debugger.resume();
204 },
205
206 async function testFrameworkCurrentCallDeeperStepOver() {
207 Protocol.Debugger.pause();
208 Protocol.Runtime.evaluate({
209 expression: 'callAll(callAll.bind(null, () => 1), () => 2);'});
210 await logPauseLocation(await Protocol.Debugger.oncePaused());
211 Protocol.Debugger.stepInto();
212 await logPauseLocation(await Protocol.Debugger.oncePaused());
213 Protocol.Debugger.stepOver();
214 await logPauseLocation(await Protocol.Debugger.oncePaused());
215 Protocol.Debugger.stepOver();
216 await logPauseLocation(await Protocol.Debugger.oncePaused());
217 Protocol.Debugger.stepOver();
218 await logPauseLocation(await Protocol.Debugger.oncePaused());
219 Protocol.Debugger.stepOver();
220 await logPauseLocation(await Protocol.Debugger.oncePaused());
221 await Protocol.Debugger.resume();
222 },
223
224 async function testFrameworkCurrentCallDeeperStepInto() {
225 Protocol.Debugger.pause();
226 Protocol.Runtime.evaluate({
227 expression: 'callAll(callAll.bind(null, () => 1), () => 2);'});
228 await logPauseLocation(await Protocol.Debugger.oncePaused());
229 Protocol.Debugger.stepInto();
230 await logPauseLocation(await Protocol.Debugger.oncePaused());
231 Protocol.Debugger.stepInto();
232 await logPauseLocation(await Protocol.Debugger.oncePaused());
233 Protocol.Debugger.stepInto();
234 await logPauseLocation(await Protocol.Debugger.oncePaused());
235 Protocol.Debugger.stepInto();
236 await logPauseLocation(await Protocol.Debugger.oncePaused());
237 Protocol.Debugger.stepInto();
238 await logPauseLocation(await Protocol.Debugger.oncePaused());
239 await Protocol.Debugger.resume();
240 },
241
242 async function testFrameworkStepOverMixed() {
243 await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});
244 Protocol.Debugger.pause();
245 Protocol.Runtime.evaluate({
246 expression: 'callAll(foo, foo, () => 2);'});
247 await logPauseLocation(await Protocol.Debugger.oncePaused());
248 Protocol.Debugger.stepInto();
249 await logPauseLocation(await Protocol.Debugger.oncePaused());
250 Protocol.Debugger.stepOver();
251 await logPauseLocation(await Protocol.Debugger.oncePaused());
252 Protocol.Debugger.stepOver();
253 await logPauseLocation(await Protocol.Debugger.oncePaused());
254 Protocol.Debugger.stepOver();
255 await logPauseLocation(await Protocol.Debugger.oncePaused());
256 Protocol.Debugger.stepOver();
257 await logPauseLocation(await Protocol.Debugger.oncePaused());
258 Protocol.Debugger.stepOver();
259 await logPauseLocation(await Protocol.Debugger.oncePaused());
260 Protocol.Debugger.stepOver();
261 await logPauseLocation(await Protocol.Debugger.oncePaused());
262 await Protocol.Debugger.resume();
263 },
264
265 async function testFrameworkStepOutMixed() {
266 await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});
267 Protocol.Debugger.pause();
268 Protocol.Runtime.evaluate({
269 expression: 'callAll(foo, foo, () => 2);'});
270 await logPauseLocation(await Protocol.Debugger.oncePaused());
271 Protocol.Debugger.stepInto();
272 await logPauseLocation(await Protocol.Debugger.oncePaused());
273 Protocol.Debugger.stepOut();
274 await logPauseLocation(await Protocol.Debugger.oncePaused());
275 Protocol.Debugger.stepOut();
276 await logPauseLocation(await Protocol.Debugger.oncePaused());
277 await Protocol.Debugger.resume();
278 },
279
280 async function testStepOutFrameworkSameFunctionAtReturn() {
281 await Protocol.Runtime.evaluate({expression: 'foo = () => 1'});
282 Protocol.Debugger.pause();
283 Protocol.Runtime.evaluate({
284 expression: 'callAll(foo, foo, () => 2);'});
285 await logPauseLocation(await Protocol.Debugger.oncePaused());
286 Protocol.Debugger.stepInto();
287 await logPauseLocation(await Protocol.Debugger.oncePaused());
288 Protocol.Debugger.stepOver();
289 await logPauseLocation(await Protocol.Debugger.oncePaused());
290 Protocol.Debugger.stepOut();
291 await logPauseLocation(await Protocol.Debugger.oncePaused());
292 Protocol.Debugger.stepOut();
293 await logPauseLocation(await Protocol.Debugger.oncePaused());
294 await Protocol.Debugger.resume();
295 }
296 ]);
297
298 function logPauseLocation(message) {
299 return InspectorTest.logSourceLocation(message.params.callFrames[0].location);
300 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698