| OLD | NEW |
| (Empty) |
| 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> | |
| 7 | |
| 8 <script> | |
| 9 | |
| 10 function addErrorToConsole() | |
| 11 { | |
| 12 console.error("test error message"); | |
| 13 } | |
| 14 | |
| 15 function methodForBreakpoint() | |
| 16 { | |
| 17 alert("Hello world"); | |
| 18 } | |
| 19 | |
| 20 function test() | |
| 21 { | |
| 22 WebInspector.ResourcesPanel.show(); | |
| 23 InspectorTest.runDebuggerTestSuite([ | |
| 24 function testSetBreakpoint(next) | |
| 25 { | |
| 26 InspectorTest.showScriptSource("source-frame.html", didShowScriptSou
rce); | |
| 27 | |
| 28 function didShowScriptSource(sourceFrame) | |
| 29 { | |
| 30 InspectorTest.addResult("Script source was shown."); | |
| 31 InspectorTest.addSniffer(WebInspector.JavaScriptSourceFrame.prot
otype, "_addBreakpointDecoration", didAddBreakpoint); | |
| 32 InspectorTest.setBreakpoint(sourceFrame, 14, "", true); | |
| 33 } | |
| 34 | |
| 35 function didAddBreakpoint(lineNumber) | |
| 36 { | |
| 37 InspectorTest.addResult("Breakpoint added to source frame at lin
e " + lineNumber); | |
| 38 next(); | |
| 39 } | |
| 40 }, | |
| 41 | |
| 42 function testConsoleMessage(next) | |
| 43 { | |
| 44 InspectorTest.showScriptSource("source-frame.html", didShowScriptSou
rce); | |
| 45 | |
| 46 var shownSourceFrame; | |
| 47 function didShowScriptSource(sourceFrame) | |
| 48 { | |
| 49 InspectorTest.addResult("Script source was shown."); | |
| 50 shownSourceFrame = sourceFrame; | |
| 51 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "ad
dMessageToSource", didAddMessage); | |
| 52 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "cl
earMessages", clearMessages); | |
| 53 InspectorTest.evaluateInPage("addErrorToConsole()"); | |
| 54 } | |
| 55 | |
| 56 function didAddMessage(message) | |
| 57 { | |
| 58 if (this !== shownSourceFrame) | |
| 59 return; | |
| 60 InspectorTest.addResult("Message added to source frame: " + mess
age.messageText()); | |
| 61 InspectorTest.consoleModel.requestClearMessages(); | |
| 62 } | |
| 63 | |
| 64 function clearMessages() | |
| 65 { | |
| 66 if (this !== shownSourceFrame) | |
| 67 return; | |
| 68 InspectorTest.addResult("Messages cleared in source frame."); | |
| 69 next(); | |
| 70 } | |
| 71 }, | |
| 72 | |
| 73 function testShowResource(next) | |
| 74 { | |
| 75 WebInspector.NetworkPanel.show(); | |
| 76 | |
| 77 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "show",
didShowSourceFrame); | |
| 78 | |
| 79 InspectorTest.resourceTreeModel.forAllResources(visit); | |
| 80 function visit(resource) | |
| 81 { | |
| 82 if (resource.url.indexOf("debugger-test.js") !== -1) { | |
| 83 WebInspector.panels.resources.showResource(resource, 1); | |
| 84 return true; | |
| 85 } | |
| 86 } | |
| 87 | |
| 88 function didShowSourceFrame() | |
| 89 { | |
| 90 next(); | |
| 91 } | |
| 92 } | |
| 93 ]); | |
| 94 }; | |
| 95 | |
| 96 </script> | |
| 97 | |
| 98 </head> | |
| 99 | |
| 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> | |
| 104 | |
| 105 </body> | |
| 106 </html> | |
| OLD | NEW |