| 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 | 4 |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var workspace; | 9 var workspace; |
| 10 var uiSourceCodes = {}; | 10 var uiSourceCodes = {}; |
| 11 var mockTarget = { | 11 var mockTarget = { |
| 12 | 12 |
| 13 id: function() | 13 id: function() |
| 14 { | 14 { |
| 15 return 1; | 15 return 1; |
| 16 } | 16 } |
| 17 }; | 17 }; |
| 18 var targetManager = { | 18 var targetManager = new WebInspector.TargetManager(); |
| 19 targets: function () { return [mockTarget]}, | 19 targetManager._targets.push(mockTarget); |
| 20 observeTargets: function() {} | |
| 21 } | |
| 22 | 20 |
| 23 var defaultMapping = { | 21 var defaultMapping = { |
| 24 rawLocationToUILocation: function(rawLocation) | 22 rawLocationToUILocation: function(rawLocation) |
| 25 { | 23 { |
| 26 return uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.li
neNumber, 0); | 24 return uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.li
neNumber, 0); |
| 27 }, | 25 }, |
| 28 | 26 |
| 29 uiLocationToRawLocation: function(uiSourceCode, lineNumber) | 27 uiLocationToRawLocation: function(uiSourceCode, lineNumber) |
| 30 { | 28 { |
| 31 if (!uiSourceCodes[uiSourceCode.url]) | 29 if (!uiSourceCodes[uiSourceCode.url]) |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 204 |
| 207 disableSourceMapping: function(sourceMapping) | 205 disableSourceMapping: function(sourceMapping) |
| 208 { | 206 { |
| 209 sourceMapping._disabled = true; | 207 sourceMapping._disabled = true; |
| 210 for (var scriptId in this._scripts) | 208 for (var scriptId in this._scripts) |
| 211 this._scripts[scriptId].updateLocations(); | 209 this._scripts[scriptId].updateLocations(); |
| 212 } | 210 } |
| 213 } | 211 } |
| 214 DebuggerModelMock.prototype.__proto__ = WebInspector.Object.prototype; | 212 DebuggerModelMock.prototype.__proto__ = WebInspector.Object.prototype; |
| 215 | 213 |
| 216 var dummySetting = { | |
| 217 get: function() { return []; }, | |
| 218 set: function(breakpoints) { } | |
| 219 }; | |
| 220 | |
| 221 function resetWorkspace(breakpointManager) | 214 function resetWorkspace(breakpointManager) |
| 222 { | 215 { |
| 223 InspectorTest.addResult(" Resetting workspace."); | 216 InspectorTest.addResult(" Resetting workspace."); |
| 224 breakpointManager._networkWorkspaceBinding.reset(); | 217 breakpointManager._networkWorkspaceBinding.reset(); |
| 225 breakpointManager._debuggerProjectDelegate.reset(); | 218 breakpointManager._debuggerProjectDelegate.reset(); |
| 226 } | 219 } |
| 227 | 220 |
| 228 function breakpointAdded(event) | 221 function breakpointAdded(event) |
| 229 { | 222 { |
| 230 var breakpoint = event.data.breakpoint; | 223 var breakpoint = event.data.breakpoint; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 persistentBreakpoints = persistentBreakpoints || []; | 280 persistentBreakpoints = persistentBreakpoints || []; |
| 288 var setting = { | 281 var setting = { |
| 289 get: function() { return persistentBreakpoints; }, | 282 get: function() { return persistentBreakpoints; }, |
| 290 set: function(breakpoints) { persistentBreakpoints = breakpoints; } | 283 set: function(breakpoints) { persistentBreakpoints = breakpoints; } |
| 291 }; | 284 }; |
| 292 | 285 |
| 293 var sourceMapping = sourceMapping || defaultMapping; | 286 var sourceMapping = sourceMapping || defaultMapping; |
| 294 var debuggerModel = new DebuggerModelMock(sourceMapping); | 287 var debuggerModel = new DebuggerModelMock(sourceMapping); |
| 295 workspace = new WebInspector.Workspace(); | 288 workspace = new WebInspector.Workspace(); |
| 296 var breakpointManager = new WebInspector.BreakpointManager(setting, work
space, targetManager); | 289 var breakpointManager = new WebInspector.BreakpointManager(setting, work
space, targetManager); |
| 297 mockTarget.debuggerModel = debuggerModel; | |
| 298 breakpointManager.targetAdded(mockTarget); | |
| 299 breakpointManager._networkWorkspaceBinding = new WebInspector.NetworkWor
kspaceBinding(workspace); | 290 breakpointManager._networkWorkspaceBinding = new WebInspector.NetworkWor
kspaceBinding(workspace); |
| 300 breakpointManager._debuggerProjectDelegate = new WebInspector.DebuggerPr
ojectDelegate(workspace, "debugger:", WebInspector.projectTypes.Debugger); | 291 breakpointManager._debuggerProjectDelegate = new WebInspector.DebuggerPr
ojectDelegate(workspace, "debugger:", WebInspector.projectTypes.Debugger); |
| 301 breakpointManager.addEventListener(WebInspector.BreakpointManager.Events
.BreakpointAdded, breakpointAdded); | 292 breakpointManager.addEventListener(WebInspector.BreakpointManager.Events
.BreakpointAdded, breakpointAdded); |
| 302 breakpointManager.addEventListener(WebInspector.BreakpointManager.Events
.BreakpointRemoved, breakpointRemoved); | 293 breakpointManager.addEventListener(WebInspector.BreakpointManager.Events
.BreakpointRemoved, breakpointRemoved); |
| 303 InspectorTest.addResult(" Created breakpoints manager"); | 294 InspectorTest.addResult(" Created breakpoints manager"); |
| 304 dumpBreakpointStorage(breakpointManager); | 295 dumpBreakpointStorage(breakpointManager); |
| 305 return breakpointManager; | 296 return breakpointManager; |
| 306 } | 297 } |
| 307 | 298 |
| 308 function setBreakpoint(breakpointManager, uiSourceCode, lineNumber, columnNu
mber, condition, enabled) | 299 function setBreakpoint(breakpointManager, uiSourceCode, lineNumber, columnNu
mber, condition, enabled) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } | 342 } |
| 352 if (lastUISourceCode) | 343 if (lastUISourceCode) |
| 353 dumpLocations(lastUISourceCode, locations); | 344 dumpLocations(lastUISourceCode, locations); |
| 354 } | 345 } |
| 355 | 346 |
| 356 function resetBreakpointManager(breakpointManager, next) | 347 function resetBreakpointManager(breakpointManager, next) |
| 357 { | 348 { |
| 358 dumpBreakpointStorage(breakpointManager); | 349 dumpBreakpointStorage(breakpointManager); |
| 359 InspectorTest.addResult(" Resetting breakpoint manager"); | 350 InspectorTest.addResult(" Resetting breakpoint manager"); |
| 360 breakpointManager.removeAllBreakpoints(); | 351 breakpointManager.removeAllBreakpoints(); |
| 361 breakpointManager.removeProvisionalBreakpointsForTest(mockTarget); | 352 breakpointManager.removeProvisionalBreakpointsForTest(); |
| 362 uiSourceCodes = {}; | 353 uiSourceCodes = {}; |
| 363 next(); | 354 next(); |
| 364 } | 355 } |
| 365 | 356 |
| 366 InspectorTest.runTestSuite([ | 357 InspectorTest.runTestSuite([ |
| 367 function testSetBreakpoint(next) | 358 function testSetBreakpoint(next) |
| 368 { | 359 { |
| 369 var breakpointManager = createBreakpointManager(); | 360 var breakpointManager = createBreakpointManager(); |
| 370 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 361 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 371 setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); | 362 setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | 777 |
| 787 </script> | 778 </script> |
| 788 | 779 |
| 789 </head> | 780 </head> |
| 790 | 781 |
| 791 <body onload="runTest()"> | 782 <body onload="runTest()"> |
| 792 <p>Tests BreakpointManager class.</p> | 783 <p>Tests BreakpointManager class.</p> |
| 793 | 784 |
| 794 </body> | 785 </body> |
| 795 </html> | 786 </html> |
| OLD | NEW |