| 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="resources/unformatted.js"></script> | 5 <script src="resources/unformatted.js"></script> |
| 6 | 6 |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 function f1() | 9 function f1() |
| 10 { | 10 { |
| 11 var a=0;var b=1;var c=3;var d=4;var e=5; | 11 var a=0;var b=1;var c=3;var d=4;var e=5; |
| 12 var f=0; | 12 var f=0; |
| 13 return 0; | 13 return 0; |
| 14 } | 14 } |
| 15 | 15 |
| 16 var test = function() | 16 var test = function() |
| 17 { | 17 { |
| 18 WebInspector.breakpointManager._storage._breakpoints = {}; | 18 WebInspector.breakpointManager._storage._breakpoints = {}; |
| 19 var panel = WebInspector.showPanel("sources"); | 19 var panel = WebInspector.showPanel("sources"); |
| 20 var scriptFormatter = InspectorTest.scriptFormatter(); | 20 var scriptFormatter = InspectorTest.scriptFormatter(); |
| 21 var sourceFrame; | 21 var sourceFrame; |
| 22 var formattedSourceFrame; | 22 var formattedSourceFrame; |
| 23 | 23 |
| 24 InspectorTest.runDebuggerTestSuite([ | 24 InspectorTest.runDebuggerTestSuite([ |
| 25 function testBreakpointsInOriginalAndFormattedSource(next) | 25 function testBreakpointsInOriginalAndFormattedSource(next) |
| 26 { | 26 { |
| 27 InspectorTest.showScriptSource("script-formatter-breakpoints.html",
didShowScriptSource); | 27 InspectorTest.showScriptSource("script-formatter-breakpoints-1.html"
, didShowScriptSource); |
| 28 | 28 |
| 29 function didShowScriptSource(frame) | 29 function didShowScriptSource(frame) |
| 30 { | 30 { |
| 31 sourceFrame = frame; | 31 sourceFrame = frame; |
| 32 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); | 32 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); |
| 33 InspectorTest.waitUntilPaused(pausedInF1); | 33 InspectorTest.waitUntilPaused(pausedInF1); |
| 34 InspectorTest.evaluateInPageWithTimeout("f1()"); | 34 InspectorTest.evaluateInPageWithTimeout("f1()"); |
| 35 } | 35 } |
| 36 | 36 |
| 37 function pausedInF1(callFrames) | 37 function pausedInF1(callFrames) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 function pausedInF1Again(callFrames) | 56 function pausedInF1Again(callFrames) |
| 57 { | 57 { |
| 58 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); | 58 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); |
| 59 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | 59 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); |
| 60 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); | 60 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); |
| 61 InspectorTest.removeBreakpoint(sourceFrame, 11); | 61 InspectorTest.removeBreakpoint(sourceFrame, 11); |
| 62 InspectorTest.resumeExecution(next); | 62 InspectorTest.resumeExecution(next); |
| 63 } | 63 } |
| 64 }, | 64 }, |
| 65 | 65 |
| 66 function testBreakpointSetInOriginalAndRemovedInFormatted(next) | |
| 67 { | |
| 68 InspectorTest.showScriptSource("script-formatter-breakpoints.html",
didShowScriptSource); | |
| 69 | |
| 70 function didShowScriptSource(frame) | |
| 71 { | |
| 72 sourceFrame = frame; | |
| 73 InspectorTest.addResult("Adding breakpoint."); | |
| 74 InspectorTest.addSniffer(WebInspector.BreakpointManager.Breakpoi
nt.prototype, "_addResolvedLocation", breakpointResolved); | |
| 75 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); | |
| 76 } | |
| 77 | |
| 78 function breakpointResolved() | |
| 79 { | |
| 80 InspectorTest.addResult("Formatting."); | |
| 81 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | |
| 82 scriptFormatter._toggleFormatScriptSource(); | |
| 83 } | |
| 84 | |
| 85 function uiSourceCodeScriptFormatted() | |
| 86 { | |
| 87 InspectorTest.addResult("Removing breakpoint."); | |
| 88 formattedSourceFrame = panel.visibleView; | |
| 89 InspectorTest.removeBreakpoint(formattedSourceFrame, 16); | |
| 90 InspectorTest.addResult("Unformatting."); | |
| 91 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | |
| 92 var breakpoints = WebInspector.breakpointManager._storage._setti
ng.get(); | |
| 93 InspectorTest.assertEquals(breakpoints.length, 0, "There should
not be any breakpoints in the storage."); | |
| 94 next(); | |
| 95 } | |
| 96 }, | |
| 97 | |
| 98 function testBreakpointsSetAndRemoveInFormattedSource(next) | |
| 99 { | |
| 100 InspectorTest.showScriptSource("unformatted.js", didShowScriptSource
); | |
| 101 | |
| 102 function didShowScriptSource(frame) | |
| 103 { | |
| 104 sourceFrame = frame; | |
| 105 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | |
| 106 scriptFormatter._toggleFormatScriptSource(); | |
| 107 } | |
| 108 | |
| 109 function uiSourceCodeScriptFormatted() | |
| 110 { | |
| 111 formattedSourceFrame = panel.visibleView; | |
| 112 InspectorTest.setBreakpoint(formattedSourceFrame, 3, "", true); | |
| 113 InspectorTest.waitUntilPaused(pausedInF2); | |
| 114 InspectorTest.evaluateInPageWithTimeout("f2()"); | |
| 115 } | |
| 116 | |
| 117 function pausedInF2(callFrames) | |
| 118 { | |
| 119 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); | |
| 120 InspectorTest.removeBreakpoint(formattedSourceFrame, 3); | |
| 121 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | |
| 122 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); | |
| 123 InspectorTest.resumeExecution(next); | |
| 124 } | |
| 125 }, | |
| 126 | |
| 127 function testBreakpointsSetInFormattedAndRemoveInOriginalSource(next) | 66 function testBreakpointsSetInFormattedAndRemoveInOriginalSource(next) |
| 128 { | 67 { |
| 129 InspectorTest.showScriptSource("unformatted.js", didShowScriptSource
); | 68 InspectorTest.showScriptSource("unformatted.js", didShowScriptSource
); |
| 130 | 69 |
| 131 function didShowScriptSource(frame) | 70 function didShowScriptSource(frame) |
| 132 { | 71 { |
| 133 sourceFrame = frame; | 72 sourceFrame = frame; |
| 134 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | 73 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); |
| 135 scriptFormatter._toggleFormatScriptSource(); | 74 scriptFormatter._toggleFormatScriptSource(); |
| 136 } | 75 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 159 </script> | 98 </script> |
| 160 | 99 |
| 161 </head> | 100 </head> |
| 162 | 101 |
| 163 <body onload="runTest()"> | 102 <body onload="runTest()"> |
| 164 <p>Tests the script formatting is working fine with breakpoints. | 103 <p>Tests the script formatting is working fine with breakpoints. |
| 165 </p> | 104 </p> |
| 166 | 105 |
| 167 </body> | 106 </body> |
| 168 </html> | 107 </html> |
| OLD | NEW |