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>
7 function testFunction()
15 InspectorTest.setQuiet(true);
16 InspectorTest.startDebuggerTest(step1);
18 var currentSourceFrame;
19 var watchExpressionsSection;
23 // We need to initialize sources panel so that watch expressions section is created.
24 WebInspector.inspectorView.showPanel("sources");
26 var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExpressions;
27 watchExpressionsPane.expand();
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();
36 var testName = WebInspector.resourceTreeModel.inspectedPageURL();
37 testName = testName.substring(testName.lastIndexOf('/') + 1);
38 InspectorTest.showScriptSource(testName, didShowScriptSource);
41 function didShowScriptSource(sourceFrame)
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);
50 function didPause(callFrames)
54 function watchExpressionsUpdated()
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();
61 InspectorTest.runAfterPendingDispatches(nodesExpanded);
64 function nodesExpanded()
66 InspectorTest.addResult("Nodes are expanded.");
67 InspectorTest.dumpObjectPropertySectionDeep(watchExpressionsSection);
69 // Clear watch expressions after execution.
70 watchExpressionsSection.watchExpressions = [];
71 watchExpressionsSection.update();
73 InspectorTest.completeDebuggerTest();
79 <body onload="runTest()">
80 <p>Tests how debugger presents special properties of closures, bound functions and object wrappers.</p>