Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / properties-special.html
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../../../http/tests/inspector/elements-test.js"></script>
6 <script>
7 function testFunction()
8 {
9     var x = Math.sqrt(10);
10     return x;
11 }
12
13 var test = function()
14 {
15     InspectorTest.setQuiet(true);
16     InspectorTest.startDebuggerTest(step1);
17
18     var currentSourceFrame;
19     var watchExpressionsSection;
20
21     function step1()
22     {
23         // We need to initialize sources panel so that watch expressions section is created.
24         WebInspector.inspectorView.showPanel("sources");
25
26         var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
27         watchExpressionsPane.expand();
28
29         watchExpressionsSection = watchExpressionsPane.section;
30         watchExpressionsSection.watchExpressions = [];
31         watchExpressionsSection.watchExpressions.push("Object(true)");
32         watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; })");
33         watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; }).bind({}, 2)");
34         watchExpressionsSection.update();
35
36         var testName = WebInspector.resourceTreeModel.inspectedPageURL();
37         testName = testName.substring(testName.lastIndexOf('/') + 1);
38         InspectorTest.showScriptSource(testName, didShowScriptSource);
39     }
40
41     function didShowScriptSource(sourceFrame)
42     {
43         currentSourceFrame = sourceFrame;
44         InspectorTest.addResult("Script source was shown.");
45         InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
46         InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "update", watchExpressionsUpdated);
47         InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
48     }
49
50     function didPause(callFrames)
51     {
52     }
53
54     function watchExpressionsUpdated()
55     {
56         InspectorTest.addResult("Watch expressions updated.");
57         var treeNodes = watchExpressionsSection.propertiesTreeOutline.children;
58         for (var i = 0; i < treeNodes.length; i++) {
59             treeNodes[i].expand();
60         }
61         InspectorTest.runAfterPendingDispatches(nodesExpanded);
62     }
63
64     function nodesExpanded()
65     {
66         InspectorTest.addResult("Nodes are expanded.");
67         InspectorTest.dumpObjectPropertySectionDeep(watchExpressionsSection);
68
69         // Clear watch expressions after execution.
70         watchExpressionsSection.watchExpressions = [];
71         watchExpressionsSection.update();
72
73         InspectorTest.completeDebuggerTest();
74     }
75 }
76
77 </script>
78 </head>
79 <body onload="runTest()">
80 <p>Tests how debugger presents special properties of closures, bound functions and object wrappers.</p>
81 </body>
82 </html>