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.inspectorView.showPanel("sources"); | 19 var panel = WebInspector.inspectorView.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 testBreakpointsSetAndRemoveInFormattedSource(next) | 25 function testBreakpointSetInOriginalAndRemovedInFormatted(next) |
26 { | 26 { |
27 InspectorTest.showScriptSource("unformatted.js", didShowScriptSource
); | 27 InspectorTest.showScriptSource("script-formatter-breakpoints-4.html"
, didShowScriptSource); |
28 | 28 |
29 function didShowScriptSource(frame) | 29 function didShowScriptSource(frame) |
30 { | 30 { |
31 sourceFrame = frame; | |
32 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | |
33 scriptFormatter._toggleFormatScriptSource(); | |
34 } | |
35 | |
36 function uiSourceCodeScriptFormatted() | |
37 { | |
38 formattedSourceFrame = panel.visibleView; | |
39 InspectorTest.setBreakpoint(formattedSourceFrame, 3, "", true); | |
40 InspectorTest.waitUntilPaused(pausedInF2); | |
41 InspectorTest.evaluateInPageWithTimeout("f2()"); | |
42 } | |
43 | |
44 function pausedInF2(callFrames) | |
45 { | |
46 InspectorTest.dumpBreakpointSidebarPane("while paused in pretty
printed"); | |
47 InspectorTest.removeBreakpoint(formattedSourceFrame, 3); | |
48 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | |
49 InspectorTest.dumpBreakpointSidebarPane("while paused in raw"); | |
50 InspectorTest.resumeExecution(next); | |
51 } | |
52 }, | |
53 | |
54 function testBreakpointSetInOriginalAndRemovedInFormatted(next) | |
55 { | |
56 InspectorTest.showScriptSource("script-formatter-breakpoints-2.html"
, didShowScriptSource); | |
57 | |
58 function didShowScriptSource(frame) | |
59 { | |
60 sourceFrame = frame; | 31 sourceFrame = frame; |
61 InspectorTest.addResult("Adding breakpoint."); | 32 InspectorTest.addResult("Adding breakpoint."); |
62 InspectorTest.addSniffer(WebInspector.BreakpointManager.Breakpoi
nt.prototype, "_addResolvedLocation", breakpointResolved); | 33 InspectorTest.addSniffer(WebInspector.BreakpointManager.Breakpoi
nt.prototype, "_addResolvedLocation", breakpointResolved); |
63 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); | 34 InspectorTest.setBreakpoint(sourceFrame, 11, "", true); |
64 } | 35 } |
65 | 36 |
66 function breakpointResolved() | 37 function breakpointResolved() |
67 { | 38 { |
68 InspectorTest.addResult("Formatting."); | 39 InspectorTest.addResult("Formatting."); |
69 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | 40 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); |
70 scriptFormatter._toggleFormatScriptSource(); | 41 scriptFormatter._toggleFormatScriptSource(); |
71 } | 42 } |
72 | 43 |
73 function uiSourceCodeScriptFormatted() | 44 function uiSourceCodeScriptFormatted() |
74 { | 45 { |
75 InspectorTest.addResult("Removing breakpoint."); | 46 InspectorTest.addResult("Removing breakpoint."); |
76 formattedSourceFrame = panel.visibleView; | 47 formattedSourceFrame = panel.visibleView; |
77 InspectorTest.removeBreakpoint(formattedSourceFrame, 16); | 48 InspectorTest.removeBreakpoint(formattedSourceFrame, 16); |
78 InspectorTest.addResult("Unformatting."); | 49 InspectorTest.addResult("Unformatting."); |
79 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); | 50 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibl
eView.uiSourceCode()); |
80 var breakpoints = WebInspector.breakpointManager._storage._setti
ng.get(); | 51 var breakpoints = WebInspector.breakpointManager._storage._setti
ng.get(); |
81 InspectorTest.assertEquals(breakpoints.length, 0, "There should
not be any breakpoints in the storage."); | 52 InspectorTest.assertEquals(breakpoints.length, 0, "There should
not be any breakpoints in the storage."); |
82 next(); | 53 next(); |
83 } | 54 } |
84 } | 55 } |
85 ]); | 56 ]); |
86 | 57 |
87 } | 58 } |
88 | |
89 </script> | 59 </script> |
90 | |
91 </head> | 60 </head> |
92 | |
93 <body onload="runTest()"> | 61 <body onload="runTest()"> |
94 <p>Tests the script formatting is working fine with breakpoints. | 62 <p>Tests the script formatting is working fine with breakpoints. |
95 </p> | 63 </p> |
96 | |
97 </body> | 64 </body> |
98 </html> | 65 </html> |
OLD | NEW |