| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script src="../../http/tests/inspector/network-test.js"></script> | 5 <script src="../../http/tests/inspector/network-test.js"></script> |
| 6 <script src="../../http/tests/inspector/sources-test.js"></script> | 6 <script src="../../http/tests/inspector/sources-test.js"></script> |
| 7 <script src="../../http/tests/inspector/resources-test.js"></script> | 7 <script src="../../http/tests/inspector/resources-test.js"></script> |
| 8 <script src="../../http/tests/inspector/extensions-test.js"></script> | 8 <script src="../../http/tests/inspector/extensions-test.js"></script> |
| 9 <script type="text/javascript"> | 9 <script type="text/javascript"> |
| 10 function logMessage() | 10 function logMessage() |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 InspectorTest.addResult("status bar item " + i + ", icon: " + url +
", tooltip: '" + item.title + "', disabled: " + item.disabled); | 41 InspectorTest.addResult("status bar item " + i + ", icon: " + url +
", tooltip: '" + item.title + "', disabled: " + item.disabled); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 InspectorTest.clickButton = function(index) | 45 InspectorTest.clickButton = function(index) |
| 46 { | 46 { |
| 47 var panel = WebInspector.inspectorView.currentPanel(); | 47 var panel = WebInspector.inspectorView.currentPanel(); |
| 48 panel._panelToolbar._contentElement.children[index].click(); | 48 panel._panelToolbar._contentElement.children[index].click(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 InspectorTest.clickOnURL = function() | 51 InspectorTest.logMessageAndClickOnURL = function() |
| 52 { | 52 { |
| 53 InspectorTest.disableConsoleViewport(); | 53 InspectorTest.disableConsoleViewport(); |
| 54 var xpathResult = document.evaluate("//a[starts-with(., 'extensions-pane
l.html')]", WebInspector.ConsolePanel._view()._viewport.element, null, XPathResu
lt.ANY_UNORDERED_NODE_TYPE, null); | 54 InspectorTest.evaluateInPage("logMessage()"); |
| 55 var click = document.createEvent("MouseEvent"); | 55 var wrappedConsoleMessageAdded = InspectorTest.safeWrap(consoleMessageAd
ded); |
| 56 click.initMouseEvent("click", true, true); | 56 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.Conso
leModel.Events.MessageAdded, wrappedConsoleMessageAdded); |
| 57 xpathResult.singleNodeValue.dispatchEvent(click); | 57 |
| 58 function consoleMessageAdded() |
| 59 { |
| 60 WebInspector.multitargetConsoleModel.removeEventListener(WebInspecto
r.ConsoleModel.Events.MessageAdded, wrappedConsoleMessageAdded); |
| 61 InspectorTest.runAfterPendingDispatches(clickOnMessage) |
| 62 } |
| 63 |
| 64 function clickOnMessage() |
| 65 { |
| 66 var xpathResult = document.evaluate("//a[starts-with(., 'extensions-
panel.html')]", WebInspector.ConsolePanel._view()._viewport.element, null, XPath
Result.ANY_UNORDERED_NODE_TYPE, null); |
| 67 |
| 68 var click = document.createEvent("MouseEvent"); |
| 69 click.initMouseEvent("click", true, true); |
| 70 xpathResult.singleNodeValue.dispatchEvent(click); |
| 71 } |
| 58 } | 72 } |
| 59 | 73 |
| 60 InspectorTest.installShowResourceLocationHooks = function() | 74 InspectorTest.installShowResourceLocationHooks = function() |
| 61 { | 75 { |
| 62 function showURL(panelName, url, lineNumber) | 76 function showURL(panelName, url, lineNumber) |
| 63 { | 77 { |
| 64 var url = url.replace(/^.*(([/][^/]*){3}[^/)]*)$/, "...$1"); | 78 var url = url.replace(/^.*(([/][^/]*){3}[^/)]*)$/, "...$1"); |
| 65 InspectorTest.addResult("Showing resource " + url + " in panel " + p
anelName + " (" + WebInspector.inspectorView.currentPanel().name + "), line: " +
lineNumber); | 79 InspectorTest.addResult("Showing resource " + url + " in panel " + p
anelName + " (" + WebInspector.inspectorView.currentPanel().name + "), line: " +
lineNumber); |
| 66 } | 80 } |
| 67 InspectorTest.recordNetwork(); | 81 InspectorTest.recordNetwork(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 panel.show(); | 170 panel.show(); |
| 157 extension_showPanel("console"); | 171 extension_showPanel("console"); |
| 158 | 172 |
| 159 function handleOpenResource(resource, lineNumber) | 173 function handleOpenResource(resource, lineNumber) |
| 160 { | 174 { |
| 161 // This will force extension iframe to be really loaded. | 175 // This will force extension iframe to be really loaded. |
| 162 panel.show(); | 176 panel.show(); |
| 163 } | 177 } |
| 164 webInspector.panels.setOpenResourceHandler(handleOpenResource); | 178 webInspector.panels.setOpenResourceHandler(handleOpenResource); |
| 165 evaluateOnFrontend("WebInspector.openAnchorLocationRegistry._activeHandl
er = 'test extension'"); | 179 evaluateOnFrontend("WebInspector.openAnchorLocationRegistry._activeHandl
er = 'test extension'"); |
| 166 webInspector.inspectedWindow.eval("logMessage()", function() { | 180 evaluateOnFrontend("InspectorTest.logMessageAndClickOnURL();"); |
| 167 expectOnShown = true; | 181 expectOnShown = true; |
| 168 evaluateOnFrontend("InspectorTest.clickOnURL();"); | |
| 169 }); | |
| 170 } | 182 } |
| 171 var basePath = location.pathname.replace(/\/[^/]*$/, "/"); | 183 var basePath = location.pathname.replace(/\/[^/]*$/, "/"); |
| 172 webInspector.panels.create("Test Panel", basePath + "extension-panel.png", b
asePath + "extension-panel.html", onPanelCreated); | 184 webInspector.panels.create("Test Panel", basePath + "extension-panel.png", b
asePath + "extension-panel.html", onPanelCreated); |
| 173 } | 185 } |
| 174 | 186 |
| 175 function extension_testSearch(nextTest) | 187 function extension_testSearch(nextTest) |
| 176 { | 188 { |
| 177 var callbackCount = 0; | 189 var callbackCount = 0; |
| 178 | 190 |
| 179 function onPanelCreated(panel) | 191 function onPanelCreated(panel) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 var img = document.createElement("img"); | 329 var img = document.createElement("img"); |
| 318 img.src = "resources/abe.png"; | 330 img.src = "resources/abe.png"; |
| 319 document.body.appendChild(img); | 331 document.body.appendChild(img); |
| 320 } | 332 } |
| 321 </script> | 333 </script> |
| 322 </head> | 334 </head> |
| 323 <body onload="runTest()"> | 335 <body onload="runTest()"> |
| 324 <p>Tests WebInspector extension API</p> | 336 <p>Tests WebInspector extension API</p> |
| 325 </body> | 337 </body> |
| 326 </html> | 338 </html> |
| OLD | NEW |