OLD | NEW |
(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('Checks Debugger.scheduleStepIntoAsync with setTimeout.'); |
| 6 InspectorTest.setupScriptMap(); |
| 7 Protocol.Debugger.enable(); |
| 8 InspectorTest.runAsyncTestSuite([ |
| 9 async function testSetTimeout() { |
| 10 Protocol.Runtime.evaluate({expression: 'debugger; setTimeout(() => 1, 0);'})
; |
| 11 await Protocol.Debugger.oncePaused(); |
| 12 Protocol.Debugger.stepOver(); |
| 13 await waitPauseAndDumpLocation(); |
| 14 Protocol.Debugger.scheduleStepIntoAsync(); |
| 15 Protocol.Debugger.stepOver(); |
| 16 await waitPauseAndDumpLocation(); |
| 17 await Protocol.Debugger.resume(); |
| 18 }, |
| 19 |
| 20 async function testDebuggerStmtBeforeCallback1() { |
| 21 Protocol.Runtime.evaluate({expression: 'debugger; setTimeout(() => 1, 0);deb
ugger;'}); |
| 22 Protocol.Runtime.evaluate({expression: 'setTimeout(\'debugger//should-break-
here\', 0)'}); |
| 23 await Protocol.Debugger.oncePaused(); |
| 24 Protocol.Debugger.stepOver(); |
| 25 await waitPauseAndDumpLocation(); |
| 26 Protocol.Debugger.scheduleStepIntoAsync(); |
| 27 Protocol.Debugger.stepOver(); |
| 28 await waitPauseAndDumpLocation(); |
| 29 await Protocol.Debugger.resume(); |
| 30 await waitPauseAndDumpLocation(); |
| 31 await Protocol.Debugger.resume(); |
| 32 }, |
| 33 |
| 34 async function testDebuggerStmtBeforeCallback2() { |
| 35 Protocol.Runtime.evaluate({expression: 'debugger;\nsetTimeout(\'debugger//sh
ould-break-here\', 0);\nsetTimeout(() => 1, 0);'}); |
| 36 await Protocol.Debugger.oncePaused(); |
| 37 Protocol.Debugger.stepOver(); |
| 38 await Protocol.Debugger.oncePaused(); |
| 39 Protocol.Debugger.stepOver(); |
| 40 await waitPauseAndDumpLocation(); |
| 41 Protocol.Debugger.scheduleStepIntoAsync(); |
| 42 Protocol.Debugger.stepOver(); |
| 43 await waitPauseAndDumpLocation(); |
| 44 await Protocol.Debugger.resume(); |
| 45 await InspectorTest.waitPendingTasks(); |
| 46 }, |
| 47 |
| 48 async function testSetTimeoutWithoutJS() { |
| 49 Protocol.Runtime.evaluate({expression: 'debugger; setTimeout(\'}\', 0);\nset
Timeout(\'var a = 239;\', 0);\nsetTimeout(\'debugger//should-break-here\', 0);'}
); |
| 50 await Protocol.Debugger.oncePaused(); |
| 51 Protocol.Debugger.stepOver(); |
| 52 await waitPauseAndDumpLocation(); |
| 53 Protocol.Debugger.scheduleStepIntoAsync(); |
| 54 Protocol.Debugger.stepOver(); |
| 55 await waitPauseAndDumpLocation(); |
| 56 await Protocol.Debugger.resume(); |
| 57 }, |
| 58 |
| 59 async function testResume() { |
| 60 Protocol.Debugger.pause(); |
| 61 Protocol.Runtime.evaluate({expression: 'setTimeout(() => 42, 0)'}); |
| 62 await waitPauseAndDumpLocation(); |
| 63 Protocol.Debugger.scheduleStepIntoAsync(); |
| 64 Protocol.Debugger.resume(); |
| 65 await waitPauseAndDumpLocation(); |
| 66 await Protocol.Debugger.resume(); |
| 67 } |
| 68 ]); |
| 69 |
| 70 async function waitPauseAndDumpLocation() { |
| 71 var message = await Protocol.Debugger.oncePaused(); |
| 72 InspectorTest.log('paused at:'); |
| 73 await InspectorTest.logSourceLocation(message.params.callFrames[0].location); |
| 74 return message; |
| 75 } |
OLD | NEW |