| OLD | NEW |
| 1 function extensionFunctions() | 1 function extensionFunctions() |
| 2 { | 2 { |
| 3 var functions = ""; | 3 var functions = ""; |
| 4 | 4 |
| 5 for (symbol in window) { | 5 for (symbol in window) { |
| 6 if (/^extension_/.exec(symbol) && typeof window[symbol] === "function") | 6 if (/^extension_/.exec(symbol) && typeof window[symbol] === "function") |
| 7 functions += window[symbol].toString(); | 7 functions += window[symbol].toString(); |
| 8 } | 8 } |
| 9 return functions; | 9 return functions; |
| 10 } | 10 } |
| 11 | 11 |
| 12 var initialize_ExtensionsTest = function() | 12 var initialize_ExtensionsTest = function() |
| 13 { | 13 { |
| 14 WebInspector.extensionServer._registerHandler("evaluateForTestInFrontEnd", onEva
luate); | 14 Extensions.extensionServer._registerHandler("evaluateForTestInFrontEnd", onEvalu
ate); |
| 15 | 15 |
| 16 WebInspector.extensionServer._extensionAPITestHook = function(extensionServerCli
ent, coreAPI) | 16 Extensions.extensionServer._extensionAPITestHook = function(extensionServerClien
t, coreAPI) |
| 17 { | 17 { |
| 18 window.webInspector = coreAPI; | 18 window.webInspector = coreAPI; |
| 19 window._extensionServerForTests = extensionServerClient; | 19 window._extensionServerForTests = extensionServerClient; |
| 20 coreAPI.panels.themeName = "themeNameForTest"; | 20 coreAPI.panels.themeName = "themeNameForTest"; |
| 21 } | 21 } |
| 22 | 22 |
| 23 InspectorTest._replyToExtension = function(requestId, port) | 23 InspectorTest._replyToExtension = function(requestId, port) |
| 24 { | 24 { |
| 25 WebInspector.extensionServer._dispatchCallback(requestId, port); | 25 Extensions.extensionServer._dispatchCallback(requestId, port); |
| 26 } | 26 } |
| 27 | 27 |
| 28 function onEvaluate(message, port) | 28 function onEvaluate(message, port) |
| 29 { | 29 { |
| 30 function reply(param) | 30 function reply(param) |
| 31 { | 31 { |
| 32 WebInspector.extensionServer._dispatchCallback(message.requestId, port,
param); | 32 Extensions.extensionServer._dispatchCallback(message.requestId, port, pa
ram); |
| 33 } | 33 } |
| 34 | 34 |
| 35 try { | 35 try { |
| 36 eval(message.expression); | 36 eval(message.expression); |
| 37 } catch (e) { | 37 } catch (e) { |
| 38 InspectorTest.addResult("Exception while running: " + message.expression
+ "\n" + (e.stack || e)); | 38 InspectorTest.addResult("Exception while running: " + message.expression
+ "\n" + (e.stack || e)); |
| 39 InspectorTest.completeTest(); | 39 InspectorTest.completeTest(); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 InspectorTest.showPanel = function(panelId) | 43 InspectorTest.showPanel = function(panelId) |
| 44 { | 44 { |
| 45 if (panelId === "extension") | 45 if (panelId === "extension") |
| 46 panelId = WebInspector.inspectorView._tabbedPane._tabs[WebInspector.insp
ectorView._tabbedPane._tabs.length - 1].id; | 46 panelId = UI.inspectorView._tabbedPane._tabs[UI.inspectorView._tabbedPan
e._tabs.length - 1].id; |
| 47 return WebInspector.inspectorView.showPanel(panelId); | 47 return UI.inspectorView.showPanel(panelId); |
| 48 } | 48 } |
| 49 | 49 |
| 50 InspectorTest.runExtensionTests = function() | 50 InspectorTest.runExtensionTests = function() |
| 51 { | 51 { |
| 52 InspectorTest.RuntimeAgent.evaluate("location.href", "console", false, funct
ion(error, result) { | 52 InspectorTest.RuntimeAgent.evaluate("location.href", "console", false, funct
ion(error, result) { |
| 53 if (error) | 53 if (error) |
| 54 return; | 54 return; |
| 55 var pageURL = result.value; | 55 var pageURL = result.value; |
| 56 var extensionURL = (/^https?:/.test(pageURL) ? | 56 var extensionURL = (/^https?:/.test(pageURL) ? |
| 57 pageURL.replace(/^(https?:\/\/[^/]*\/).*$/,"$1") : | 57 pageURL.replace(/^(https?:\/\/[^/]*\/).*$/,"$1") : |
| 58 pageURL.replace(/\/inspector\/extensions\/[^/]*$/, "/http/tests")) + | 58 pageURL.replace(/\/inspector\/extensions\/[^/]*$/, "/http/tests")) + |
| 59 "/inspector/resources/extension-main.html"; | 59 "/inspector/resources/extension-main.html"; |
| 60 InspectorFrontendAPI.addExtensions([{ startPage: extensionURL, name: "te
st extension", exposeWebInspectorNamespace: true }]); | 60 InspectorFrontendAPI.addExtensions([{ startPage: extensionURL, name: "te
st extension", exposeWebInspectorNamespace: true }]); |
| 61 WebInspector.extensionServer.initializeExtensions(); | 61 Extensions.extensionServer.initializeExtensions(); |
| 62 }); | 62 }); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } | 65 } |
| 66 | 66 |
| 67 function extension_showPanel(panelId, callback) | 67 function extension_showPanel(panelId, callback) |
| 68 { | 68 { |
| 69 evaluateOnFrontend("InspectorTest.showPanel(unescape('" + escape(panelId) +
"')).then(function() { reply(); });", callback); | 69 evaluateOnFrontend("InspectorTest.showPanel(unescape('" + escape(panelId) +
"')).then(function() { reply(); });", callback); |
| 70 } | 70 } |
| 71 | 71 |
| 72 var test = function() | 72 var test = function() |
| 73 { | 73 { |
| 74 WebInspector.moduleSetting("shortcutPanelSwitch").set(true); | 74 Common.moduleSetting("shortcutPanelSwitch").set(true); |
| 75 InspectorTest.runExtensionTests(); | 75 InspectorTest.runExtensionTests(); |
| 76 } | 76 } |
| OLD | NEW |