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

Side by Side Diff: test/inspector/debugger/continue-to-location-target-call-frames.js

Issue 2884613004: [inspector] added in-deeper-frame continue-to-location strategy
Patch Set: rebased Created 3 years, 7 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 2017 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 InspectorTest.log('Check that continue-to-location works with different strategi es.'); 5 InspectorTest.log('Check that continue-to-location works with different strategi es.');
6 6
7 InspectorTest.addScript(` 7 InspectorTest.addScript(`
8 async function asyncFact(n) { 8 async function asyncFact(n) {
9 if (n == 0) return 1; 9 if (n == 0) return 1;
10 let r = n * await asyncFact(n - 1); 10 let r = n * await asyncFact(n - 1);
(...skipping 12 matching lines...) Expand all
23 eval(` + '`' + ` 23 eval(` + '`' + `
24 var a = 1; 24 var a = 1;
25 var b = 2; 25 var b = 2;
26 fact(3); 26 fact(3);
27 console.log(a + b); 27 console.log(a + b);
28 ` + '`' + `); 28 ` + '`' + `);
29 } 29 }
30 30
31 //# sourceURL=test.js`, 7, 26); 31 //# sourceURL=test.js`, 7, 26);
32 32
33 InspectorTest.addScript(`
34 function foo() {
35 return 42;
36 }
37
38 function testInDeeperFrame() {
39 debugger;
40 setTimeout(foo, 0);
41 callFunction(false, foo);
42 callFunction(true, foo);
43 [1].map(x => x * 2).map(foo);
44 callFunction(true, () => {
45 var a = 1;
46 console.log(a);
47 });
48 }
49
50 async function callFunction(usePromise, cb) {
51 if (usePromise) {
52 Promise.resolve().then(cb);
53 } else {
54 setTimeout(cb, 0);
55 }
56 }
57 //# sourceURL=test-deeper-frame.js`)
58
33 InspectorTest.setupScriptMap(); 59 InspectorTest.setupScriptMap();
34 InspectorTest.runAsyncTestSuite([ 60 InspectorTest.runAsyncTestSuite([
35 async function testAwaitAny() { 61 async function testAwaitAny() {
36 Protocol.Debugger.enable(); 62 Protocol.Debugger.enable();
37 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); 63 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 });
38 Protocol.Debugger.pause(); 64 Protocol.Debugger.pause();
39 Protocol.Runtime.evaluate({expression: 'asyncFact(4)//# sourceURL=expr.js'}) ; 65 Protocol.Runtime.evaluate({expression: 'asyncFact(4)//# sourceURL=expr.js'}) ;
40 await pausedAndDumpStack(); 66 await pausedAndDumpStack();
41 Protocol.Debugger.stepInto(); 67 Protocol.Debugger.stepInto();
42 let message = await pausedAndDumpStack(); 68 let message = await pausedAndDumpStack();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 Protocol.Debugger.stepInto(); 146 Protocol.Debugger.stepInto();
121 await pausedAndDumpStack(); 147 await pausedAndDumpStack();
122 Protocol.Debugger.stepInto(); 148 Protocol.Debugger.stepInto();
123 let message = await pausedAndDumpStack(); 149 let message = await pausedAndDumpStack();
124 let location = message.params.callFrames[0].location; 150 let location = message.params.callFrames[0].location;
125 location.lineNumber = 4; 151 location.lineNumber = 4;
126 Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'} ); 152 Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'} );
127 await pausedAndDumpStack(); 153 await pausedAndDumpStack();
128 await Protocol.Debugger.resume(); 154 await Protocol.Debugger.resume();
129 Protocol.Debugger.disable(); 155 Protocol.Debugger.disable();
156 },
157
158 async function testRunAllDeeper() {
159 Protocol.Debugger.enable();
160 Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 });
161 const toFoo = {lineNumber: 2, columnNumber: 2};
162 await testInDeeperFrame({lineNumber: 7, columnNumber: 2}, toFoo);
163 await testInDeeperFrame({lineNumber: 8, columnNumber: 2}, toFoo);
164 await testInDeeperFrame({lineNumber: 9, columnNumber: 2}, toFoo);
165 await testInDeeperFrame({lineNumber: 10, columnNumber: 22}, toFoo);
166 await testInDeeperFrame({lineNumber: 11, columnNumber: 2}, {lineNumber: 12, columnNumber: 4});
167 await Protocol.Debugger.resume();
168 Protocol.Debugger.disable();
130 } 169 }
131 ]); 170 ]);
132 171
133 async function pausedAndDumpStack() { 172 async function pausedAndDumpStack() {
134 let message = await Protocol.Debugger.oncePaused(); 173 let message = await Protocol.Debugger.oncePaused();
135 InspectorTest.logCallFrames(message.params.callFrames); 174 InspectorTest.logCallFrames(message.params.callFrames);
136 InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); 175 InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace);
137 InspectorTest.log(''); 176 InspectorTest.log('');
138 return message; 177 return message;
139 } 178 }
179
180 async function testInDeeperFrame(from, to) {
181 Protocol.Runtime.evaluate({expression: 'testInDeeperFrame()//# sourceURL=expr. js'});
182 let message = await Protocol.Debugger.oncePaused();
183 let location = message.params.callFrames[0].location;
184 location.lineNumber = from.lineNumber;
185 location.columnNumber = from.columnNumber;
186 InspectorTest.log('Run test from: ' + JSON.stringify(from));
187 await InspectorTest.logSourceLocation(location);
188 Protocol.Debugger.continueToLocation({location, targetCallFrames: 'any'});
189 await pausedAndDumpStack();
190 location.lineNumber = to.lineNumber;
191 location.columnNumber = to.columnNumber;
192 Protocol.Debugger.continueToLocation({location, targetCallFrames: 'deeper'});
193 await pausedAndDumpStack();
194 await Protocol.Debugger.resume();
195 }
OLDNEW
« no previous file with comments | « src/inspector/v8-stack-trace-impl.cc ('k') | test/inspector/debugger/continue-to-location-target-call-frames-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698