Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/elements-test.js"></script> | 5 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 function testFunction() | |
| 8 { | |
| 9 var x = Math.sqrt(10); | |
| 10 return x; | |
| 11 } | |
| 12 | 7 |
| 13 var test = function() | 8 var test = function() |
| 14 { | 9 { |
| 15 InspectorTest.setQuiet(true); | 10 InspectorTest.setQuiet(true); |
| 11 //our callback called twice per each experession | |
| 12 var updateCount = 6; | |
| 13 | |
| 16 InspectorTest.startDebuggerTest(step1); | 14 InspectorTest.startDebuggerTest(step1); |
| 17 | 15 |
| 18 var currentSourceFrame; | 16 var watchExpressionsPane; |
| 19 var watchExpressionsSection; | |
| 20 | 17 |
| 21 function step1() | 18 function step1() |
| 22 { | 19 { |
| 23 var watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watc hExpressions; | 20 watchExpressionsPane = WebInspector.panels.sources.sidebarPanes.watchExp ressions; |
| 24 watchExpressionsPane.expand(); | 21 watchExpressionsPane.expand(); |
| 25 | 22 |
| 26 watchExpressionsSection = watchExpressionsPane.section; | 23 InspectorTest.addSniffer(WebInspector.WatchExpression.prototype, "_creat eWatchExpression", watchExpressionsUpdated, true); |
|
pfeldman
2015/02/18 20:51:00
You'll have to rebaseline this.
| |
| 27 watchExpressionsSection.watchExpressions = []; | 24 watchExpressionsPane.addExpression("Object(true)"); |
| 28 watchExpressionsSection.watchExpressions.push("Object(true)"); | 25 watchExpressionsPane.addExpression("(function(a,b) { return a + b; })"); |
| 29 watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; })"); | 26 watchExpressionsPane.addExpression("(function(a,b) { return a + b; }).bi nd({}, 2)"); |
| 30 watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; }).bind({}, 2)"); | |
| 31 watchExpressionsSection.update(); | |
| 32 | |
| 33 var testName = InspectorTest.resourceTreeModel.inspectedPageURL(); | |
| 34 testName = testName.substring(testName.lastIndexOf('/') + 1); | |
| 35 InspectorTest.showScriptSource(testName, didShowScriptSource); | |
| 36 } | |
| 37 | |
| 38 function didShowScriptSource(sourceFrame) | |
| 39 { | |
| 40 currentSourceFrame = sourceFrame; | |
| 41 InspectorTest.addResult("Script source was shown."); | |
| 42 InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true); | |
| 43 InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "update", watchExpressionsUpdated); | |
| 44 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); | |
| 45 } | |
| 46 | |
| 47 function didPause(callFrames) | |
| 48 { | |
| 49 } | 27 } |
| 50 | 28 |
| 51 function watchExpressionsUpdated() | 29 function watchExpressionsUpdated() |
| 52 { | 30 { |
| 31 updateCount--; | |
| 32 if (updateCount) | |
| 33 return; | |
| 34 | |
| 53 InspectorTest.addResult("Watch expressions updated."); | 35 InspectorTest.addResult("Watch expressions updated."); |
| 54 var treeNodes = watchExpressionsSection.propertiesTreeOutline.children; | 36 |
| 55 for (var i = 0; i < treeNodes.length; i++) { | 37 for (var i = 0; i < watchExpressionsPane._watchExpressions.length; i++) { |
| 56 treeNodes[i].expand(); | 38 var watch = watchExpressionsPane._watchExpressions[i]; |
| 39 watch._objectPresentationElement._section.expand(); | |
| 57 } | 40 } |
| 58 InspectorTest.runAfterPendingDispatches(nodesExpanded); | 41 InspectorTest.runAfterPendingDispatches(nodesExpanded); |
| 59 } | 42 } |
| 60 | 43 |
| 61 function nodesExpanded() | 44 function nodesExpanded() |
| 62 { | 45 { |
| 63 InspectorTest.addResult("Nodes are expanded."); | 46 InspectorTest.addResult("Nodes are expanded."); |
| 64 InspectorTest.dumpObjectPropertySectionDeep(watchExpressionsSection); | 47 for (var i = 0; i < watchExpressionsPane._watchExpressions.length; i++) { |
| 48 var watch = watchExpressionsPane._watchExpressions[i]; | |
| 49 var nameElement = watch._objectPresentationElement.querySelector(".n ame"); | |
| 50 var valueElement = watch._objectPresentationElement.querySelector(". value"); | |
| 51 InspectorTest.addResult("'" + nameElement.textContent + "'" + " => " + "'" + valueElement.textContent + "'"); | |
| 52 InspectorTest.dumpObjectPropertySectionDeep(watch._objectPresentatio nElement._section) | |
| 53 } | |
| 65 | 54 |
| 66 // Clear watch expressions after execution. | 55 // Clear watch expressions after execution. |
| 67 watchExpressionsSection.watchExpressions = []; | 56 watchExpressionsPane._deleteAllButtonClicked(); |
| 68 watchExpressionsSection.update(); | |
| 69 | |
| 70 InspectorTest.completeDebuggerTest(); | 57 InspectorTest.completeDebuggerTest(); |
| 71 } | 58 } |
| 72 } | 59 } |
| 73 | 60 |
| 74 </script> | 61 </script> |
| 75 </head> | 62 </head> |
| 76 <body onload="runTest()"> | 63 <body onload="runTest()"> |
| 77 <p>Tests how debugger presents special properties of closures, bound functions a nd object wrappers.</p> | 64 <p>Tests how debugger presents special properties of closures, bound functions a nd object wrappers.</p> |
| 78 </body> | 65 </body> |
| 79 </html> | 66 </html> |
| OLD | NEW |