Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / console / console-save-to-temp-var.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 src="../../http/tests/inspector/sources-test.js"></script>
6 <script>
7
8 function onload()
9 {
10     for (var i = 3; i < 8; ++i)
11         window["temp" + i] = "Reserved";
12
13     runTest();
14 }
15
16 function test()
17 {
18     var expressions = [
19         "42",
20         "'foo string'",
21         "NaN",
22         "Infinity",
23         "-Infinity",
24         "-0",
25         "[1, 2, NaN, -0, null, undefined]",
26         "({ foo: 'bar' })",
27         "(function(){ return arguments; })(1,2,3,4)",
28         "(function func() {})",
29         "new Error('errr')"
30     ];
31
32     InspectorTest.addResult("Number of expressions: " + expressions.length);
33     InspectorTest.addResult("Names [temp3..temp7] are reserved\n");
34
35     function evaluateNext()
36     {
37         var expression = expressions.shift();
38         if (!expression) {
39             InspectorTest.waitForRemoteObjectsConsoleMessages(dumpConsoleMessages);
40             return;
41         }
42
43         function didEvaluate(result, wasThrown)
44         {
45             InspectorTest.assertTrue(!wasThrown, "FAIL: was thrown. Expression: " + expression);
46             WebInspector.panels.sources._saveToTempVariable(result);
47             InspectorTest.waitUntilNthMessageReceived(2, evaluateNext);
48         }
49
50         WebInspector.context.flavor(WebInspector.ExecutionContext).evaluate(expression, "console", true, undefined, undefined, undefined, didEvaluate);
51     }
52
53     function dumpConsoleMessages()
54     {
55         InspectorTest.dumpConsoleMessages();
56         InspectorTest.completeTest();
57     }
58
59     evaluateNext();
60 }
61
62 </script>
63 </head>
64
65 <body onload="onload()">
66 <p>
67 Tests saving objects to temporary variables.
68 </p>
69
70 </body>
71 </html>