Commit b6bbf682 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] added test for StepOut at return postion from async function

Should be fixed.

BUG=v8:6161
R=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2779143002
Cr-Commit-Position: refs/heads/master@{#44209}
parent 76e3fe97
StepOut from return position of async function.
Running test: testStepInto
p.then(() => 1);
#debugger;
return p;
debugger;
#return p;
}
return p;
#}
await foo();
await p;
p.then(() => #1);
debugger;
Running test: testStepOver
p.then(() => 1);
#debugger;
return p;
debugger;
#return p;
}
return p;
#}
await foo();
await p;
p.then(() => #1);
debugger;
await p;
p.then(() => 1#);
debugger;
await foo();
#}
Running test: testStepOut
p.then(() => 1);
#debugger;
return p;
debugger;
#return p;
}
return p;
#}
await foo();
await p;
p.then(() => #1);
debugger;
await foo();
#}
// 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.
// TODO(kozyatinskiy): on StepOut and probably StepNext at return position
// of async generator we should break at next instruction of resumed generator
// instead of next scheduled microtask.
InspectorTest.log('StepOut from return position of async function.');
InspectorTest.addScript(`
async function testFunction() {
async function foo() {
var p = Promise.resolve();
await p;
p.then(() => 1);
debugger;
return p;
}
await foo();
}
`);
InspectorTest.setupScriptMap();
Protocol.Debugger.enable();
InspectorTest.runAsyncTestSuite([
async function testStepInto() {
Protocol.Runtime.evaluate({expression: 'testFunction()'});
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.resume();
},
async function testStepOver() {
Protocol.Runtime.evaluate({expression: 'testFunction()'});
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOver();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOver();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOver();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.resume();
},
async function testStepOut() {
Protocol.Runtime.evaluate({expression: 'testFunction()'});
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepInto();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOut();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.stepOut();
await logPauseLocation(await Protocol.Debugger.oncePaused());
Protocol.Debugger.resume();
},
]);
function logPauseLocation(message) {
return InspectorTest.logSourceLocation(message.params.callFrames[0].location);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment