1 function extensionFunctions()
5 for (symbol
in window
) {
6 if (/^extension_/.exec(symbol
) && typeof window
[symbol
] === "function")
7 functions
+= window
[symbol
].toString();
12 var initialize_ExtensionsTest = function()
15 WebInspector
.extensionServer
._overridePlatformExtensionAPIForTest = function(extensionInfo
, inspectedTabId
)
17 WebInspector
.extensionServer
._registerHandler("evaluateForTestInFrontEnd", onEvaluate
);
19 function platformExtensionAPI(coreAPI
)
21 window
.webInspector
= coreAPI
;
22 window
._extensionServerForTests
= extensionServer
;
24 return platformExtensionAPI
.toString();
27 InspectorTest
._replyToExtension = function(requestId
, port
)
29 WebInspector
.extensionServer
._dispatchCallback(requestId
, port
);
32 function onEvaluate(message
, port
)
36 WebInspector
.extensionServer
._dispatchCallback(message
.requestId
, port
, param
);
40 eval(message
.expression
);
42 InspectorTest
.addResult("Exception while running: " + message
.expression
+ "\n" + (e
.stack
|| e
));
43 InspectorTest
.completeTest();
47 InspectorTest
.showPanel = function(panelId
)
49 if (panelId
=== "extension")
50 panelId
= WebInspector
.inspectorView
._tabbedPane
._tabs
[WebInspector
.inspectorView
._tabbedPane
._tabs
.length
- 1].id
;
51 return WebInspector
.inspectorView
.showPanel(panelId
);
54 InspectorTest
.runExtensionTests = function()
56 InspectorTest
.RuntimeAgent
.evaluate("location.href", "console", false, function(error
, result
) {
59 var pageURL
= result
.value
;
60 var extensionURL
= (/^https?:/.test(pageURL
) ?
61 pageURL
.replace(/^(https?:\/\/[^/]*\/).*$/,"$1") :
62 pageURL
.replace(/\/inspector\/extensions\/[^/]*$/, "/http
/tests
")) +
63 "/inspector/resources
/extension
-main
.html
";
64 InspectorFrontendAPI.addExtensions([{ startPage: extensionURL, name: "test extension
", exposeWebInspectorNamespace: true }]);
65 WebInspector.extensionServer.initializeExtensions();
71 function extension_showPanel(panelId, callback)
73 evaluateOnFrontend("InspectorTest
.showPanel(unescape('" + escape(panelId) + "')).then(function() { reply(); });", callback);
78 InspectorTest.runExtensionTests();