Chromium Code Reviews| 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.'); | |
| 6 | |
| 7 InspectorTest.addScript(` | |
| 8 function testNoScheduledTask() { | |
| 9 debugger; | |
| 10 return 42; | |
| 11 } | |
| 12 | |
| 13 function testSimple() { | |
| 14 debugger; | |
| 15 Promise.resolve().then(v => v * 2); | |
| 16 } | |
| 17 | |
| 18 function testNotResolvedPromise() { | |
| 19 var resolveCallback; | |
| 20 var p = new Promise(resolve => resolveCallback = resolve); | |
| 21 debugger; | |
| 22 p.then(v => v * 2); | |
| 23 resolveCallback(); | |
| 24 } | |
| 25 | |
| 26 function testTwoAsyncTasks() { | |
| 27 debugger; | |
| 28 Promise.resolve().then(v => v * 2); | |
| 29 Promise.resolve().then(v => v * 4); | |
| 30 } | |
| 31 | |
| 32 function testTwoAsyncTasksWithBreak() { | |
| 33 debugger; | |
| 34 Promise.resolve().then(v => v * 2); | |
| 35 debugger; | |
| 36 Promise.resolve().then(v => v * 4); | |
| 37 } | |
| 38 //# sourceURL=test.js`); | |
| 39 | |
| 40 InspectorTest.setupScriptMap(); | |
| 41 | |
| 42 Protocol.Debugger.enable(); | |
| 43 InspectorTest.runAsyncTestSuite([ | |
| 44 async function testScheduleErrors() { | |
| 45 Protocol.Runtime.evaluate({ expression: 'testNoScheduledTask()' }); | |
| 46 await waitPauseAndDumpLocation(); | |
| 47 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 48 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 49 await Protocol.Debugger.stepInto(); | |
| 50 await waitPauseAndDumpLocation(); | |
| 51 await Protocol.Debugger.resume(); | |
| 52 }, | |
| 53 | |
| 54 async function testSimple() { | |
| 55 Protocol.Runtime.evaluate({ expression: 'testSimple()' }); | |
| 56 await waitPauseAndDumpLocation(); | |
| 57 await Protocol.Debugger.stepOver(); | |
|
dgozman
2017/03/01 23:03:57
Should not await stepping most of the time.
kozy
2017/03/02 00:53:03
Done.
| |
| 58 await waitPauseAndDumpLocation(); | |
| 59 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 60 await Protocol.Debugger.stepInto(); | |
| 61 await waitPauseAndDumpLocation(); | |
| 62 await Protocol.Debugger.resume(); | |
| 63 }, | |
| 64 | |
| 65 async function testNotResolvedPromise() { | |
| 66 Protocol.Runtime.evaluate({ expression: 'testNotResolvedPromise()' }); | |
| 67 await waitPauseAndDumpLocation(); | |
| 68 await Protocol.Debugger.stepOver(); | |
| 69 await waitPauseAndDumpLocation(); | |
| 70 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 71 await Protocol.Debugger.stepInto(); | |
| 72 await waitPauseAndDumpLocation(); | |
| 73 await Protocol.Debugger.resume(); | |
| 74 }, | |
| 75 | |
| 76 async function testTwoAsyncTasks() { | |
| 77 Protocol.Runtime.evaluate({ expression: 'testTwoAsyncTasks()'}); | |
| 78 await waitPauseAndDumpLocation(); | |
| 79 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 80 await Protocol.Debugger.resume(); | |
| 81 await waitPauseAndDumpLocation(); | |
| 82 await Protocol.Debugger.resume(); | |
| 83 }, | |
| 84 | |
| 85 async function testTwoTasksAndGoToSecond() { | |
| 86 Protocol.Runtime.evaluate({ expression: 'testTwoAsyncTasks()'}); | |
| 87 await waitPauseAndDumpLocation(); | |
| 88 await Protocol.Debugger.stepOver(); | |
| 89 await waitPauseAndDumpLocation(); | |
| 90 await Protocol.Debugger.stepOver(); | |
| 91 await waitPauseAndDumpLocation(); | |
| 92 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 93 await Protocol.Debugger.resume(); | |
| 94 await waitPauseAndDumpLocation(); | |
| 95 await Protocol.Debugger.resume(); | |
| 96 }, | |
| 97 | |
| 98 async function testTwoAsyncTasksWithBreak() { | |
| 99 Protocol.Runtime.evaluate({ expression: 'testTwoAsyncTasksWithBreak()'}); | |
| 100 await waitPauseAndDumpLocation(); | |
| 101 await Protocol.Debugger.stepOver(); | |
| 102 await waitPauseAndDumpLocation(); | |
| 103 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 104 await Protocol.Debugger.resume(); | |
| 105 await waitPauseAndDumpLocation(); | |
| 106 Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); | |
| 107 await Protocol.Debugger.resume(); | |
| 108 await waitPauseAndDumpLocation(); | |
| 109 await Protocol.Debugger.resume(); | |
| 110 } | |
| 111 ]); | |
| 112 | |
| 113 async function waitPauseAndDumpLocation() { | |
| 114 var message = await Protocol.Debugger.oncePaused(); | |
| 115 InspectorTest.log('paused at:'); | |
| 116 InspectorTest.logCallFrameSourceLocation(message.params.callFrames[0]); | |
| 117 return message; | |
| 118 } | |
| OLD | NEW |