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/workspace-test.js"></script> | |
4 <script src="breakpoint-manager.js"></script> | 5 <script src="breakpoint-manager.js"></script> |
5 | 6 |
6 <script> | 7 <script> |
7 | 8 |
8 function test() | 9 function test() |
9 { | 10 { |
11 var mockTarget; | |
10 function resetWorkspace(breakpointManager) | 12 function resetWorkspace(breakpointManager) |
vsevik
2014/08/04 09:05:14
Can we split this into create and reset workspace
apavlov
2014/08/04 10:04:34
Done.
| |
11 { | 13 { |
12 InspectorTest.addResult(" Resetting workspace."); | 14 if (breakpointManager) { |
13 breakpointManager._networkWorkspaceBinding.reset(); | 15 mockTarget.debuggerModel.reset(); |
14 breakpointManager._debuggerProjectDelegate.reset(); | 16 InspectorTest.addResult(" Resetting workspace."); |
17 breakpointManager._debuggerWorkspaceBinding._reset(mockTarget); | |
18 breakpointManager._debuggerWorkspaceBinding._networkWorkspaceBinding .reset(); | |
19 return; | |
20 } | |
21 InspectorTest.createWorkspace(true); | |
22 mockTarget = InspectorTest.createMockTarget(1); | |
23 InspectorTest.testTargetManager.addTarget(mockTarget); | |
24 if (breakpointManager) | |
25 breakpointManager._debuggerWorkspaceBinding = InspectorTest.testDebu ggerWorkspaceBinding; | |
15 } | 26 } |
16 | 27 |
17 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) | 28 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) |
18 { | 29 { |
19 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition : condition, enabled: enabled }; | 30 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition : condition, enabled: enabled }; |
20 } | 31 } |
21 | 32 |
22 var serializedBreakpoints = []; | 33 var serializedBreakpoints = []; |
23 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true)) ; | 34 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true)) ; |
24 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", false)); | 35 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", false)); |
25 serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true)); | 36 serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true)); |
26 | 37 |
27 var targetManager = new WebInspector.TargetManager(); | 38 resetWorkspace(); |
28 var mockTarget = InspectorTest.createMockTarget(targetManager, 1); | |
29 targetManager._targets.push(mockTarget); | |
30 InspectorTest.setupLiveLocationSniffers(); | 39 InspectorTest.setupLiveLocationSniffers(); |
31 | 40 |
32 var addUISourceCode = InspectorTest.addUISourceCode.bind(null, mockTarget); | 41 var addUISourceCode = function() { |
33 var createBreakpointManager = InspectorTest.createBreakpointManager.bind(nul l, targetManager); | 42 var args = [mockTarget].concat(Array.prototype.slice.call(arguments)); |
43 return InspectorTest.addUISourceCode.apply(null, args); | |
44 } | |
45 var createBreakpointManager = function(serializedBreakpoints) { | |
46 return InspectorTest.createBreakpointManager(InspectorTest.testTargetMan ager, InspectorTest.testDebuggerWorkspaceBinding, serializedBreakpoints); | |
47 } | |
34 | 48 |
35 InspectorTest.runTestSuite([ | 49 InspectorTest.runTestSuite([ |
36 function testSetBreakpoint(next) | 50 function testSetBreakpoint(next) |
37 { | 51 { |
38 var breakpointManager = createBreakpointManager(); | 52 var breakpointManager = createBreakpointManager(); |
39 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 53 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
40 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); | 54 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); |
41 InspectorTest.finishBreakpointTest(breakpointManager, next); | 55 InspectorTest.finishBreakpointTest(breakpointManager, next); |
42 }, | 56 }, |
43 | 57 |
(...skipping 20 matching lines...) Expand all Loading... | |
64 InspectorTest.dumpBreakpointLocations(breakpointManager); | 78 InspectorTest.dumpBreakpointLocations(breakpointManager); |
65 InspectorTest.dumpBreakpointStorage(breakpointManager); | 79 InspectorTest.dumpBreakpointStorage(breakpointManager); |
66 InspectorTest.addResult(" Updating condition"); | 80 InspectorTest.addResult(" Updating condition"); |
67 breakpoint.setCondition(""); | 81 breakpoint.setCondition(""); |
68 InspectorTest.finishBreakpointTest(breakpointManager, next); | 82 InspectorTest.finishBreakpointTest(breakpointManager, next); |
69 } | 83 } |
70 }, | 84 }, |
71 | 85 |
72 function testRestoreBreakpoints(next) | 86 function testRestoreBreakpoints(next) |
73 { | 87 { |
88 resetWorkspace(); | |
74 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 89 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
75 addUISourceCode(breakpointManager, "a.js"); | 90 addUISourceCode(breakpointManager, "a.js"); |
76 InspectorTest.finishBreakpointTest(breakpointManager, next); | 91 InspectorTest.finishBreakpointTest(breakpointManager, next); |
77 }, | 92 }, |
78 | 93 |
79 function testRestoreBreakpointsTwice(next) | 94 function testRestoreBreakpointsTwice(next) |
80 { | 95 { |
96 resetWorkspace(); | |
81 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 97 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
82 addUISourceCode(breakpointManager, "a.js"); | 98 addUISourceCode(breakpointManager, "a.js"); |
83 addUISourceCode(breakpointManager, "a.js"); | 99 addUISourceCode(breakpointManager, "a.js"); |
84 InspectorTest.finishBreakpointTest(breakpointManager, next); | 100 InspectorTest.finishBreakpointTest(breakpointManager, next); |
85 }, | 101 }, |
86 | 102 |
87 function testRemoveBreakpoints(next) | 103 function testRemoveBreakpoints(next) |
88 { | 104 { |
105 resetWorkspace(); | |
89 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 106 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
90 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 107 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
91 window.setBreakpointCallback = step2.bind(this); | 108 window.setBreakpointCallback = step2.bind(this); |
92 | 109 |
93 function step2() | 110 function step2() |
94 { | 111 { |
95 InspectorTest.dumpBreakpointLocations(breakpointManager); | 112 InspectorTest.dumpBreakpointLocations(breakpointManager); |
96 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step3); | 113 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step3); |
97 } | 114 } |
98 | 115 |
99 function step3() | 116 function step3() |
100 { | 117 { |
101 InspectorTest.dumpBreakpointLocations(breakpointManager); | 118 InspectorTest.dumpBreakpointLocations(breakpointManager); |
102 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 30, 0); | 119 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 30, 0); |
103 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 10, 0); | 120 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 10, 0); |
104 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 20, 0); | 121 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 20, 0); |
105 InspectorTest.finishBreakpointTest(breakpointManager, next); | 122 InspectorTest.finishBreakpointTest(breakpointManager, next); |
106 } | 123 } |
107 }, | 124 }, |
108 | 125 |
109 function testSetBreakpointThatShifts(next) | 126 function testSetBreakpointThatShifts(next) |
110 { | 127 { |
128 resetWorkspace(); | |
111 var breakpointManager = createBreakpointManager(); | 129 var breakpointManager = createBreakpointManager(); |
112 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 130 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
113 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0 , "", true); | 131 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0 , "", true); |
114 InspectorTest.finishBreakpointTest(breakpointManager, next); | 132 InspectorTest.finishBreakpointTest(breakpointManager, next); |
115 }, | 133 }, |
116 | 134 |
117 function testSetBreakpointThatShiftsTwice(next) | 135 function testSetBreakpointThatShiftsTwice(next) |
118 { | 136 { |
137 resetWorkspace(); | |
119 var breakpointManager = createBreakpointManager(); | 138 var breakpointManager = createBreakpointManager(); |
120 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 139 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
121 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0 , "", true, step2); | 140 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0 , "", true, step2); |
122 | 141 |
123 function step2() | 142 function step2() |
124 { | 143 { |
125 InspectorTest.dumpBreakpointLocations(breakpointManager); | 144 InspectorTest.dumpBreakpointLocations(breakpointManager); |
126 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 101 5, 0, "", true); | 145 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 101 5, 0, "", true); |
127 InspectorTest.finishBreakpointTest(breakpointManager, next); | 146 InspectorTest.finishBreakpointTest(breakpointManager, next); |
128 } | 147 } |
129 }, | 148 }, |
130 | 149 |
131 function testSetBreakpointOutsideScript(next) | 150 function testSetBreakpointOutsideScript(next) |
132 { | 151 { |
152 resetWorkspace(); | |
133 var breakpointManager = createBreakpointManager(); | 153 var breakpointManager = createBreakpointManager(); |
134 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 154 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
135 breakpointManager.setBreakpoint(uiSourceCode, 2500, 0, "", true); | 155 breakpointManager.setBreakpoint(uiSourceCode, 2500, 0, "", true); |
136 InspectorTest.finishBreakpointTest(breakpointManager, next); | 156 InspectorTest.finishBreakpointTest(breakpointManager, next); |
137 }, | 157 }, |
138 | 158 |
139 function testNavigation(next) | 159 function testNavigation(next) |
140 { | 160 { |
161 resetWorkspace(); | |
141 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 162 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
142 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 163 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
143 window.setBreakpointCallback = step2.bind(this); | 164 window.setBreakpointCallback = step2.bind(this); |
144 | 165 |
145 function step2() | 166 function step2() |
146 { | 167 { |
147 InspectorTest.dumpBreakpointLocations(breakpointManager); | 168 InspectorTest.dumpBreakpointLocations(breakpointManager); |
148 InspectorTest.addResult("\n Navigating to B."); | 169 InspectorTest.addResult("\n Navigating to B."); |
149 mockTarget.debuggerModel.reset(); | |
150 resetWorkspace(breakpointManager); | 170 resetWorkspace(breakpointManager); |
151 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js"); | 171 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js"); |
152 window.setBreakpointCallback = step3.bind(this); | 172 window.setBreakpointCallback = step3.bind(this); |
153 } | 173 } |
154 | 174 |
155 function step3() | 175 function step3() |
156 { | 176 { |
157 InspectorTest.dumpBreakpointLocations(breakpointManager); | 177 InspectorTest.dumpBreakpointLocations(breakpointManager); |
158 InspectorTest.addResult("\n Navigating back to A."); | 178 InspectorTest.addResult("\n Navigating back to A."); |
159 mockTarget.debuggerModel.reset(); | |
160 resetWorkspace(breakpointManager); | 179 resetWorkspace(breakpointManager); |
161 InspectorTest.addResult(" Resolving provisional breakpoint."); | 180 InspectorTest.addResult(" Resolving provisional breakpoint."); |
162 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); | 181 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); |
163 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); | 182 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 0)); |
164 addUISourceCode(breakpointManager, "a.js", false, true); | 183 addUISourceCode(breakpointManager, "a.js", false, true); |
165 InspectorTest.finishBreakpointTest(breakpointManager, next); | 184 InspectorTest.finishBreakpointTest(breakpointManager, next); |
166 } | 185 } |
167 }, | 186 }, |
168 | 187 |
169 function testSourceMapping(next) | 188 function testSourceMapping(next) |
170 { | 189 { |
171 var shiftingMapping = { | 190 var shiftingMapping = { |
172 rawLocationToUILocation: function(rawLocation) | 191 rawLocationToUILocation: function(rawLocation) |
173 { | 192 { |
(...skipping 11 matching lines...) Expand all Loading... | |
185 { | 204 { |
186 return false; | 205 return false; |
187 } | 206 } |
188 }; | 207 }; |
189 | 208 |
190 // Source mapping will shift everything 10 lines ahead so that break point 1 clashes with breakpoint 2. | 209 // Source mapping will shift everything 10 lines ahead so that break point 1 clashes with breakpoint 2. |
191 var serializedBreakpoints = []; | 210 var serializedBreakpoints = []; |
192 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); | 211 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); |
193 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", true)); | 212 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", true)); |
194 | 213 |
214 resetWorkspace(); | |
195 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 215 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
196 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 216 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
197 window.setBreakpointCallback = step2.bind(this); | 217 window.setBreakpointCallback = step2.bind(this); |
198 | 218 |
199 function step2() | 219 function step2() |
200 { | 220 { |
201 window.setBreakpointCallback = step3.bind(this); | 221 window.setBreakpointCallback = step3.bind(this); |
202 } | 222 } |
203 | 223 |
204 function step3() | 224 function step3() |
205 { | 225 { |
206 InspectorTest.dumpBreakpointLocations(breakpointManager); | 226 InspectorTest.dumpBreakpointLocations(breakpointManager); |
207 InspectorTest.addResult("\n Toggling source mapping."); | 227 InspectorTest.addResult("\n Toggling source mapping."); |
208 mockTarget.debuggerModel.pushSourceMapping(shiftingMapping); | 228 mockTarget.debuggerModel.pushSourceMapping(shiftingMapping); |
209 InspectorTest.dumpBreakpointLocations(breakpointManager); | 229 InspectorTest.dumpBreakpointLocations(breakpointManager); |
210 InspectorTest.addResult("\n Toggling source mapping back."); | 230 InspectorTest.addResult("\n Toggling source mapping back."); |
211 mockTarget.debuggerModel.disableSourceMapping(shiftingMapping); | 231 mockTarget.debuggerModel.disableSourceMapping(shiftingMapping); |
212 InspectorTest.finishBreakpointTest(breakpointManager, next); | 232 InspectorTest.finishBreakpointTest(breakpointManager, next); |
213 } | 233 } |
214 | 234 |
215 }, | 235 }, |
216 | 236 |
217 function testProvisionalBreakpointsResolve(next) | 237 function testProvisionalBreakpointsResolve(next) |
218 { | 238 { |
219 var serializedBreakpoints = []; | 239 var serializedBreakpoints = []; |
220 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); | 240 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); |
221 | 241 |
242 resetWorkspace(); | |
222 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 243 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
223 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 244 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
224 window.setBreakpointCallback = step2.bind(this); | 245 window.setBreakpointCallback = step2.bind(this); |
225 | 246 |
226 function step2() | 247 function step2() |
227 { | 248 { |
228 InspectorTest.dumpBreakpointLocations(breakpointManager); | 249 InspectorTest.dumpBreakpointLocations(breakpointManager); |
229 mockTarget.debuggerModel.reset(); | |
230 resetWorkspace(breakpointManager); | 250 resetWorkspace(breakpointManager); |
231 InspectorTest.addResult(" Resolving provisional breakpoint."); | 251 InspectorTest.addResult(" Resolving provisional breakpoint."); |
232 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); | 252 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); |
233 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); | 253 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 11, 0)); |
234 var breakpoints = breakpointManager.allBreakpoints(); | 254 var breakpoints = breakpointManager.allBreakpoints(); |
235 InspectorTest.assertEquals(breakpoints.length, 1, "Exactly one p rovisional breakpoint should be registered in breakpoint manager."); | 255 InspectorTest.assertEquals(1, breakpoints.length, "Exactly one p rovisional breakpoint should be registered in breakpoint manager."); |
236 InspectorTest.finishBreakpointTest(breakpointManager, next); | 256 InspectorTest.finishBreakpointTest(breakpointManager, next); |
237 } | 257 } |
238 }, | 258 }, |
239 | 259 |
240 function testSourceMappingReload(next) | 260 function testSourceMappingReload(next) |
241 { | 261 { |
242 function createSourceMapping(uiSourceCodeA, uiSourceCodeB) | 262 function createSourceMapping(uiSourceCodeA, uiSourceCodeB) |
243 { | 263 { |
244 var mapping = { | 264 var mapping = { |
245 rawLocationToUILocation: function(rawLocation) | 265 rawLocationToUILocation: function(rawLocation) |
(...skipping 11 matching lines...) Expand all Loading... | |
257 isIdentity: function() | 277 isIdentity: function() |
258 { | 278 { |
259 return false; | 279 return false; |
260 } | 280 } |
261 }; | 281 }; |
262 | 282 |
263 return mapping; | 283 return mapping; |
264 } | 284 } |
265 // Source mapping will shift everthing 10 lines ahead. | 285 // Source mapping will shift everthing 10 lines ahead. |
266 var serializedBreakpoints = [createBreakpoint("b.js", 20, "foo == ba r", true)]; | 286 var serializedBreakpoints = [createBreakpoint("b.js", 20, "foo == ba r", true)]; |
287 resetWorkspace(); | |
267 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 288 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
268 InspectorTest.addResult("\n Adding files:"); | 289 InspectorTest.addResult("\n Adding files:"); |
269 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 290 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
270 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); | 291 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); |
271 | 292 |
272 InspectorTest.addResult("\n Toggling source mapping."); | 293 InspectorTest.addResult("\n Toggling source mapping."); |
273 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceCodeB ); | 294 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceCodeB ); |
274 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); | 295 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); |
275 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMapping); | 296 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMapping); |
276 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, br eakpointActionsPerformedBeforeReload.bind(this)); | 297 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, br eakpointActionsPerformedBeforeReload.bind(this)); |
277 | 298 |
278 function breakpointActionsPerformedBeforeReload() | 299 function breakpointActionsPerformedBeforeReload() |
279 { | 300 { |
280 InspectorTest.dumpBreakpointLocations(breakpointManager); | 301 InspectorTest.dumpBreakpointLocations(breakpointManager); |
281 InspectorTest.addResult("\n Reloading:"); | 302 InspectorTest.addResult("\n Reloading:"); |
282 mockTarget.debuggerModel.reset(); | |
283 resetWorkspace(breakpointManager); | 303 resetWorkspace(breakpointManager); |
284 | 304 |
285 InspectorTest.addResult("\n Adding files:"); | 305 InspectorTest.addResult("\n Adding files:"); |
286 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); | 306 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); |
287 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); | 307 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 0)); |
288 uiSourceCodeA = addUISourceCode(breakpointManager, "a.js", false , true); | 308 uiSourceCodeA = addUISourceCode(breakpointManager, "a.js", false , true); |
289 uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); | 309 uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); |
290 | 310 |
291 InspectorTest.addResult("\n Toggling source mapping."); | 311 InspectorTest.addResult("\n Toggling source mapping."); |
292 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceC odeB); | 312 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceC odeB); |
293 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); | 313 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); |
294 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMappin g); | 314 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMappin g); |
295 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager , breakpointActionsPerformed.bind(this)); | 315 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager , breakpointActionsPerformed.bind(this)); |
296 } | 316 } |
297 | 317 |
298 function breakpointActionsPerformed() | 318 function breakpointActionsPerformed() |
299 { | 319 { |
300 InspectorTest.finishBreakpointTest(breakpointManager, next); | 320 InspectorTest.finishBreakpointTest(breakpointManager, next); |
301 } | 321 } |
302 }, | 322 }, |
303 | 323 |
304 function testBreakpointInCollectedReload(next) | 324 function testBreakpointInCollectedReload(next) |
305 { | 325 { |
326 resetWorkspace(); | |
306 var breakpointManager = createBreakpointManager(); | 327 var breakpointManager = createBreakpointManager(); |
307 InspectorTest.addResult("\n Adding file without script:"); | 328 InspectorTest.addResult("\n Adding file without script:"); |
308 var uiSourceCode = addUISourceCode(breakpointManager, "a.js", true, true); | 329 var uiSourceCode = addUISourceCode(breakpointManager, "a.js", true, true); |
309 | 330 |
310 InspectorTest.addResult("\n Setting breakpoint:"); | 331 InspectorTest.addResult("\n Setting breakpoint:"); |
311 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true, step2); | 332 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true, step2); |
312 | 333 |
313 function step2() | 334 function step2() |
314 { | 335 { |
315 InspectorTest.dumpBreakpointLocations(breakpointManager); | 336 InspectorTest.dumpBreakpointLocations(breakpointManager); |
316 InspectorTest.addResult("\n Reloading:"); | 337 InspectorTest.addResult("\n Reloading:"); |
317 mockTarget.debuggerModel.reset(); | |
318 resetWorkspace(breakpointManager); | 338 resetWorkspace(breakpointManager); |
319 | 339 |
320 InspectorTest.addResult("\n Adding file with script:"); | 340 InspectorTest.addResult("\n Adding file with script:"); |
321 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 341 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
322 | 342 |
323 InspectorTest.addResult("\n Emulating breakpoint resolved event :"); | 343 InspectorTest.addResult("\n Emulating breakpoint resolved event :"); |
324 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); | 344 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 0)); |
325 | 345 |
326 InspectorTest.addResult("\n Make sure we don't do any unnecessa ry breakpoint actions:"); | 346 InspectorTest.addResult("\n Make sure we don't do any unnecessa ry breakpoint actions:"); |
327 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager , breakpointActionsPerformed.bind(this)); | 347 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager , breakpointActionsPerformed.bind(this)); |
328 | 348 |
329 function breakpointActionsPerformed() | 349 function breakpointActionsPerformed() |
330 { | 350 { |
331 InspectorTest.finishBreakpointTest(breakpointManager, next); | 351 InspectorTest.finishBreakpointTest(breakpointManager, next); |
332 } | 352 } |
333 } | 353 } |
334 }, | 354 }, |
335 ]); | 355 ]); |
336 }; | 356 }; |
337 | 357 |
338 </script> | 358 </script> |
339 | 359 |
340 </head> | 360 </head> |
341 | 361 |
342 <body onload="runTest()"> | 362 <body onload="runTest()"> |
343 <p>Tests BreakpointManager class.</p> | 363 <p>Tests BreakpointManager class.</p> |
344 | 364 |
345 </body> | 365 </body> |
346 </html> | 366 </html> |
OLD | NEW |