Chromium Code Reviews| Index: test/inspector/debugger/schedule-step-into-async.js |
| diff --git a/test/inspector/debugger/schedule-step-into-async.js b/test/inspector/debugger/schedule-step-into-async.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2addb199810f6637771c379bc130e7522fe65739 |
| --- /dev/null |
| +++ b/test/inspector/debugger/schedule-step-into-async.js |
| @@ -0,0 +1,118 @@ |
| +// Copyright 2017 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +InspectorTest.log('Checks Debugger.scheduleStepIntoAsync.'); |
| + |
| +InspectorTest.addScript(` |
| +function testNoScheduledTask() { |
| + debugger; |
| + return 42; |
| +} |
| + |
| +function testSimple() { |
| + debugger; |
| + Promise.resolve().then(v => v * 2); |
| +} |
| + |
| +function testNotResolvedPromise() { |
| + var resolveCallback; |
| + var p = new Promise(resolve => resolveCallback = resolve); |
| + debugger; |
| + p.then(v => v * 2); |
| + resolveCallback(); |
| +} |
| + |
| +function testTwoAsyncTasks() { |
| + debugger; |
| + Promise.resolve().then(v => v * 2); |
| + Promise.resolve().then(v => v * 4); |
| +} |
| + |
| +function testTwoAsyncTasksWithBreak() { |
| + debugger; |
| + Promise.resolve().then(v => v * 2); |
| + debugger; |
| + Promise.resolve().then(v => v * 4); |
| +} |
| +//# sourceURL=test.js`); |
| + |
| +InspectorTest.setupScriptMap(); |
| + |
| +Protocol.Debugger.enable(); |
| +InspectorTest.runAsyncTestSuite([ |
| + async function testScheduleErrors() { |
| + Protocol.Runtime.evaluate({ expression: 'testNoScheduledTask()' }); |
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.stepInto(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.resume(); |
| + }, |
| + |
| + async function testSimple() { |
| + Protocol.Runtime.evaluate({ expression: 'testSimple()' }); |
| + await waitPauseAndDumpLocation(); |
| + 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.
|
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.stepInto(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.resume(); |
| + }, |
| + |
| + async function testNotResolvedPromise() { |
| + Protocol.Runtime.evaluate({ expression: 'testNotResolvedPromise()' }); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.stepOver(); |
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.stepInto(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.resume(); |
| + }, |
| + |
| + async function testTwoAsyncTasks() { |
| + Protocol.Runtime.evaluate({ expression: 'testTwoAsyncTasks()'}); |
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.resume(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.resume(); |
| + }, |
| + |
| + async function testTwoTasksAndGoToSecond() { |
| + Protocol.Runtime.evaluate({ expression: 'testTwoAsyncTasks()'}); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.stepOver(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.stepOver(); |
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.resume(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.resume(); |
| + }, |
| + |
| + async function testTwoAsyncTasksWithBreak() { |
| + Protocol.Runtime.evaluate({ expression: 'testTwoAsyncTasksWithBreak()'}); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.stepOver(); |
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.resume(); |
| + await waitPauseAndDumpLocation(); |
| + Protocol.Debugger.scheduleStepIntoAsync().then(InspectorTest.logMessage); |
| + await Protocol.Debugger.resume(); |
| + await waitPauseAndDumpLocation(); |
| + await Protocol.Debugger.resume(); |
| + } |
| +]); |
| + |
| +async function waitPauseAndDumpLocation() { |
| + var message = await Protocol.Debugger.oncePaused(); |
| + InspectorTest.log('paused at:'); |
| + InspectorTest.logCallFrameSourceLocation(message.params.callFrames[0]); |
| + return message; |
| +} |