3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
8 function addErrorToConsole()
10 console.error("test error message");
13 function methodForBreakpoint()
20 WebInspector.showPanel("resources");
21 InspectorTest.runDebuggerTestSuite([
22 function testSetBreakpoint(next)
24 InspectorTest.showScriptSource("source-frame.html", didShowScriptSource);
26 function didShowScriptSource(sourceFrame)
28 InspectorTest.addResult("Script source was shown.");
29 InspectorTest.addSniffer(WebInspector.JavaScriptSourceFrame.prototype, "_addBreakpointDecoration", didAddBreakpoint);
30 InspectorTest.setBreakpoint(sourceFrame, 14, "", true);
33 function didAddBreakpoint(lineNumber)
35 InspectorTest.addResult("Breakpoint added to source frame at line " + lineNumber);
40 function testConsoleMessage(next)
42 InspectorTest.showScriptSource("source-frame.html", didShowScriptSource);
45 function didShowScriptSource(sourceFrame)
47 InspectorTest.addResult("Script source was shown.");
48 shownSourceFrame = sourceFrame;
49 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "addMessageToSource", didAddMessage);
50 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "clearMessages", clearMessages);
51 InspectorTest.evaluateInPage("addErrorToConsole()");
54 function didAddMessage(lineNumber, message)
56 if (this !== shownSourceFrame)
58 InspectorTest.addResult("Message added to source frame: " + message.message);
59 WebInspector.console.requestClearMessages();
62 function clearMessages()
64 if (this !== shownSourceFrame)
66 InspectorTest.addResult("Messages cleared in source frame.");
71 function testShowResource(next)
73 WebInspector.showPanel("network");
75 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "show", didShowSourceFrame);
77 WebInspector.resourceTreeModel.forAllResources(visit);
78 function visit(resource)
80 if (resource.url.indexOf("debugger-test.js") !== -1) {
81 WebInspector.panels.resources.showResource(resource, 1);
86 function didShowSourceFrame()
98 <body onload="runTest()">
99 <p>Tests that it's possible to set breakpoint in source frame, and that
100 source frame displays breakpoints and console errors.