Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / source-frame.html
blob7e1171feef6647124057ec8741d32942ff362353
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../../../http/tests/inspector/network-test.js"></script>
6 <script src="../../../http/tests/inspector/resources-test.js"></script>
8 <script>
10 function addErrorToConsole()
12 console.error("test error message");
15 function methodForBreakpoint()
17 alert("Hello world");
20 function test()
22 WebInspector.ResourcesPanel.show();
23 InspectorTest.runDebuggerTestSuite([
24 function testSetBreakpoint(next)
26 InspectorTest.showScriptSource("source-frame.html", didShowScriptSource);
28 function didShowScriptSource(sourceFrame)
30 InspectorTest.addResult("Script source was shown.");
31 InspectorTest.addSniffer(WebInspector.JavaScriptSourceFrame.prototype, "_addBreakpointDecoration", didAddBreakpoint);
32 InspectorTest.setBreakpoint(sourceFrame, 14, "", true);
35 function didAddBreakpoint(lineNumber)
37 InspectorTest.addResult("Breakpoint added to source frame at line " + lineNumber);
38 next();
42 function testConsoleMessage(next)
44 InspectorTest.showScriptSource("source-frame.html", didShowScriptSource);
46 var shownSourceFrame;
47 function didShowScriptSource(sourceFrame)
49 InspectorTest.addResult("Script source was shown.");
50 shownSourceFrame = sourceFrame;
51 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "addMessageToSource", didAddMessage);
52 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "clearMessages", clearMessages);
53 InspectorTest.evaluateInPage("addErrorToConsole()");
56 function didAddMessage(message)
58 if (this !== shownSourceFrame)
59 return;
60 InspectorTest.addResult("Message added to source frame: " + message.messageText());
61 InspectorTest.consoleModel.requestClearMessages();
64 function clearMessages()
66 if (this !== shownSourceFrame)
67 return;
68 InspectorTest.addResult("Messages cleared in source frame.");
69 next();
73 function testShowResource(next)
75 WebInspector.NetworkPanel.show();
77 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "show", didShowSourceFrame);
79 InspectorTest.resourceTreeModel.forAllResources(visit);
80 function visit(resource)
82 if (resource.url.indexOf("debugger-test.js") !== -1) {
83 WebInspector.panels.resources.showResource(resource, 1);
84 return true;
88 function didShowSourceFrame()
90 next();
93 ]);
96 </script>
98 </head>
100 <body onload="runTest()">
101 <p>Tests that it's possible to set breakpoint in source frame, and that
102 source frame displays breakpoints and console errors.
103 </p>
105 </body>
106 </html>