Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / inspector / command-line-api-inspect.html
blob38320ea689c1bf9821b2d849635cd99de3955166
1 <html>
2 <head>
3 <script src="inspector-test.js"></script>
4 <script src="console-test.js"></script>
5 <script>
7 function onload()
9 runTest();
12 function test()
14 InspectorTest.addSniffer(WebInspector.Main.prototype, "inspect", sniffInspect, true);
16 function sniffInspect(objectId, hints)
18 InspectorTest.addResult("WebInspector.inspect called with: " + objectId.description);
19 InspectorTest.addResult("WebInspector.inspect's hints are: " + JSON.stringify(Object.keys(hints)));
22 function evalAndDump(expression, next)
24 InspectorTest.addResult("\n");
25 InspectorTest.evaluateInConsole(expression, dumpCallback);
26 function dumpCallback(text)
28 InspectorTest.addResult(expression + " = " + text);
29 if (next)
30 next();
34 InspectorTest.runTestSuite([
35 function testRevealElement(next)
37 InspectorTest.addSniffer(WebInspector.Revealer, "revealPromise", step2, true);
38 evalAndDump("inspect($('#p1'))");
40 function step2(node, revealPromise)
42 if (!(node instanceof WebInspector.RemoteObject))
43 return;
44 revealPromise.then(step3);
47 function step3()
49 InspectorTest.addResult("Selected node id: '" + WebInspector.panels.elements.selectedDOMNode().getAttribute("id") + "'.");
50 next();
53 ]);
56 </script>
57 </head>
59 <body onload="onload()">
60 <p id="p1">
61 Tests that inspect() command line api works.
62 </p>
64 </body>
65 </html>