Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / command-line-api-inspect.html
1 <html>
2 <head>
3 <script src="inspector-test.js"></script>
4 <script src="console-test.js"></script>
5 <script>
6
7 function onload()
8 {
9     runTest();
10 }
11
12 function test()
13 {
14     InspectorTest.addSniffer(WebInspector, "inspect", sniffInspect, true);
15
16     function sniffInspect(objectId, hints)
17     {
18         InspectorTest.addResult("WebInspector.inspect called with: " + objectId.description);
19         InspectorTest.addResult("WebInspector.inspect's hints are: " + JSON.stringify(Object.keys(hints)));
20     }
21
22     function evalAndDump(expression, next)
23     {
24         InspectorTest.addResult("\n");
25         InspectorTest.evaluateInConsole(expression, dumpCallback);
26         function dumpCallback(text)
27         {
28             text = text.replace(/Test of session.*/, "Test of session storage...");
29             InspectorTest.addResult(expression + " = " + text);
30             if (next)
31                 next();
32         }
33     }
34
35     InspectorTest.runTestSuite([
36         function testRevealElement(next)
37         {
38             InspectorTest.addSniffer(WebInspector, "_updateFocusedNode", step2);
39             evalAndDump("inspect($('#p1'))");
40
41             function step2()
42             {
43                 InspectorTest.addResult("Selected node id: '" + WebInspector.panels.elements.selectedDOMNode().getAttribute("id") + "'.");
44                 next();
45             }
46         }
47     ]);
48 }
49
50 </script>
51 </head>
52
53 <body onload="onload()">
54 <p id="p1">
55 Tests that inspect() command line api works.
56 </p>
57
58 </body>
59 </html>