| OLD | NEW |
| 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 Loading... |
| 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 } | |
| OLD | NEW |