| <!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) { |
| 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.Breakpoint(location); |
| breakpoint.autoContinue = true; |
| |
| function addLogAction(data) { |
| breakpoint.createAction(WI.BreakpointAction.Type.Log, breakpoint.actions.lastValue, 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); |
| |
| InspectorTest.evaluateInPage("runBreakpointActions()", resolve); |
| }); |
| |
| InspectorTest.reloadPage(); |
| } |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Testing that "Log" breakpoint actions work correctly.</p> |
| </body> |
| </html> |