2010-08-12 Pavel Feldman <pfeldman@chromium.org>
[WebKit-https.git] / LayoutTests / inspector / console-dir-global.html
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script src="../http/tests/inspector/console-tests.js"></script>
5 <script>
6
7 function doit()
8 {
9     console.dir(window);
10
11     function callback(result)
12     {
13         dumpObject(result);
14         notifyDone();
15     }
16
17     evaluateInWebInspector("frontend_expandAndDumpConsoleMessages", callback);
18 }
19
20 function frontend_expandAndDumpConsoleMessages(testController)
21 {
22     // Need test to be async to expand console objects.
23     testController.waitUntilDone();
24
25     InjectedScriptAccess.getDefault().evaluate("window", "console", evalCallback);
26
27     function evalCallback(result)
28     {
29         if (result.type === "error")
30             testController.notifyDone("Exception:" + result);
31         var objectProxy = WebInspector.RemoteObject.fromPayload(result);
32         objectProxy.getProperties(false, true, getPropertiesCallback);
33     }
34
35     function getPropertiesCallback(properties)
36     {
37         properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
38         var result = {};
39         var golden = { "window": 1, "document": 1, "eval": 1, "console": 1, "frames": 1, "Array": 1, "doit": 1 }; 
40         for (var i = 0; i < properties.length; ++i) {
41             var name = properties[i].name;
42             if (golden[name])
43                 result[name] = 1;
44         }
45         testController.notifyDone(result);
46     }
47 }
48
49 </script>
50 </head>
51
52 <body onload="onload()">
53 <p>
54 Tests that console dumps global object with properties.
55 </p>
56
57 </body>
58 </html>