Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / console / console-format-es6.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script>
6
7 var globals = [];
8
9 function log(current)
10 {
11     console.log(globals[current]);
12     console.log([globals[current]]);
13 }
14
15 function onload()
16 {
17     var smb1 = Symbol();
18     var smb2 = Symbol("a");
19     var obj = {
20         get getter() {}
21     };
22     obj[Symbol()] = 1;
23     obj[smb2] = 2;
24     obj["a"] = smb1;
25
26     var map = new Map();
27     var weakMap = new WeakMap();
28     map.set(obj, {foo: 1});
29     weakMap.set(obj, {foo: 1});
30
31     var set = new Set();
32     var weakSet = new WeakSet();
33     set.add(obj);
34     weakSet.add(obj);
35
36     var mapMap0 = new Map();
37     mapMap0.set(new Map(), new WeakMap());
38     var mapMap = new Map();
39     mapMap.set(map, weakMap);
40
41     var setSet0 = new Set();
42     setSet0.add(new WeakSet());
43     var setSet = new Set();
44     setSet.add(weakSet);
45
46     var bigmap = new Map();
47     bigmap.set(" from str ", " to str ");
48     bigmap.set(undefined, undefined);
49     bigmap.set(null, null);
50     bigmap.set(42, 42);
51     bigmap.set({foo:"from"}, {foo:"to"});
52
53     globals = [
54         Promise.reject(-0), smb1, smb2, obj, map, weakMap, set, weakSet,
55         mapMap0, mapMap, setSet0, setSet, bigmap
56     ];
57
58     runTest();
59 }
60
61 function test()
62 {
63     InspectorTest.evaluateInPage("globals.length", loopOverGlobals.bind(this, 0));
64
65     function loopOverGlobals(current, total)
66     {
67         function advance()
68         {
69             var next = current + 1;
70             if (next == total.description)
71                 InspectorTest.expandConsoleMessages(finish);
72             else
73                 loopOverGlobals(next, total);
74         }
75
76         function finish()
77         {
78             InspectorTest.expandConsoleMessages(dumpConsoleMessages);
79         }
80
81         function dumpConsoleMessages()
82         {
83             InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textContentWithLineBreaks);
84             InspectorTest.completeTest();
85         }
86
87         InspectorTest.evaluateInPage("log(" + current + ")");
88         InspectorTest.runAfterPendingDispatches(evalInConsole);
89         function evalInConsole()
90         {
91             InspectorTest.evaluateInConsole("globals[" + current + "]");
92             InspectorTest.runAfterPendingDispatches(advance);
93         }
94     }
95 }
96 </script>
97 </head>
98
99 <body onload="onload()">
100 <p>
101 Tests that console properly displays information about ES6 features.
102 </p>
103 </body>
104 </html>