Chromium Code Reviews| 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="breakpoint-manager.js"></script> | |
| 4 | 5 |
| 5 <script> | 6 <script> |
| 6 | 7 |
| 7 function test() | 8 function test() |
| 8 { | 9 { |
| 9 var workspace; | |
| 10 var uiSourceCodes = {}; | |
| 11 var mockTarget = { | 10 var mockTarget = { |
| 12 | 11 |
| 13 id: function() | 12 id: function() |
| 14 { | 13 { |
| 15 return 1; | 14 return 1; |
| 16 } | 15 } |
| 17 }; | 16 }; |
| 17 InspectorTest.initializeDefaultMappingOn(mockTarget); | |
| 18 var targetManager = new WebInspector.TargetManager(); | 18 var targetManager = new WebInspector.TargetManager(); |
| 19 targetManager._targets.push(mockTarget); | 19 targetManager._targets.push(mockTarget); |
| 20 | 20 |
| 21 var defaultMapping = { | |
| 22 rawLocationToUILocation: function(rawLocation) | |
| 23 { | |
| 24 return uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.li neNumber, 0); | |
| 25 }, | |
| 26 | |
| 27 uiLocationToRawLocation: function(uiSourceCode, lineNumber) | |
| 28 { | |
| 29 if (!uiSourceCodes[uiSourceCode.url]) | |
| 30 return null; | |
| 31 return new WebInspector.DebuggerModel.Location(mockTarget, uiSourceC ode.url, lineNumber, 0); | |
| 32 }, | |
| 33 | |
| 34 isIdentity: function() | |
| 35 { | |
| 36 return true; | |
| 37 } | |
| 38 }; | |
| 39 | |
| 40 var shiftingMapping = { | 21 var shiftingMapping = { |
| 41 rawLocationToUILocation: function(rawLocation) | 22 rawLocationToUILocation: function(rawLocation) |
| 42 { | 23 { |
| 43 if (this._disabled) | 24 if (this._disabled) |
| 44 return null; | 25 return null; |
| 45 return uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.li neNumber + 10, 0); | 26 return InspectorTest.uiSourceCodes[rawLocation.scriptId].uiLocation( rawLocation.lineNumber + 10, 0); |
| 46 }, | 27 }, |
| 47 | 28 |
| 48 uiLocationToRawLocation: function(uiSourceCode, lineNumber) | 29 uiLocationToRawLocation: function(uiSourceCode, lineNumber) |
| 49 { | 30 { |
| 50 return new WebInspector.DebuggerModel.Location(mockTarget, uiSourceC ode.url, lineNumber - 10, 0); | 31 return new WebInspector.DebuggerModel.Location(mockTarget, uiSourceC ode.url, lineNumber - 10, 0); |
| 51 }, | 32 }, |
| 52 | 33 |
| 53 isIdentity: function() | 34 isIdentity: function() |
| 54 { | 35 { |
| 55 return false; | 36 return false; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 73 | 54 |
| 74 isIdentity: function() | 55 isIdentity: function() |
| 75 { | 56 { |
| 76 return false; | 57 return false; |
| 77 } | 58 } |
| 78 }; | 59 }; |
| 79 | 60 |
| 80 return mapping; | 61 return mapping; |
| 81 } | 62 } |
| 82 | 63 |
| 83 function DebuggerModelMock(sourceMapping) | |
| 84 { | |
| 85 mockTarget.debuggerModel = this; | |
| 86 this._breakpointResolvedEventTarget = new WebInspector.Object(); | |
| 87 this._scripts = {}; | |
| 88 this._sourceMapping = sourceMapping; | |
| 89 this._breakpoints = {}; | |
| 90 } | |
| 91 | |
| 92 DebuggerModelMock.prototype = { | |
| 93 target: function() | |
| 94 { | |
| 95 return mockTarget; | |
| 96 }, | |
| 97 | |
| 98 _addScript: function(scriptId, url) | |
| 99 { | |
| 100 this._scripts[scriptId] = new WebInspector.Script(mockTarget, script Id, url); | |
| 101 this._scripts[scriptId].pushSourceMapping(this._sourceMapping); | |
| 102 }, | |
| 103 | |
| 104 _scriptForURL: function(url) | |
| 105 { | |
| 106 for (var scriptId in this._scripts) { | |
| 107 var script = this._scripts[scriptId]; | |
| 108 if (script.sourceURL === url) | |
| 109 return script; | |
| 110 } | |
| 111 }, | |
| 112 | |
| 113 _scheduleSetBeakpointCallback: function(callback, breakpointId, location s) | |
| 114 { | |
| 115 setTimeout(innerCallback.bind(this), 0); | |
| 116 | |
| 117 function innerCallback() | |
| 118 { | |
| 119 if (callback) | |
| 120 callback(breakpointId, locations); | |
| 121 if (window.setBreakpointCallback) { | |
| 122 var savedCallback = window.setBreakpointCallback; | |
| 123 delete window.setBreakpointCallback; | |
| 124 savedCallback(); | |
| 125 } | |
| 126 } | |
| 127 }, | |
| 128 | |
| 129 setBreakpointByURL: function(url, lineNumber, columnNumber, condition, c allback) | |
| 130 { | |
| 131 InspectorTest.addResult(" debuggerModel.setBreakpoint(" + [url, l ineNumber, condition].join(":") + ")"); | |
| 132 | |
| 133 var breakpointId = url + ":" + lineNumber; | |
| 134 if (this._breakpoints[breakpointId]) { | |
| 135 this._scheduleSetBeakpointCallback(callback, null); | |
| 136 return; | |
| 137 } | |
| 138 this._breakpoints[breakpointId] = true; | |
| 139 | |
| 140 var locations = []; | |
| 141 var script = this._scriptForURL(url); | |
| 142 if (script) { | |
| 143 var location = new WebInspector.DebuggerModel.Location(mockTarge t, script.scriptId, lineNumber, 0); | |
| 144 locations.push(location); | |
| 145 } | |
| 146 | |
| 147 this._scheduleSetBeakpointCallback(callback, breakpointId, locations ); | |
| 148 }, | |
| 149 | |
| 150 setBreakpointByScriptLocation: function(location, condition, callback) | |
| 151 { | |
| 152 InspectorTest.addResult(" debuggerModel.setBreakpoint(" + [locati on.scriptId, location.lineNumber, condition].join(":") + ")"); | |
| 153 | |
| 154 var breakpointId = location.scriptId + ":" + location.lineNumber; | |
| 155 if (this._breakpoints[breakpointId]) { | |
| 156 this._scheduleSetBeakpointCallback(callback, null); | |
| 157 return; | |
| 158 } | |
| 159 this._breakpoints[breakpointId] = true; | |
| 160 | |
| 161 if (location.lineNumber >= 2000) { | |
| 162 this._scheduleSetBeakpointCallback(callback, breakpointId, []); | |
| 163 return; | |
| 164 } | |
| 165 if (location.lineNumber >= 1000) { | |
| 166 var shiftedLocation = new WebInspector.DebuggerModel.Location(mo ckTarget, location.scriptId, location.lineNumber + 10, location.columnNumber); | |
| 167 this._scheduleSetBeakpointCallback(callback, breakpointId, [shif tedLocation]); | |
| 168 return; | |
| 169 } | |
| 170 | |
| 171 this._scheduleSetBeakpointCallback(callback, breakpointId, [WebInspe ctor.DebuggerModel.Location.fromPayload(mockTarget, location)]); | |
| 172 }, | |
| 173 | |
| 174 removeBreakpoint: function(breakpointId, callback) | |
| 175 { | |
| 176 InspectorTest.addResult(" debuggerModel.removeBreakpoint(" + brea kpointId + ")"); | |
| 177 delete this._breakpoints[breakpointId]; | |
| 178 if (callback) | |
| 179 callback(); | |
| 180 }, | |
| 181 | |
| 182 setBreakpointsActive: function() { }, | |
| 183 | |
| 184 createLiveLocation: function(rawLocation, updateDelegate) | |
| 185 { | |
| 186 return this._scripts[rawLocation.scriptId].createLiveLocation(rawLoc ation, updateDelegate); | |
| 187 }, | |
| 188 | |
| 189 scriptForId: function(scriptId) | |
| 190 { | |
| 191 return this._scripts[scriptId]; | |
| 192 }, | |
| 193 | |
| 194 reset: function() | |
| 195 { | |
| 196 InspectorTest.addResult(" Resetting debugger."); | |
| 197 this._scripts = {}; | |
| 198 }, | |
| 199 | |
| 200 pushSourceMapping: function(sourceMapping) | |
| 201 { | |
| 202 for (var scriptId in this._scripts) | |
| 203 this._scripts[scriptId].pushSourceMapping(sourceMapping); | |
| 204 }, | |
| 205 | |
| 206 disableSourceMapping: function(sourceMapping) | |
| 207 { | |
| 208 sourceMapping._disabled = true; | |
| 209 for (var scriptId in this._scripts) | |
| 210 this._scripts[scriptId].updateLocations(); | |
| 211 }, | |
| 212 | |
| 213 addBreakpointListener: function(breakpointId, listener, thisObject) | |
| 214 { | |
| 215 this._breakpointResolvedEventTarget.addEventListener(breakpointId, l istener, thisObject) | |
| 216 }, | |
| 217 | |
| 218 removeBreakpointListener: function(breakpointId, listener, thisObject) | |
| 219 { | |
| 220 this._breakpointResolvedEventTarget.removeEventListener(breakpointId , listener, thisObject); | |
| 221 }, | |
| 222 | |
| 223 _breakpointResolved: function(breakpointId, location) | |
| 224 { | |
| 225 this._breakpointResolvedEventTarget.dispatchEventToListeners(breakpo intId, location); | |
| 226 } | |
| 227 } | |
| 228 DebuggerModelMock.prototype.__proto__ = WebInspector.Object.prototype; | |
| 229 | |
| 230 function resetWorkspace(breakpointManager) | 64 function resetWorkspace(breakpointManager) |
| 231 { | 65 { |
| 232 InspectorTest.addResult(" Resetting workspace."); | 66 InspectorTest.addResult(" Resetting workspace."); |
| 233 breakpointManager._networkWorkspaceBinding.reset(); | 67 breakpointManager._networkWorkspaceBinding.reset(); |
| 234 breakpointManager._debuggerProjectDelegate.reset(); | 68 breakpointManager._debuggerProjectDelegate.reset(); |
| 235 } | 69 } |
| 236 | 70 |
| 237 function breakpointAdded(event) | |
| 238 { | |
| 239 var breakpoint = event.data.breakpoint; | |
| 240 var uiLocation = event.data.uiLocation; | |
| 241 InspectorTest.addResult(" breakpointAdded(" + [uiLocation.uiSourceCod e.originURL(), uiLocation.lineNumber, uiLocation.columnNumber, breakpoint.condit ion(), breakpoint.enabled()].join(", ") + ")"); | |
| 242 } | |
| 243 | |
| 244 function breakpointRemoved(event) | |
| 245 { | |
| 246 var uiLocation = event.data.uiLocation; | |
| 247 InspectorTest.addResult(" breakpointRemoved(" + [uiLocation.uiSourceC ode.originURL(), uiLocation.lineNumber, uiLocation.columnNumber].join(", ") + ") "); | |
| 248 } | |
| 249 | |
| 250 InspectorTest.addSniffer(WebInspector.Script.prototype, "createLiveLocation" , function(rawLocation) | |
| 251 { | |
| 252 InspectorTest.addResult(" Location created: " + rawLocation.scriptId + ":" + rawLocation.lineNumber); | |
| 253 }, true); | |
| 254 InspectorTest.addSniffer(WebInspector.Script.Location.prototype, "dispose", function() | |
| 255 { | |
| 256 InspectorTest.addResult(" Location disposed: " + this._rawLocation.sc riptId + ":" + this._rawLocation.lineNumber); | |
| 257 }, true); | |
| 258 | |
| 259 function addUISourceCode(breakpointManager, url, doNotSetSourceMapping, doNo tAddScript) | |
| 260 { | |
| 261 if (!doNotAddScript) | |
| 262 mockTarget.debuggerModel._addScript(url, url); | |
| 263 InspectorTest.addResult(" Adding UISourceCode: " + url); | |
| 264 var contentProvider = new WebInspector.StaticContentProvider(WebInspecto r.resourceTypes.Script, ""); | |
| 265 var uiSourceCode = breakpointManager._networkWorkspaceBinding.addFileFor URL(url, contentProvider); | |
| 266 uiSourceCodes[url] = uiSourceCode; | |
| 267 if (!doNotSetSourceMapping) | |
| 268 uiSourceCode.setSourceMappingForTarget(mockTarget, defaultMapping); | |
| 269 return uiSourceCode; | |
| 270 } | |
| 271 | |
| 272 function addTemporaryUISourceCode(breakpointManager, url) | 71 function addTemporaryUISourceCode(breakpointManager, url) |
| 273 { | 72 { |
| 274 mockTarget.debuggerModel._addScript(url, url); | 73 mockTarget.debuggerModel._addScript(url, url); |
| 275 InspectorTest.addResult(" Adding temporary UISourceCode: " + url); | 74 InspectorTest.addResult(" Adding temporary UISourceCode: " + url); |
| 276 var contentProvider = new WebInspector.StaticContentProvider(WebInspecto r.resourceTypes.Script, ""); | 75 var contentProvider = new WebInspector.StaticContentProvider(WebInspecto r.resourceTypes.Script, ""); |
| 277 var path = breakpointManager._debuggerProjectDelegate.addContentProvider ("", url, url, contentProvider); | 76 var path = breakpointManager._debuggerProjectDelegate.addContentProvider ("", url, url, contentProvider); |
| 278 var uiSourceCode = workspace.uiSourceCode("debugger:", path); | 77 var uiSourceCode = breakpointManager._workspace.uiSourceCode("debugger:" , path); |
| 279 uiSourceCode.setSourceMappingForTarget(mockTarget, defaultMapping); | 78 uiSourceCode.setSourceMappingForTarget(mockTarget, mockTarget.defaultMap ping); |
| 280 uiSourceCodes[url] = uiSourceCode; | 79 InspectorTest.uiSourceCodes[url] = uiSourceCode; |
| 281 return uiSourceCode; | 80 return uiSourceCode; |
| 282 } | 81 } |
| 283 | 82 |
| 284 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) | 83 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) |
| 285 { | 84 { |
| 286 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition : condition, enabled: enabled }; | 85 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition : condition, enabled: enabled }; |
| 287 } | 86 } |
| 288 | 87 |
| 88 InspectorTest.setupLiveLocationSniffers(); | |
| 289 var serializedBreakpoints = []; | 89 var serializedBreakpoints = []; |
| 290 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true)) ; | 90 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true)) ; |
| 291 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", false)); | 91 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", false)); |
| 292 serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true)); | 92 serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true)); |
| 293 | 93 |
| 294 function createBreakpointManager(persistentBreakpoints, sourceMapping) | 94 var addUISourceCode = InspectorTest.addUISourceCode.bind(null, mockTarget); |
| 295 { | 95 var createBreakpointManager = InspectorTest.createBreakpointManager.bind(nul l, targetManager); |
| 296 persistentBreakpoints = persistentBreakpoints || []; | |
| 297 var setting = { | |
| 298 get: function() { return persistentBreakpoints; }, | |
| 299 set: function(breakpoints) { persistentBreakpoints = breakpoints; } | |
| 300 }; | |
| 301 | |
| 302 var sourceMapping = sourceMapping || defaultMapping; | |
| 303 var debuggerModel = new DebuggerModelMock(sourceMapping); | |
| 304 workspace = new WebInspector.Workspace(); | |
| 305 var breakpointManager = new WebInspector.BreakpointManager(setting, work space, targetManager); | |
| 306 breakpointManager._networkWorkspaceBinding = new WebInspector.NetworkWor kspaceBinding(workspace); | |
| 307 breakpointManager._debuggerProjectDelegate = new WebInspector.DebuggerPr ojectDelegate(workspace, "debugger:", WebInspector.projectTypes.Debugger); | |
| 308 breakpointManager.addEventListener(WebInspector.BreakpointManager.Events .BreakpointAdded, breakpointAdded); | |
| 309 breakpointManager.addEventListener(WebInspector.BreakpointManager.Events .BreakpointRemoved, breakpointRemoved); | |
| 310 InspectorTest.addResult(" Created breakpoints manager"); | |
| 311 dumpBreakpointStorage(breakpointManager); | |
| 312 return breakpointManager; | |
| 313 } | |
| 314 | |
| 315 function setBreakpoint(breakpointManager, uiSourceCode, lineNumber, columnNu mber, condition, enabled) | |
| 316 { | |
| 317 InspectorTest.addResult(" Setting breakpoint at " + uiSourceCode.origin URL() + ":" + lineNumber + ":" + columnNumber + " enabled:" + enabled + " condit ion:" + condition); | |
| 318 return breakpointManager.setBreakpoint(uiSourceCode, lineNumber, columnN umber, condition, enabled); | |
| 319 } | |
| 320 | |
| 321 function removeBreakpoint(breakpointManager, uiSourceCode, lineNumber, colum nNumber) | |
| 322 { | |
| 323 InspectorTest.addResult(" Removing breakpoint at " + uiSourceCode.origi nURL() + ":" + lineNumber + ":" + columnNumber); | |
| 324 breakpointManager.findBreakpoint(uiSourceCode, lineNumber, columnNumber) .remove(); | |
| 325 } | |
| 326 | |
| 327 function dumpBreakpointStorage(breakpointManager) | |
| 328 { | |
| 329 var breakpoints = breakpointManager._storage._setting.get(); | |
| 330 InspectorTest.addResult(" Dumping Storage"); | |
| 331 for (var i = 0; i < breakpoints.length; ++i) | |
| 332 InspectorTest.addResult(" " + breakpoints[i].sourceFileId + ":" + breakpoints[i].lineNumber + " enabled:" + breakpoints[i].enabled + " condition :" + breakpoints[i].condition); | |
| 333 } | |
| 334 | |
| 335 function dumpBreakpointLocations(breakpointManager) | |
| 336 { | |
| 337 var allBreakpointLocations = breakpointManager.allBreakpointLocations(); | |
| 338 InspectorTest.addResult(" Dumping Breakpoint Locations"); | |
| 339 var lastUISourceCode = null; | |
| 340 var locations = []; | |
| 341 | |
| 342 function dumpLocations(uiSourceCode, locations) | |
| 343 { | |
| 344 InspectorTest.addResult(" UISourceCode (url='" + uiSourceCode.url + "', uri='" + uiSourceCode.uri() + "')"); | |
| 345 for (var i = 0; i < locations.length; ++i) | |
| 346 InspectorTest.addResult(" Location: (" + locations[i].lineN umber + ", " + locations[i].columnNumber + ")"); | |
| 347 } | |
| 348 | |
| 349 for (var i = 0; i < allBreakpointLocations.length; ++i) { | |
| 350 var uiLocation = allBreakpointLocations[i].uiLocation; | |
| 351 var uiSourceCode = uiLocation.uiSourceCode; | |
| 352 if (lastUISourceCode && lastUISourceCode != uiSourceCode) { | |
| 353 dumpLocations(uiSourceCode, locations); | |
| 354 locations = []; | |
| 355 } | |
| 356 lastUISourceCode = uiSourceCode; | |
| 357 locations.push(uiLocation); | |
| 358 } | |
| 359 if (lastUISourceCode) | |
| 360 dumpLocations(lastUISourceCode, locations); | |
| 361 } | |
| 362 | |
| 363 function resetBreakpointManager(breakpointManager, next) | |
| 364 { | |
| 365 dumpBreakpointStorage(breakpointManager); | |
| 366 InspectorTest.addResult(" Resetting breakpoint manager"); | |
| 367 breakpointManager.removeAllBreakpoints(); | |
| 368 breakpointManager.removeProvisionalBreakpointsForTest(); | |
| 369 uiSourceCodes = {}; | |
| 370 next(); | |
| 371 } | |
| 372 | 96 |
| 373 InspectorTest.runTestSuite([ | 97 InspectorTest.runTestSuite([ |
| 374 function testSetBreakpoint(next) | 98 function testSetBreakpoint(next) |
| 375 { | 99 { |
| 376 var breakpointManager = createBreakpointManager(); | 100 var breakpointManager = createBreakpointManager(); |
| 377 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 101 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 378 setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); | 102 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, InspectorTest.resetAndFinish.bind(this, breakpointManager, next)); |
| 379 window.setBreakpointCallback = step2.bind(this); | |
| 380 | |
| 381 function step2() | |
| 382 { | |
| 383 dumpBreakpointLocations(breakpointManager); | |
| 384 resetBreakpointManager(breakpointManager, step3); | |
| 385 } | |
| 386 | |
| 387 function step3() | |
| 388 { | |
| 389 dumpBreakpointLocations(breakpointManager); | |
| 390 next(); | |
| 391 } | |
| 392 }, | 103 }, |
| 393 | 104 |
| 394 function testSetDisabledBreakpoint(next) | 105 function testSetDisabledBreakpoint(next) |
| 395 { | 106 { |
| 396 var breakpointManager = createBreakpointManager(); | 107 var breakpointManager = createBreakpointManager(); |
| 397 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 108 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 398 var breakpoint = setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", false); | 109 var breakpoint = InspectorTest.setBreakpoint(breakpointManager, uiSo urceCode, 30, 0, "", false); |
| 399 dumpBreakpointLocations(breakpointManager); | 110 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 400 dumpBreakpointStorage(breakpointManager); | 111 InspectorTest.dumpBreakpointStorage(breakpointManager); |
| 401 InspectorTest.addResult(" Enabling breakpoint"); | 112 InspectorTest.addResult(" Enabling breakpoint"); |
| 402 breakpoint.setEnabled(true); | 113 breakpoint.setEnabled(true); |
| 403 window.setBreakpointCallback = step2.bind(this); | 114 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(thi s, breakpointManager, next); |
| 404 | |
| 405 function step2() | |
| 406 { | |
| 407 dumpBreakpointLocations(breakpointManager); | |
| 408 resetBreakpointManager(breakpointManager, step3); | |
| 409 } | |
| 410 | |
| 411 function step3() | |
| 412 { | |
| 413 dumpBreakpointLocations(breakpointManager); | |
| 414 next(); | |
| 415 } | |
| 416 }, | 115 }, |
| 417 | 116 |
| 418 function testSetConditionalBreakpoint(next) | 117 function testSetConditionalBreakpoint(next) |
| 419 { | 118 { |
| 420 var breakpointManager = createBreakpointManager(); | 119 var breakpointManager = createBreakpointManager(); |
| 421 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 120 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 422 var breakpoint = setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "condition", true); | 121 var breakpoint = InspectorTest.setBreakpoint(breakpointManager, uiSo urceCode, 30, 0, "condition", true, step2); |
| 423 window.setBreakpointCallback = step2.bind(this); | |
| 424 | 122 |
| 425 function step2() | 123 function step2() |
| 426 { | 124 { |
| 427 dumpBreakpointLocations(breakpointManager); | 125 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 428 dumpBreakpointStorage(breakpointManager); | 126 InspectorTest.dumpBreakpointStorage(breakpointManager); |
| 429 InspectorTest.addResult(" Updating condition"); | 127 InspectorTest.addResult(" Updating condition"); |
| 430 breakpoint.setCondition(""); | 128 breakpoint.setCondition(""); |
| 431 window.setBreakpointCallback = step3.bind(this); | 129 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind (this, breakpointManager, next); |
| 432 } | |
| 433 | |
| 434 function step3() | |
| 435 { | |
| 436 dumpBreakpointLocations(breakpointManager); | |
| 437 resetBreakpointManager(breakpointManager, step4); | |
| 438 } | |
| 439 | |
| 440 function step4() | |
| 441 { | |
| 442 dumpBreakpointLocations(breakpointManager); | |
| 443 next(); | |
| 444 } | 130 } |
| 445 }, | 131 }, |
| 446 | 132 |
| 447 function testRestoreBreakpoints(next) | 133 function testRestoreBreakpoints(next) |
| 448 { | 134 { |
| 449 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 135 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 450 addUISourceCode(breakpointManager, "a.js"); | 136 addUISourceCode(breakpointManager, "a.js"); |
| 451 window.setBreakpointCallback = step2.bind(this); | 137 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(thi s, breakpointManager, next); |
| 452 | |
| 453 function step2() | |
| 454 { | |
| 455 dumpBreakpointLocations(breakpointManager); | |
| 456 resetBreakpointManager(breakpointManager, step3); | |
| 457 } | |
| 458 | |
| 459 function step3() | |
| 460 { | |
| 461 dumpBreakpointLocations(breakpointManager); | |
| 462 next(); | |
| 463 } | |
| 464 }, | 138 }, |
| 465 | 139 |
| 466 function testRestoreBreakpointsTwice(next) | 140 function testRestoreBreakpointsTwice(next) |
| 467 { | 141 { |
| 468 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 142 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 469 addUISourceCode(breakpointManager, "a.js"); | 143 addUISourceCode(breakpointManager, "a.js"); |
| 470 addUISourceCode(breakpointManager, "a.js"); | 144 addUISourceCode(breakpointManager, "a.js"); |
| 471 window.setBreakpointCallback = step2.bind(this); | 145 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(thi s, breakpointManager, next); |
| 472 | |
| 473 function step2() | |
| 474 { | |
| 475 dumpBreakpointLocations(breakpointManager); | |
| 476 resetBreakpointManager(breakpointManager, step3); | |
| 477 } | |
| 478 | |
| 479 function step3() | |
| 480 { | |
| 481 dumpBreakpointLocations(breakpointManager); | |
| 482 next(); | |
| 483 } | |
| 484 }, | 146 }, |
| 485 | 147 |
| 486 function testRemoveBreakpoints(next) | 148 function testRemoveBreakpoints(next) |
| 487 { | 149 { |
| 488 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 150 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 489 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 151 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 490 window.setBreakpointCallback = step2.bind(this); | 152 window.setBreakpointCallback = step2.bind(this); |
| 491 | 153 |
| 492 function step2() | 154 function step2() |
| 493 { | 155 { |
| 494 dumpBreakpointLocations(breakpointManager); | 156 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 495 setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); | 157 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step3); |
| 496 window.setBreakpointCallback = step3.bind(this); | |
| 497 } | 158 } |
| 498 | 159 |
| 499 function step3() | 160 function step3() |
| 500 { | 161 { |
| 501 dumpBreakpointLocations(breakpointManager); | 162 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 502 removeBreakpoint(breakpointManager, uiSourceCode, 30, 0); | 163 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 30, 0); |
| 503 removeBreakpoint(breakpointManager, uiSourceCode, 10, 0); | 164 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 10, 0); |
| 504 removeBreakpoint(breakpointManager, uiSourceCode, 20, 0); | 165 InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 20, 0); |
| 505 dumpBreakpointLocations(breakpointManager); | 166 InspectorTest.resetAndFinish(breakpointManager, next); |
| 506 resetBreakpointManager(breakpointManager, step4); | |
| 507 } | |
| 508 | |
| 509 function step4() | |
| 510 { | |
| 511 dumpBreakpointLocations(breakpointManager); | |
| 512 next(); | |
| 513 } | 167 } |
| 514 }, | 168 }, |
| 515 | 169 |
| 516 function testSetBreakpointThatShifts(next) | 170 function testSetBreakpointThatShifts(next) |
| 517 { | 171 { |
| 518 var breakpointManager = createBreakpointManager(); | 172 var breakpointManager = createBreakpointManager(); |
| 519 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 173 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 520 setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true); | 174 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0 , "", true, InspectorTest.resetAndFinish.bind(this, breakpointManager, next)); |
|
vsevik
2014/06/09 15:27:11
Why don't you use it everywhere?
| |
| 521 window.setBreakpointCallback = step2.bind(this); | |
| 522 | |
| 523 function step2() | |
| 524 { | |
| 525 dumpBreakpointLocations(breakpointManager); | |
| 526 resetBreakpointManager(breakpointManager, step3); | |
| 527 } | |
| 528 | |
| 529 function step3() | |
| 530 { | |
| 531 dumpBreakpointLocations(breakpointManager); | |
| 532 next(); | |
| 533 } | |
| 534 }, | 175 }, |
| 535 | 176 |
| 536 function testSetBreakpointThatShiftsTwice(next) | 177 function testSetBreakpointThatShiftsTwice(next) |
| 537 { | 178 { |
| 538 var breakpointManager = createBreakpointManager(); | 179 var breakpointManager = createBreakpointManager(); |
| 539 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 180 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 540 setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true); | 181 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0 , "", true, step2); |
| 541 window.setBreakpointCallback = step2.bind(this); | |
| 542 | 182 |
| 543 function step2() | 183 function step2() |
| 544 { | 184 { |
| 545 dumpBreakpointLocations(breakpointManager); | 185 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 546 setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true ); | 186 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 101 5, 0, "", true, InspectorTest.resetAndFinish.bind(this, breakpointManager, next) ); |
| 547 window.setBreakpointCallback = step3.bind(this); | |
| 548 } | |
| 549 | |
| 550 function step3() | |
| 551 { | |
| 552 dumpBreakpointLocations(breakpointManager); | |
| 553 resetBreakpointManager(breakpointManager, step4); | |
| 554 } | |
| 555 | |
| 556 function step4() | |
| 557 { | |
| 558 dumpBreakpointLocations(breakpointManager); | |
| 559 next(); | |
| 560 } | 187 } |
| 561 }, | 188 }, |
| 562 | 189 |
| 563 function testSetBreakpointOutsideScript(next) | 190 function testSetBreakpointOutsideScript(next) |
| 564 { | 191 { |
| 565 var breakpointManager = createBreakpointManager([]); | 192 var breakpointManager = createBreakpointManager(); |
| 566 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 193 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 567 breakpointManager.setBreakpoint(uiSourceCode, 2500, 0, "", true); | 194 breakpointManager.setBreakpoint(uiSourceCode, 2500, 0, "", true); |
| 568 window.setBreakpointCallback = step2.bind(this); | 195 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(thi s, breakpointManager, next); |
| 569 | |
| 570 function step2() | |
| 571 { | |
| 572 dumpBreakpointLocations(breakpointManager); | |
| 573 resetBreakpointManager(breakpointManager, step3); | |
| 574 } | |
| 575 | |
| 576 function step3() | |
| 577 { | |
| 578 dumpBreakpointLocations(breakpointManager); | |
| 579 next(); | |
| 580 } | |
| 581 }, | 196 }, |
| 582 | 197 |
| 583 function testNavigation(next) | 198 function testNavigation(next) |
| 584 { | 199 { |
| 585 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 200 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 586 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 201 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
| 587 window.setBreakpointCallback = step2.bind(this); | 202 window.setBreakpointCallback = step2.bind(this); |
| 588 | 203 |
| 589 function step2() | 204 function step2() |
| 590 { | 205 { |
| 591 dumpBreakpointLocations(breakpointManager); | 206 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 592 InspectorTest.addResult("\n Navigating to B."); | 207 InspectorTest.addResult("\n Navigating to B."); |
| 593 mockTarget.debuggerModel.reset(); | 208 mockTarget.debuggerModel.reset(); |
| 594 resetWorkspace(breakpointManager); | 209 resetWorkspace(breakpointManager); |
| 595 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js"); | 210 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js"); |
| 596 window.setBreakpointCallback = step3.bind(this); | 211 window.setBreakpointCallback = step3.bind(this); |
| 597 } | 212 } |
| 598 | 213 |
| 599 function step3() | 214 function step3() |
| 600 { | 215 { |
| 601 dumpBreakpointLocations(breakpointManager); | 216 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 602 InspectorTest.addResult("\n Navigating back to A."); | 217 InspectorTest.addResult("\n Navigating back to A."); |
| 603 mockTarget.debuggerModel.reset(); | 218 mockTarget.debuggerModel.reset(); |
| 604 resetWorkspace(breakpointManager); | 219 resetWorkspace(breakpointManager); |
| 605 InspectorTest.addResult(" Resolving provisional breakpoint."); | 220 InspectorTest.addResult(" Resolving provisional breakpoint."); |
| 606 addTemporaryUISourceCode(breakpointManager, "a.js"); | 221 addTemporaryUISourceCode(breakpointManager, "a.js"); |
| 607 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); | 222 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); |
| 608 addUISourceCode(breakpointManager, "a.js"); | 223 addUISourceCode(breakpointManager, "a.js"); |
| 609 window.setBreakpointCallback = step4.bind(this); | 224 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind (this, breakpointManager, next); |
| 610 } | |
| 611 | |
| 612 function step4() | |
| 613 { | |
| 614 dumpBreakpointLocations(breakpointManager); | |
| 615 resetBreakpointManager(breakpointManager, step5); | |
| 616 } | |
| 617 | |
| 618 function step5() | |
| 619 { | |
| 620 dumpBreakpointLocations(breakpointManager); | |
| 621 next(); | |
| 622 } | 225 } |
| 623 }, | 226 }, |
| 624 | 227 |
| 625 function testSourceMapping(next) | 228 function testSourceMapping(next) |
| 626 { | 229 { |
| 627 // Source mapping will shift everthing 10 lines ahead so that breakp oint 1 clashed with breakpoint 2. | 230 // Source mapping will shift everthing 10 lines ahead so that breakp oint 1 clashed with breakpoint 2. |
| 628 var serializedBreakpoints = []; | 231 var serializedBreakpoints = []; |
| 629 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); | 232 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); |
| 630 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", true)); | 233 serializedBreakpoints.push(createBreakpoint("a.js", 20, "", true)); |
| 631 | 234 |
| 632 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 235 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 633 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 236 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
| 634 window.setBreakpointCallback = step2.bind(this); | 237 window.setBreakpointCallback = step2.bind(this); |
| 635 | 238 |
| 636 function step2() | 239 function step2() |
| 637 { | 240 { |
| 638 window.setBreakpointCallback = step3.bind(this); | 241 window.setBreakpointCallback = step3.bind(this); |
| 639 } | 242 } |
| 640 | 243 |
| 641 function step3() | 244 function step3() |
| 642 { | 245 { |
| 643 dumpBreakpointLocations(breakpointManager); | 246 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 644 InspectorTest.addResult("\n Toggling source mapping."); | 247 InspectorTest.addResult("\n Toggling source mapping."); |
| 645 mockTarget.debuggerModel.pushSourceMapping(shiftingMapping); | 248 mockTarget.debuggerModel.pushSourceMapping(shiftingMapping); |
| 646 dumpBreakpointLocations(breakpointManager); | 249 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 647 InspectorTest.addResult("\n Toggling source mapping back."); | 250 InspectorTest.addResult("\n Toggling source mapping back."); |
| 648 mockTarget.debuggerModel.disableSourceMapping(shiftingMapping); | 251 mockTarget.debuggerModel.disableSourceMapping(shiftingMapping); |
| 649 dumpBreakpointLocations(breakpointManager); | 252 InspectorTest.resetAndFinish(breakpointManager, next); |
| 650 resetBreakpointManager(breakpointManager, step4); | |
| 651 } | 253 } |
| 652 | 254 |
| 653 function step4() | |
| 654 { | |
| 655 dumpBreakpointLocations(breakpointManager); | |
| 656 next(); | |
| 657 } | |
| 658 }, | 255 }, |
| 659 | 256 |
| 660 function testProvisionalBreakpointsResolve(next) | 257 function testProvisionalBreakpointsResolve(next) |
| 661 { | 258 { |
| 662 var serializedBreakpoints = []; | 259 var serializedBreakpoints = []; |
| 663 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); | 260 serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar" , true)); |
| 664 | 261 |
| 665 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 262 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 666 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 263 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 667 window.setBreakpointCallback = step2.bind(this); | 264 window.setBreakpointCallback = step2.bind(this); |
| 668 | 265 |
| 669 function step2() | 266 function step2() |
| 670 { | 267 { |
| 671 dumpBreakpointLocations(breakpointManager); | 268 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 672 mockTarget.debuggerModel.reset(); | 269 mockTarget.debuggerModel.reset(); |
| 673 resetWorkspace(breakpointManager); | 270 resetWorkspace(breakpointManager); |
| 674 InspectorTest.addResult(" Resolving provisional breakpoint."); | 271 InspectorTest.addResult(" Resolving provisional breakpoint."); |
| 675 addTemporaryUISourceCode(breakpointManager, "a.js"); | 272 addTemporaryUISourceCode(breakpointManager, "a.js"); |
| 676 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); | 273 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); |
| 677 var breakpoints = breakpointManager.allBreakpoints(); | 274 var breakpoints = breakpointManager.allBreakpoints(); |
| 678 InspectorTest.assertEquals(breakpoints.length, 1, "Exactly one p rovisional breakpoint should be registered in breakpoint manager."); | 275 InspectorTest.assertEquals(breakpoints.length, 1, "Exactly one p rovisional breakpoint should be registered in breakpoint manager."); |
| 679 dumpBreakpointLocations(breakpointManager); | 276 InspectorTest.resetAndFinish(breakpointManager, next); |
| 680 resetBreakpointManager(breakpointManager, step3); | |
| 681 } | |
| 682 | |
| 683 function step3() | |
| 684 { | |
| 685 dumpBreakpointLocations(breakpointManager); | |
| 686 next(); | |
| 687 } | 277 } |
| 688 }, | 278 }, |
| 689 | 279 |
| 690 function testSourceMappingReload(next) | 280 function testSourceMappingReload(next) |
| 691 { | 281 { |
| 692 // Source mapping will shift everthing 10 lines ahead. | 282 // Source mapping will shift everthing 10 lines ahead. |
| 693 var serializedBreakpoints = [createBreakpoint("b.js", 20, "foo == ba r", true)]; | 283 var serializedBreakpoints = [createBreakpoint("b.js", 20, "foo == ba r", true)]; |
| 694 var breakpointManager = createBreakpointManager(serializedBreakpoint s); | 284 var breakpointManager = createBreakpointManager(serializedBreakpoint s); |
| 695 InspectorTest.addResult("\n Adding files:"); | 285 InspectorTest.addResult("\n Adding files:"); |
| 696 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 286 var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
| 697 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); | 287 var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); |
| 698 | 288 |
| 699 InspectorTest.addResult("\n Toggling source mapping."); | 289 InspectorTest.addResult("\n Toggling source mapping."); |
| 700 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceCodeB ); | 290 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceCodeB ); |
| 701 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); | 291 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); |
| 702 window.setBreakpointCallback = provisionalBreakpointSet.bind(this); | 292 window.setBreakpointCallback = provisionalBreakpointSet.bind(this); |
| 703 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMapping); | 293 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMapping); |
| 704 | 294 |
| 705 function provisionalBreakpointSet() | 295 function provisionalBreakpointSet() |
| 706 { | 296 { |
| 707 window.setBreakpointCallback = step2.bind(this); | 297 window.setBreakpointCallback = step2.bind(this); |
| 708 } | 298 } |
| 709 | 299 |
| 710 function step2() | 300 function step2() |
| 711 { | 301 { |
| 712 dumpBreakpointLocations(breakpointManager); | 302 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 713 InspectorTest.addResult("\n Reloading:"); | 303 InspectorTest.addResult("\n Reloading:"); |
| 714 mockTarget.debuggerModel.reset(); | 304 mockTarget.debuggerModel.reset(); |
| 715 resetWorkspace(breakpointManager); | 305 resetWorkspace(breakpointManager); |
| 716 | 306 |
| 717 InspectorTest.addResult("\n Adding files:"); | 307 InspectorTest.addResult("\n Adding files:"); |
| 718 addTemporaryUISourceCode(breakpointManager, "a.js"); | 308 addTemporaryUISourceCode(breakpointManager, "a.js"); |
| 719 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); | 309 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); |
| 720 uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); | 310 uiSourceCodeA = addUISourceCode(breakpointManager, "a.js"); |
| 721 uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); | 311 uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true); |
| 722 | 312 |
| 723 InspectorTest.addResult("\n Toggling source mapping."); | 313 InspectorTest.addResult("\n Toggling source mapping."); |
| 724 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceC odeB); | 314 var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceC odeB); |
| 725 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); | 315 mockTarget.debuggerModel.pushSourceMapping(sourceMapping); |
| 726 window.setBreakpointCallback = provisionalBreakpointSetAfterRelo ad.bind(this); | 316 window.setBreakpointCallback = provisionalBreakpointSetAfterRelo ad.bind(this); |
| 727 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMappin g); | 317 uiSourceCodeB.setSourceMappingForTarget(mockTarget, sourceMappin g); |
| 728 } | 318 } |
| 729 | 319 |
| 730 function provisionalBreakpointSetAfterReload() | 320 function provisionalBreakpointSetAfterReload() |
| 731 { | 321 { |
| 732 window.setBreakpointCallback = step3.bind(this); | 322 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind (this, breakpointManager, next); |
| 733 } | 323 } |
| 734 | 324 |
| 735 function step3() | |
| 736 { | |
| 737 dumpBreakpointLocations(breakpointManager); | |
| 738 resetBreakpointManager(breakpointManager, step4); | |
| 739 } | |
| 740 | |
| 741 function step4() | |
| 742 { | |
| 743 dumpBreakpointLocations(breakpointManager); | |
| 744 next(); | |
| 745 } | |
| 746 }, | 325 }, |
| 747 | 326 |
| 748 function testBreakpointInCollectedReload(next) | 327 function testBreakpointInCollectedReload(next) |
| 749 { | 328 { |
| 750 var breakpointManager = createBreakpointManager(); | 329 var breakpointManager = createBreakpointManager(); |
| 751 InspectorTest.addResult("\n Adding file without script:"); | 330 InspectorTest.addResult("\n Adding file without script:"); |
| 752 var uiSourceCode = addUISourceCode(breakpointManager, "a.js", true, true); | 331 var uiSourceCode = addUISourceCode(breakpointManager, "a.js", true, true); |
| 753 | 332 |
| 754 InspectorTest.addResult("\n Setting breakpoint:"); | 333 InspectorTest.addResult("\n Setting breakpoint:"); |
| 755 setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true); | 334 InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true, step2); |
| 756 window.setBreakpointCallback = step2.bind(this); | |
| 757 | 335 |
| 758 function step2() | 336 function step2() |
| 759 { | 337 { |
| 760 dumpBreakpointLocations(breakpointManager); | 338 InspectorTest.dumpBreakpointLocations(breakpointManager); |
| 761 InspectorTest.addResult("\n Reloading:"); | 339 InspectorTest.addResult("\n Reloading:"); |
| 762 mockTarget.debuggerModel.reset(); | 340 mockTarget.debuggerModel.reset(); |
| 763 resetWorkspace(breakpointManager); | 341 resetWorkspace(breakpointManager); |
| 764 | 342 |
| 765 InspectorTest.addResult("\n Adding file with script:"); | 343 InspectorTest.addResult("\n Adding file with script:"); |
| 766 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); | 344 var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| 767 | 345 |
| 768 InspectorTest.addResult("\n Emulating breakpoint resolved event :"); | 346 InspectorTest.addResult("\n Emulating breakpoint resolved event :"); |
| 769 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); | 347 mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebI nspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); |
| 770 | 348 |
| 771 InspectorTest.addResult("\n Waiting for breakpoint to be set in debugger again:"); | 349 InspectorTest.addResult("\n Waiting for breakpoint to be set in debugger again:"); |
| 772 window.setBreakpointCallback = step3.bind(this); | 350 window.setBreakpointCallback = InspectorTest.resetAndFinish.bind (this, breakpointManager, next); |
|
vsevik
2014/06/09 15:27:11
finishBreakpointTest?
sergeyv
2014/06/10 08:56:48
Done.
| |
| 773 } | |
| 774 | |
| 775 function step3() | |
| 776 { | |
| 777 dumpBreakpointLocations(breakpointManager); | |
| 778 resetBreakpointManager(breakpointManager, step4); | |
| 779 } | |
| 780 | |
| 781 function step4() | |
| 782 { | |
| 783 dumpBreakpointLocations(breakpointManager); | |
| 784 next(); | |
| 785 } | 351 } |
| 786 }, | 352 }, |
| 787 ]); | 353 ]); |
| 788 }; | 354 }; |
| 789 | 355 |
| 790 </script> | 356 </script> |
| 791 | 357 |
| 792 </head> | 358 </head> |
| 793 | 359 |
| 794 <body onload="runTest()"> | 360 <body onload="runTest()"> |
| 795 <p>Tests BreakpointManager class.</p> | 361 <p>Tests BreakpointManager class.</p> |
| 796 | 362 |
| 797 </body> | 363 </body> |
| 798 </html> | 364 </html> |
| OLD | NEW |