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

Side by Side Diff: test/inspector/debugger/resources/break-locations.js

Issue 2710903003: [inspector] added master test for break locations (Closed)
Patch Set: addressed comments 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 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 print('Checks possible break locations.');
6
7 InspectorTest.addScript(`
8
9 function testEval() { 5 function testEval() {
10 eval('// comment only'); 6 eval('// comment only');
11 eval('// comment only\\n'); 7 eval('// comment only\n');
12 } 8 }
13 9
14 // function without return 10 // function without return
15 function procedure() { 11 function procedure() {
16 var a = 1; 12 var a = 1;
17 var b = 2; 13 var b = 2;
18 } 14 }
19 15
20 function testProcedure() { 16 function testProcedure() {
21 procedure(); 17 procedure();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 203 }
208 204
209 async function asyncFoo() { 205 async function asyncFoo() {
210 await Promise.resolve().then(v => v * 2); 206 await Promise.resolve().then(v => v * 2);
211 return42(); 207 return42();
212 await asyncBoo(); 208 await asyncBoo();
213 } 209 }
214 210
215 async function asyncBoo() { 211 async function asyncBoo() {
216 await Promise.resolve(); 212 await Promise.resolve();
217
218 } 213 }
219 214
220 async function testAsyncAwait() { 215 async function testAsyncAwait() {
221 await asyncFoo(); 216 await asyncFoo();
222 await awaitBoo(); 217 await awaitBoo();
223 } 218 }
224 219
225 //# sourceURL=test.js`); 220 //# sourceURL=break-locations.js
226
227 InspectorTest.setupScriptMap();
228 Protocol.Debugger.onPaused(message => {
229 var frames = message.params.callFrames;
230 if (frames.length === 1) {
231 Protocol.Debugger.stepInto();
232 return;
233 }
234 var scriptId = frames[0].location.scriptId;
235 InspectorTest.log('break at:');
236 InspectorTest.logCallFrameSourceLocation(frames[0])
237 .then(() => Protocol.Debugger.stepInto());
238 });
239
240 Protocol.Debugger.enable();
241 Protocol.Runtime.evaluate({ expression: 'Object.keys(this).filter(name => name.i ndexOf(\'test\') === 0)', returnByValue: true })
242 .then(runTests);
243
244 function runTests(message) {
245 var tests = message.result.result.value;
246 InspectorTest.runTestSuite(tests.map(test => eval(`(function ${test}(next) {
247 Protocol.Runtime.evaluate({ expression: 'debugger; ${test}()', awaitPromise: ${test.indexOf('testPromise') === 0}}).then(next);
248 })`)));
249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698