| 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/extensions-test.js"></script> | 5 <script src="../../http/tests/inspector/extensions-test.js"></script> |
| 6 <script src="../../http/tests/inspector/debugger-test.js"></script> | 6 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
| 8 function loadFrame() | 8 function loadFrame() |
| 9 { | 9 { |
| 10 var callback; | 10 var callback; |
| 11 var promise = new Promise((fulfill) => callback = fulfill); | 11 var promise = new Promise((fulfill) => callback = fulfill); |
| 12 var iframe = document.createElement("iframe"); | 12 var iframe = document.createElement("iframe"); |
| 13 iframe.src = "resources/subframe.html"; | 13 iframe.src = "resources/subframe.html"; |
| 14 iframe.addEventListener("load", callback); | 14 iframe.addEventListener("load", callback); |
| 15 document.body.appendChild(iframe); | 15 document.body.appendChild(iframe); |
| 16 return promise; | 16 return promise; |
| 17 } | 17 } |
| 18 | 18 |
| 19 function logMessage() | 19 function logMessage() |
| 20 { | 20 { |
| 21 frames[0].logMessage(); | 21 frames[0].logMessage(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 function initialize_ExtensionResourceTests() | 24 function initialize_ExtensionResourceTests() |
| 25 { | 25 { |
| 26 | 26 |
| 27 InspectorTest.clickOnURL = function() | 27 InspectorTest.clickOnURL = function() |
| 28 { | 28 { |
| 29 WebInspector.viewManager.showView("console").then(() => { | 29 UI.viewManager.showView("console").then(() => { |
| 30 WebInspector.ConsoleView.instance()._updateMessageList(); | 30 Console.ConsoleView.instance()._updateMessageList(); |
| 31 var xpathResult = document.evaluate("//a[starts-with(., 'test-script.js'
)]", | 31 var xpathResult = document.evaluate("//a[starts-with(., 'test-script.js'
)]", |
| 32 WebInspector.ConsoleView.instance().
element, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null); | 32 Console.ConsoleView.instance().eleme
nt, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null); |
| 33 | 33 |
| 34 var click = document.createEvent("MouseEvent"); | 34 var click = document.createEvent("MouseEvent"); |
| 35 click.initMouseEvent("click", true, true); | 35 click.initMouseEvent("click", true, true); |
| 36 xpathResult.singleNodeValue.dispatchEvent(click); | 36 xpathResult.singleNodeValue.dispatchEvent(click); |
| 37 }); | 37 }); |
| 38 } | 38 } |
| 39 | 39 |
| 40 InspectorTest.waitForStyleSheetChangedEvent = function(reply) | 40 InspectorTest.waitForStyleSheetChangedEvent = function(reply) |
| 41 { | 41 { |
| 42 var originalSetTimeout = WebInspector.Throttler.prototype._setTimeout; | 42 var originalSetTimeout = Common.Throttler.prototype._setTimeout; |
| 43 WebInspector.Throttler.prototype._setTimeout = innerSetTimeout; | 43 Common.Throttler.prototype._setTimeout = innerSetTimeout; |
| 44 InspectorTest.addSniffer(WebInspector.CSSModel.prototype, "_fireStyleSheetCh
anged", onStyleSheetChanged); | 44 InspectorTest.addSniffer(SDK.CSSModel.prototype, "_fireStyleSheetChanged", o
nStyleSheetChanged); |
| 45 | 45 |
| 46 function onStyleSheetChanged() | 46 function onStyleSheetChanged() |
| 47 { | 47 { |
| 48 WebInspector.Throttler.prototype._setTimeout = originalSetTimeout; | 48 Common.Throttler.prototype._setTimeout = originalSetTimeout; |
| 49 reply(); | 49 reply(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 function innerSetTimeout(operation, timeout) | 52 function innerSetTimeout(operation, timeout) |
| 53 { | 53 { |
| 54 return originalSetTimeout.call(this, operation, 0); | 54 return originalSetTimeout.call(this, operation, 0); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 } | 58 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 function handleOpenResource(resource, lineNumber) | 189 function handleOpenResource(resource, lineNumber) |
| 190 { | 190 { |
| 191 output("handleOpenResource() invoked [this should only appear once!]: ")
; | 191 output("handleOpenResource() invoked [this should only appear once!]: ")
; |
| 192 dumpObject(Array.prototype.slice.call(arguments), { url: "url" }); | 192 dumpObject(Array.prototype.slice.call(arguments), { url: "url" }); |
| 193 webInspector.panels.setOpenResourceHandler(null); | 193 webInspector.panels.setOpenResourceHandler(null); |
| 194 evaluateOnFrontend("InspectorTest.clickOnURL(); reply()", nextTest); | 194 evaluateOnFrontend("InspectorTest.clickOnURL(); reply()", nextTest); |
| 195 } | 195 } |
| 196 webInspector.panels.setOpenResourceHandler(handleOpenResource); | 196 webInspector.panels.setOpenResourceHandler(handleOpenResource); |
| 197 webInspector.inspectedWindow.eval("logMessage()", function() { | 197 webInspector.inspectedWindow.eval("logMessage()", function() { |
| 198 evaluateOnFrontend("InspectorTest.clickOnURL();"); | 198 evaluateOnFrontend("InspectorTest.clickOnURL();"); |
| 199 evaluateOnFrontend("WebInspector.openAnchorLocationRegistry.activeHandle
r = 'test extension'; InspectorTest.clickOnURL();"); | 199 evaluateOnFrontend("Components.openAnchorLocationRegistry.activeHandler
= 'test extension'; InspectorTest.clickOnURL();"); |
| 200 }); | 200 }); |
| 201 } | 201 } |
| 202 | 202 |
| 203 function addResource() | 203 function addResource() |
| 204 { | 204 { |
| 205 var script = document.createElement("script"); | 205 var script = document.createElement("script"); |
| 206 script.src = "data:application/javascript," + escape("function test_func(){}
;"); | 206 script.src = "data:application/javascript," + escape("function test_func(){}
;"); |
| 207 document.head.appendChild(script); | 207 document.head.appendChild(script); |
| 208 } | 208 } |
| 209 | 209 |
| 210 </script> | 210 </script> |
| 211 </head> | 211 </head> |
| 212 <body onload="runTest()"> | 212 <body onload="runTest()"> |
| 213 <p>Tests resource-related methods of WebInspector extension API</p> | 213 <p>Tests resource-related methods of WebInspector extension API</p> |
| 214 </body> | 214 </body> |
| 215 </html> | 215 </html> |
| OLD | NEW |