70 lines
2.4 KiB
HTML
70 lines
2.4 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
|
|
<script src="resources/script-for-breakpoint-actions.js"></script>
|
|
<script>
|
|
function runBreakpointActions()
|
|
{
|
|
breakpointActions(42, {x:1, y:2});
|
|
}
|
|
|
|
function test()
|
|
{
|
|
let suite = InspectorTest.createAsyncSuite("Debugger.BreakpointAction.Log");
|
|
|
|
suite.addTestCase({
|
|
name: "TemplateLiteralPlaceholders",
|
|
description: "Evaluate breakpoint with logging actions that include placeholders.",
|
|
test(resolve, reject) {
|
|
let breakpointPromise = new WI.WrappedPromise;
|
|
WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, (event) => {
|
|
let scriptObject = event.data.script;
|
|
if (!/script\-for\-breakpoint\-actions\.js$/.test(scriptObject.url))
|
|
return;
|
|
|
|
let location = scriptObject.createSourceCodeLocation(4, 0);
|
|
let breakpoint = new WI.JavaScriptBreakpoint(location);
|
|
breakpoint.autoContinue = true;
|
|
|
|
function addLogAction(data) {
|
|
breakpoint.addAction(new WI.BreakpointAction(WI.BreakpointAction.Type.Log, {data}));
|
|
}
|
|
|
|
addLogAction("`${a}`");
|
|
addLogAction("'${a}'");
|
|
addLogAction("${'ab' + 'c'}");
|
|
addLogAction("${\"{abc}\"}");
|
|
addLogAction("${'{abc}'}");
|
|
addLogAction("${`{abc}`}");
|
|
addLogAction("${`ab${'c'}`}");
|
|
addLogAction("${({a: 137}).a}");
|
|
addLogAction("close curly brace in RegExp: ${/\\}/.test('}')}");
|
|
addLogAction("${a} and ${JSON.stringify(b)}");
|
|
|
|
WI.debuggerManager.addBreakpoint(breakpoint);
|
|
breakpointPromise.resolve();
|
|
});
|
|
|
|
let reloadPromise = InspectorTest.awaitEvent(FrontendTestHarness.Event.TestPageDidLoad);
|
|
InspectorTest.reloadPage();
|
|
Promise.all([
|
|
reloadPromise,
|
|
breakpointPromise.promise
|
|
])
|
|
.then(() => {
|
|
return InspectorTest.evaluateInPage("runBreakpointActions()");
|
|
})
|
|
.then(resolve);;
|
|
}
|
|
});
|
|
|
|
suite.runTestCasesAndFinish();
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<p>Testing that "Log" breakpoint actions work correctly.</p>
|
|
</body>
|
|
</html>
|