| 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="../../../http/tests/inspector/workspace-test.js"></script> |
| 5 <script src="breakpoint-manager.js"></script> | 5 <script src="breakpoint-manager.js"></script> |
| 6 <script> | 6 <script> |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var mockTarget; | 9 var mockTarget; |
| 10 var lastTargetId = 0; | 10 var lastTargetId = 0; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 window.setBreakpointCallback = step3.bind(this); | 161 window.setBreakpointCallback = step3.bind(this); |
| 162 } | 162 } |
| 163 | 163 |
| 164 function step3() | 164 function step3() |
| 165 { | 165 { |
| 166 InspectorTest.dumpBreakpointLocations(breakpointManager); | 166 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 167 InspectorTest.addResult("\n Navigating back to A."); | 167 InspectorTest.addResult("\n Navigating back to A."); |
| 168 resetWorkspace(breakpointManager); | 168 resetWorkspace(breakpointManager); |
| 169 InspectorTest.addResult(" Resolving provisional breakpoint."); | 169 InspectorTest.addResult(" Resolving provisional breakpoint."); |
| 170 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); | 170 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); |
| 171 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI
nspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0)); | 171 mockTarget.debuggerModel._breakpointResolved("a.js:10", new SDK.
DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0)); |
| 172 addUISourceCode(breakpointManager, "a.js", false, true); | 172 addUISourceCode(breakpointManager, "a.js", false, true); |
| 173 InspectorTest.finishBreakpointTest(breakpointManager, next); | 173 InspectorTest.finishBreakpointTest(breakpointManager, next); |
| 174 } | 174 } |
| 175 }, | 175 }, |
| 176 | 176 |
| 177 function testSourceMapping(next) | 177 function testSourceMapping(next) |
| 178 { | 178 { |
| 179 var shiftingMapping = { | 179 var shiftingMapping = { |
| 180 rawLocationToUILocation: function(rawLocation) | 180 rawLocationToUILocation: function(rawLocation) |
| 181 { | 181 { |
| 182 if (this._disabled) | 182 if (this._disabled) |
| 183 return null; | 183 return null; |
| 184 return InspectorTest.uiSourceCodes[rawLocation.scriptId].uiL
ocation(rawLocation.lineNumber + 10, 0); | 184 return InspectorTest.uiSourceCodes[rawLocation.scriptId].uiL
ocation(rawLocation.lineNumber + 10, 0); |
| 185 }, | 185 }, |
| 186 | 186 |
| 187 uiLocationToRawLocation: function(uiSourceCode, lineNumber) | 187 uiLocationToRawLocation: function(uiSourceCode, lineNumber) |
| 188 { | 188 { |
| 189 return new WebInspector.DebuggerModel.Location(mockTarget.de
buggerModel, uiSourceCode.url(), lineNumber - 10, 0); | 189 return new SDK.DebuggerModel.Location(mockTarget.debuggerMod
el, uiSourceCode.url(), lineNumber - 10, 0); |
| 190 }, | 190 }, |
| 191 | 191 |
| 192 isIdentity: function() | 192 isIdentity: function() |
| 193 { | 193 { |
| 194 return false; | 194 return false; |
| 195 } | 195 } |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 // Source mapping will shift everything 10 lines ahead so that break
point 1 clashes with breakpoint 2. | 198 // Source mapping will shift everything 10 lines ahead so that break
point 1 clashes with breakpoint 2. |
| 199 var serializedBreakpoints = []; | 199 var serializedBreakpoints = []; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 230 var breakpointManager = createBreakpointManager(serializedBreakpoint
s); | 230 var breakpointManager = createBreakpointManager(serializedBreakpoint
s); |
| 231 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 231 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 232 window.setBreakpointCallback = step2.bind(this); | 232 window.setBreakpointCallback = step2.bind(this); |
| 233 | 233 |
| 234 function step2() | 234 function step2() |
| 235 { | 235 { |
| 236 InspectorTest.dumpBreakpointLocations(breakpointManager); | 236 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 237 resetWorkspace(breakpointManager); | 237 resetWorkspace(breakpointManager); |
| 238 InspectorTest.addResult(" Resolving provisional breakpoint."); | 238 InspectorTest.addResult(" Resolving provisional breakpoint."); |
| 239 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); | 239 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); |
| 240 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI
nspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 11, 0)); | 240 mockTarget.debuggerModel._breakpointResolved("a.js:10", new SDK.
DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 11, 0)); |
| 241 var breakpoints = breakpointManager.allBreakpoints(); | 241 var breakpoints = breakpointManager.allBreakpoints(); |
| 242 InspectorTest.assertEquals(1, breakpoints.length, "Exactly one p
rovisional breakpoint should be registered in breakpoint manager."); | 242 InspectorTest.assertEquals(1, breakpoints.length, "Exactly one p
rovisional breakpoint should be registered in breakpoint manager."); |
| 243 InspectorTest.finishBreakpointTest(breakpointManager, next); | 243 InspectorTest.finishBreakpointTest(breakpointManager, next); |
| 244 } | 244 } |
| 245 }, | 245 }, |
| 246 | 246 |
| 247 function testSourceMappingReload(next) | 247 function testSourceMappingReload(next) |
| 248 { | 248 { |
| 249 function createSourceMapping(uiSourceCodeA, uiSourceCodeB) | 249 function createSourceMapping(uiSourceCodeA, uiSourceCodeB) |
| 250 { | 250 { |
| 251 var mapping = { | 251 var mapping = { |
| 252 rawLocationToUILocation: function(rawLocation) | 252 rawLocationToUILocation: function(rawLocation) |
| 253 { | 253 { |
| 254 if (this._disabled) | 254 if (this._disabled) |
| 255 return null; | 255 return null; |
| 256 return uiSourceCodeB.uiLocation(rawLocation.lineNumber +
10, 0); | 256 return uiSourceCodeB.uiLocation(rawLocation.lineNumber +
10, 0); |
| 257 }, | 257 }, |
| 258 | 258 |
| 259 uiLocationToRawLocation: function(uiSourceCode, lineNumber) | 259 uiLocationToRawLocation: function(uiSourceCode, lineNumber) |
| 260 { | 260 { |
| 261 return new WebInspector.DebuggerModel.Location(mockTarge
t.debuggerModel, uiSourceCodeA.url(), lineNumber - 10, 0); | 261 return new SDK.DebuggerModel.Location(mockTarget.debugge
rModel, uiSourceCodeA.url(), lineNumber - 10, 0); |
| 262 }, | 262 }, |
| 263 | 263 |
| 264 isIdentity: function() | 264 isIdentity: function() |
| 265 { | 265 { |
| 266 return false; | 266 return false; |
| 267 } | 267 } |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 return mapping; | 270 return mapping; |
| 271 } | 271 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 283 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, br
eakpointActionsPerformedBeforeReload.bind(this)); | 283 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, br
eakpointActionsPerformedBeforeReload.bind(this)); |
| 284 | 284 |
| 285 function breakpointActionsPerformedBeforeReload() | 285 function breakpointActionsPerformedBeforeReload() |
| 286 { | 286 { |
| 287 InspectorTest.dumpBreakpointLocations(breakpointManager); | 287 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 288 InspectorTest.addResult("\n Reloading:"); | 288 InspectorTest.addResult("\n Reloading:"); |
| 289 resetWorkspace(breakpointManager); | 289 resetWorkspace(breakpointManager); |
| 290 | 290 |
| 291 InspectorTest.addResult("\n Adding files:"); | 291 InspectorTest.addResult("\n Adding files:"); |
| 292 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); | 292 InspectorTest.addScript(mockTarget, breakpointManager, "a.js"); |
| 293 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI
nspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0)); | 293 mockTarget.debuggerModel._breakpointResolved("a.js:10", new SDK.
DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0)); |
| 294 uiSourceCodeA = addUISourceCode(breakpointManager, "a.js", false
, true); | 294 uiSourceCodeA = addUISourceCode(breakpointManager, "a.js", false
, true); |
| 295 uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true,
true); | 295 uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true,
true); |
| 296 | 296 |
| 297 InspectorTest.addResult("\n Toggling source mapping."); | 297 InspectorTest.addResult("\n Toggling source mapping."); |
| 298 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceC
odeB); | 298 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceC
odeB); |
| 299 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); | 299 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); |
| 300 breakpointManager._debuggerWorkspaceBinding.setSourceMapping(moc
kTarget, uiSourceCodeB, sourceMapping); | 300 breakpointManager._debuggerWorkspaceBinding.setSourceMapping(moc
kTarget, uiSourceCodeB, sourceMapping); |
| 301 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager
, breakpointActionsPerformed.bind(this)); | 301 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager
, breakpointActionsPerformed.bind(this)); |
| 302 } | 302 } |
| 303 | 303 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 319 function step2() | 319 function step2() |
| 320 { | 320 { |
| 321 InspectorTest.dumpBreakpointLocations(breakpointManager); | 321 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 322 InspectorTest.addResult("\n Reloading:"); | 322 InspectorTest.addResult("\n Reloading:"); |
| 323 resetWorkspace(breakpointManager); | 323 resetWorkspace(breakpointManager); |
| 324 | 324 |
| 325 InspectorTest.addResult("\n Adding file with script:"); | 325 InspectorTest.addResult("\n Adding file with script:"); |
| 326 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 326 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 327 | 327 |
| 328 InspectorTest.addResult("\n Emulating breakpoint resolved event
:"); | 328 InspectorTest.addResult("\n Emulating breakpoint resolved event
:"); |
| 329 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI
nspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0)); | 329 mockTarget.debuggerModel._breakpointResolved("a.js:10", new SDK.
DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0)); |
| 330 | 330 |
| 331 InspectorTest.addResult("\n Make sure we don't do any unnecessa
ry breakpoint actions:"); | 331 InspectorTest.addResult("\n Make sure we don't do any unnecessa
ry breakpoint actions:"); |
| 332 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager
, breakpointActionsPerformed.bind(this)); | 332 InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager
, breakpointActionsPerformed.bind(this)); |
| 333 | 333 |
| 334 function breakpointActionsPerformed() | 334 function breakpointActionsPerformed() |
| 335 { | 335 { |
| 336 InspectorTest.finishBreakpointTest(breakpointManager, next); | 336 InspectorTest.finishBreakpointTest(breakpointManager, next); |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 }, | 339 }, |
| 340 ]); | 340 ]); |
| 341 }; | 341 }; |
| 342 </script> | 342 </script> |
| 343 | 343 |
| 344 </head> | 344 </head> |
| 345 | 345 |
| 346 <body onload="runTest()"> | 346 <body onload="runTest()"> |
| 347 <p>Tests BreakpointManager class.</p> | 347 <p>Tests BreakpointManager class.</p> |
| 348 | 348 |
| 349 </body> | 349 </body> |
| 350 </html> | 350 </html> |
| OLD | NEW |