| 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 | |
| 7 <script> | 6 <script> |
| 8 | |
| 9 function f1() | |
| 10 { | |
| 11 var a=0;var b=1;var c=3;var d=4;var e=5; | |
| 12 var f=0; | |
| 13 return 0; | |
| 14 } | |
| 15 | |
| 16 var test = function() | 7 var test = function() |
| 17 { | 8 { |
| 18 WebInspector.breakpointManager._storage._breakpoints = {}; | 9 WebInspector.breakpointManager._storage._breakpoints = {}; |
| 19 var panel = WebInspector.inspectorView.showPanel("sources"); | 10 var panel = WebInspector.inspectorView.showPanel("sources"); |
| 20 var scriptFormatter = InspectorTest.scriptFormatter(); | 11 var scriptFormatter = InspectorTest.scriptFormatter(); |
| 21 var sourceFrame; | 12 var sourceFrame; |
| 22 var formattedSourceFrame; | 13 var formattedSourceFrame; |
| 23 | 14 |
| 24 InspectorTest.runDebuggerTestSuite([ | 15 InspectorTest.runDebuggerTestSuite([ |
| 25 function testBreakpointsInOriginalAndFormattedSource(next) | |
| 26 { | |
| 27 InspectorTest.showScriptSource("script-formatter-breakpoints-1.html"
, didShowScriptSource); | |
| 28 | |
| 29 function didShowScriptSource(frame) | |
| 30 { | |
| 31 sourceFrame = frame; | |
| 32 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); | |
| 33 InspectorTest.waitUntilPaused(pausedInF1); | |
| 34 InspectorTest.evaluateInPageWithTimeout("f1()"); | |
| 35 } | |
| 36 | |
| 37 function pausedInF1(callFrames) | |
| 38 { | |
| 39 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); | |
| 40 InspectorTest.resumeExecution(resumed); | |
| 41 } | |
| 42 | |
| 43 function resumed() | |
| 44 { | |
| 45 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | |
| 46 scriptFormatter._toggleFormatScriptSource(); | |
| 47 } | |
| 48 | |
| 49 function uiSourceCodeScriptFormatted() | |
| 50 { | |
| 51 // There should be a breakpoint in f1 although script is pretty-
printed. | |
| 52 InspectorTest.waitUntilPaused(pausedInF1Again); | |
| 53 InspectorTest.evaluateInPageWithTimeout("f1()"); | |
| 54 } | |
| 55 | |
| 56 function pausedInF1Again(callFrames) | |
| 57 { | |
| 58 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); | |
| 59 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | |
| 60 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); | |
| 61 InspectorTest.removeBreakpoint(sourceFrame, 11); | |
| 62 InspectorTest.resumeExecution(next); | |
| 63 } | |
| 64 }, | |
| 65 | |
| 66 function testBreakpointsSetInFormattedAndRemoveInOriginalSource(next) | 16 function testBreakpointsSetInFormattedAndRemoveInOriginalSource(next) |
| 67 { | 17 { |
| 68 InspectorTest.showScriptSource("unformatted.js", didShowScriptSource
); | 18 InspectorTest.showScriptSource("unformatted.js", didShowScriptSource
); |
| 69 | 19 |
| 70 function didShowScriptSource(frame) | 20 function didShowScriptSource(frame) |
| 71 { | 21 { |
| 72 sourceFrame = frame; | 22 sourceFrame = frame; |
| 73 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | 23 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); |
| 74 scriptFormatter._toggleFormatScriptSource(); | 24 scriptFormatter._toggleFormatScriptSource(); |
| 75 } | 25 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 87 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); | 37 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); |
| 88 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | 38 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); |
| 89 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); | 39 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); |
| 90 // No need to remove breakpoint since formattedUISourceCode was
removed. | 40 // No need to remove breakpoint since formattedUISourceCode was
removed. |
| 91 InspectorTest.resumeExecution(next); | 41 InspectorTest.resumeExecution(next); |
| 92 } | 42 } |
| 93 } | 43 } |
| 94 ]); | 44 ]); |
| 95 | 45 |
| 96 } | 46 } |
| 97 | |
| 98 </script> | 47 </script> |
| 99 | |
| 100 </head> | 48 </head> |
| 101 | |
| 102 <body onload="runTest()"> | 49 <body onload="runTest()"> |
| 103 <p>Tests the script formatting is working fine with breakpoints. | 50 <p>Tests the script formatting is working fine with breakpoints. |
| 104 </p> | 51 </p> |
| 105 | |
| 106 </body> | 52 </body> |
| 107 </html> | 53 </html> |
| OLD | NEW |