Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / extensions / extensions-audits-content-script.html
blob0a5c42e3a2c96a6a7daaa0608cee58b7e2e5ff9e
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/extensions-test.js"></script>
5 <script src="../audits/audits-test.js"></script>
6 <script src="extensions-audits-tests.js"></script>
8 <script type="text/javascript">
10 window.whereAmI = "main world";
12 testRunner.setIsolatedWorldSecurityOrigin(632, "file:///");
13 testRunner.evaluateScriptInIsolatedWorld(632, "window.whereAmI = 'brave new world'");
15 function extension_testAudits(nextTest)
17 var pendingOutput = [];
19 function onStartAuditCategory(results)
21 pendingOutput.push("category.onAuditStarted fired");
22 var node = results.createResult("Test Formatters");
23 node.addChild(results.createObject("({whereAmI: window.whereAmI})", "main world object"));
24 node.addChild(results.createNode("document.getElementById('test-element')"));
26 node.addChild(results.createObject("({whereAmI: window.whereAmI})", "content script object", { useContentScriptContext: true }));
27 node.addChild(results.createNode("document.getElementById('test-element')", { useContentScriptContext: true }));
29 results.addResult("Rule with details subtree (1)", "", results.Severity.Warning, node);
30 results.done();
32 var category = webInspector.audits.addCategory("Extension audits", 20);
33 category.onAuditStarted.addListener(onStartAuditCategory);
35 function auditsDone()
37 pendingOutput.sort().forEach(output);
38 nextTest();
40 webInspector.inspectedWindow.eval("", function() {
41 extension_runAudits(auditsDone);
42 });
45 </script>
46 </head>
47 <body onload="runTest()">
48 <p>Tests audit formatters performing evals on content scripts in WebInspector Extensions API</p>
49 <span id="test-element"><b></b></span>
50 </body>
51 </html>