Chromium Code Reviews| Index: LayoutTests/inspector/sources/debugger/breakpoint-manager.html |
| diff --git a/LayoutTests/inspector/sources/debugger/breakpoint-manager.html b/LayoutTests/inspector/sources/debugger/breakpoint-manager.html |
| index 3c380fcace46f3c87ee3badb3ce24e38fddcf609..24f6cf3a2ae3a73163e05e0ea8320bf71814a7c6 100644 |
| --- a/LayoutTests/inspector/sources/debugger/breakpoint-manager.html |
| +++ b/LayoutTests/inspector/sources/debugger/breakpoint-manager.html |
| @@ -1,13 +1,12 @@ |
| <html> |
| <head> |
| <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| +<script src="breakpoint-manager.js"></script> |
| <script> |
| function test() |
| { |
| - var workspace; |
| - var uiSourceCodes = {}; |
| var mockTarget = { |
| id: function() |
| @@ -15,34 +14,16 @@ function test() |
| return 1; |
| } |
| }; |
| + InspectorTest.initializeDefaultMappingOn(mockTarget); |
| var targetManager = new WebInspector.TargetManager(); |
| targetManager._targets.push(mockTarget); |
| - var defaultMapping = { |
| - rawLocationToUILocation: function(rawLocation) |
| - { |
| - return uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.lineNumber, 0); |
| - }, |
| - |
| - uiLocationToRawLocation: function(uiSourceCode, lineNumber) |
| - { |
| - if (!uiSourceCodes[uiSourceCode.url]) |
| - return null; |
| - return new WebInspector.DebuggerModel.Location(mockTarget, uiSourceCode.url, lineNumber, 0); |
| - }, |
| - |
| - isIdentity: function() |
| - { |
| - return true; |
| - } |
| - }; |
| - |
| var shiftingMapping = { |
| rawLocationToUILocation: function(rawLocation) |
| { |
| if (this._disabled) |
| return null; |
| - return uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.lineNumber + 10, 0); |
| + return InspectorTest.uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.lineNumber + 10, 0); |
| }, |
| uiLocationToRawLocation: function(uiSourceCode, lineNumber) |
| @@ -80,153 +61,6 @@ function test() |
| return mapping; |
| } |
| - function DebuggerModelMock(sourceMapping) |
| - { |
| - mockTarget.debuggerModel = this; |
| - this._breakpointResolvedEventTarget = new WebInspector.Object(); |
| - this._scripts = {}; |
| - this._sourceMapping = sourceMapping; |
| - this._breakpoints = {}; |
| - } |
| - |
| - DebuggerModelMock.prototype = { |
| - target: function() |
| - { |
| - return mockTarget; |
| - }, |
| - |
| - _addScript: function(scriptId, url) |
| - { |
| - this._scripts[scriptId] = new WebInspector.Script(mockTarget, scriptId, url); |
| - this._scripts[scriptId].pushSourceMapping(this._sourceMapping); |
| - }, |
| - |
| - _scriptForURL: function(url) |
| - { |
| - for (var scriptId in this._scripts) { |
| - var script = this._scripts[scriptId]; |
| - if (script.sourceURL === url) |
| - return script; |
| - } |
| - }, |
| - |
| - _scheduleSetBeakpointCallback: function(callback, breakpointId, locations) |
| - { |
| - setTimeout(innerCallback.bind(this), 0); |
| - |
| - function innerCallback() |
| - { |
| - if (callback) |
| - callback(breakpointId, locations); |
| - if (window.setBreakpointCallback) { |
| - var savedCallback = window.setBreakpointCallback; |
| - delete window.setBreakpointCallback; |
| - savedCallback(); |
| - } |
| - } |
| - }, |
| - |
| - setBreakpointByURL: function(url, lineNumber, columnNumber, condition, callback) |
| - { |
| - InspectorTest.addResult(" debuggerModel.setBreakpoint(" + [url, lineNumber, condition].join(":") + ")"); |
| - |
| - var breakpointId = url + ":" + lineNumber; |
| - if (this._breakpoints[breakpointId]) { |
| - this._scheduleSetBeakpointCallback(callback, null); |
| - return; |
| - } |
| - this._breakpoints[breakpointId] = true; |
| - |
| - var locations = []; |
| - var script = this._scriptForURL(url); |
| - if (script) { |
| - var location = new WebInspector.DebuggerModel.Location(mockTarget, script.scriptId, lineNumber, 0); |
| - locations.push(location); |
| - } |
| - |
| - this._scheduleSetBeakpointCallback(callback, breakpointId, locations); |
| - }, |
| - |
| - setBreakpointByScriptLocation: function(location, condition, callback) |
| - { |
| - InspectorTest.addResult(" debuggerModel.setBreakpoint(" + [location.scriptId, location.lineNumber, condition].join(":") + ")"); |
| - |
| - var breakpointId = location.scriptId + ":" + location.lineNumber; |
| - if (this._breakpoints[breakpointId]) { |
| - this._scheduleSetBeakpointCallback(callback, null); |
| - return; |
| - } |
| - this._breakpoints[breakpointId] = true; |
| - |
| - if (location.lineNumber >= 2000) { |
| - this._scheduleSetBeakpointCallback(callback, breakpointId, []); |
| - return; |
| - } |
| - if (location.lineNumber >= 1000) { |
| - var shiftedLocation = new WebInspector.DebuggerModel.Location(mockTarget, location.scriptId, location.lineNumber + 10, location.columnNumber); |
| - this._scheduleSetBeakpointCallback(callback, breakpointId, [shiftedLocation]); |
| - return; |
| - } |
| - |
| - this._scheduleSetBeakpointCallback(callback, breakpointId, [WebInspector.DebuggerModel.Location.fromPayload(mockTarget, location)]); |
| - }, |
| - |
| - removeBreakpoint: function(breakpointId, callback) |
| - { |
| - InspectorTest.addResult(" debuggerModel.removeBreakpoint(" + breakpointId + ")"); |
| - delete this._breakpoints[breakpointId]; |
| - if (callback) |
| - callback(); |
| - }, |
| - |
| - setBreakpointsActive: function() { }, |
| - |
| - createLiveLocation: function(rawLocation, updateDelegate) |
| - { |
| - return this._scripts[rawLocation.scriptId].createLiveLocation(rawLocation, updateDelegate); |
| - }, |
| - |
| - scriptForId: function(scriptId) |
| - { |
| - return this._scripts[scriptId]; |
| - }, |
| - |
| - reset: function() |
| - { |
| - InspectorTest.addResult(" Resetting debugger."); |
| - this._scripts = {}; |
| - }, |
| - |
| - pushSourceMapping: function(sourceMapping) |
| - { |
| - for (var scriptId in this._scripts) |
| - this._scripts[scriptId].pushSourceMapping(sourceMapping); |
| - }, |
| - |
| - disableSourceMapping: function(sourceMapping) |
| - { |
| - sourceMapping._disabled = true; |
| - for (var scriptId in this._scripts) |
| - this._scripts[scriptId].updateLocations(); |
| - }, |
| - |
| - addBreakpointListener: function(breakpointId, listener, thisObject) |
| - { |
| - this._breakpointResolvedEventTarget.addEventListener(breakpointId, listener, thisObject) |
| - }, |
| - |
| - removeBreakpointListener: function(breakpointId, listener, thisObject) |
| - { |
| - this._breakpointResolvedEventTarget.removeEventListener(breakpointId, listener, thisObject); |
| - }, |
| - |
| - _breakpointResolved: function(breakpointId, location) |
| - { |
| - this._breakpointResolvedEventTarget.dispatchEventToListeners(breakpointId, location); |
| - } |
| - } |
| - DebuggerModelMock.prototype.__proto__ = WebInspector.Object.prototype; |
| - |
| function resetWorkspace(breakpointManager) |
| { |
| InspectorTest.addResult(" Resetting workspace."); |
| @@ -234,50 +68,15 @@ function test() |
| breakpointManager._debuggerProjectDelegate.reset(); |
| } |
| - function breakpointAdded(event) |
| - { |
| - var breakpoint = event.data.breakpoint; |
| - var uiLocation = event.data.uiLocation; |
| - InspectorTest.addResult(" breakpointAdded(" + [uiLocation.uiSourceCode.originURL(), uiLocation.lineNumber, uiLocation.columnNumber, breakpoint.condition(), breakpoint.enabled()].join(", ") + ")"); |
| - } |
| - |
| - function breakpointRemoved(event) |
| - { |
| - var uiLocation = event.data.uiLocation; |
| - InspectorTest.addResult(" breakpointRemoved(" + [uiLocation.uiSourceCode.originURL(), uiLocation.lineNumber, uiLocation.columnNumber].join(", ") + ")"); |
| - } |
| - |
| - InspectorTest.addSniffer(WebInspector.Script.prototype, "createLiveLocation", function(rawLocation) |
| - { |
| - InspectorTest.addResult(" Location created: " + rawLocation.scriptId + ":" + rawLocation.lineNumber); |
| - }, true); |
| - InspectorTest.addSniffer(WebInspector.Script.Location.prototype, "dispose", function() |
| - { |
| - InspectorTest.addResult(" Location disposed: " + this._rawLocation.scriptId + ":" + this._rawLocation.lineNumber); |
| - }, true); |
| - |
| - function addUISourceCode(breakpointManager, url, doNotSetSourceMapping, doNotAddScript) |
| - { |
| - if (!doNotAddScript) |
| - mockTarget.debuggerModel._addScript(url, url); |
| - InspectorTest.addResult(" Adding UISourceCode: " + url); |
| - var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, ""); |
| - var uiSourceCode = breakpointManager._networkWorkspaceBinding.addFileForURL(url, contentProvider); |
| - uiSourceCodes[url] = uiSourceCode; |
| - if (!doNotSetSourceMapping) |
| - uiSourceCode.setSourceMappingForTarget(mockTarget, defaultMapping); |
| - return uiSourceCode; |
| - } |
| - |
| function addTemporaryUISourceCode(breakpointManager, url) |
| { |
| mockTarget.debuggerModel._addScript(url, url); |
| InspectorTest.addResult(" Adding temporary UISourceCode: " + url); |
| var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, ""); |
| var path = breakpointManager._debuggerProjectDelegate.addContentProvider("", url, url, contentProvider); |
| - var uiSourceCode = workspace.uiSourceCode("debugger:", path); |
| - uiSourceCode.setSourceMappingForTarget(mockTarget, defaultMapping); |
| - uiSourceCodes[url] = uiSourceCode; |
| + var uiSourceCode = breakpointManager._workspace.uiSourceCode("debugger:", path); |
| + uiSourceCode.setSourceMappingForTarget(mockTarget, mockTarget.defaultMapping); |
| + InspectorTest.uiSourceCodes[url] = uiSourceCode; |
| return uiSourceCode; |
| } |
| @@ -286,161 +85,48 @@ function test() |
| return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition: condition, enabled: enabled }; |
| } |
| + InspectorTest.setupLiveLocationSniffers(); |
| var serializedBreakpoints = []; |
| serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true)); |
| serializedBreakpoints.push(createBreakpoint("a.js", 20, "", false)); |
| serializedBreakpoints.push(createBreakpoint("b.js", 3, "", true)); |
| - function createBreakpointManager(persistentBreakpoints, sourceMapping) |
| - { |
| - persistentBreakpoints = persistentBreakpoints || []; |
| - var setting = { |
| - get: function() { return persistentBreakpoints; }, |
| - set: function(breakpoints) { persistentBreakpoints = breakpoints; } |
| - }; |
| - |
| - var sourceMapping = sourceMapping || defaultMapping; |
| - var debuggerModel = new DebuggerModelMock(sourceMapping); |
| - workspace = new WebInspector.Workspace(); |
| - var breakpointManager = new WebInspector.BreakpointManager(setting, workspace, targetManager); |
| - breakpointManager._networkWorkspaceBinding = new WebInspector.NetworkWorkspaceBinding(workspace); |
| - breakpointManager._debuggerProjectDelegate = new WebInspector.DebuggerProjectDelegate(workspace, "debugger:", WebInspector.projectTypes.Debugger); |
| - breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, breakpointAdded); |
| - breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, breakpointRemoved); |
| - InspectorTest.addResult(" Created breakpoints manager"); |
| - dumpBreakpointStorage(breakpointManager); |
| - return breakpointManager; |
| - } |
| - |
| - function setBreakpoint(breakpointManager, uiSourceCode, lineNumber, columnNumber, condition, enabled) |
| - { |
| - InspectorTest.addResult(" Setting breakpoint at " + uiSourceCode.originURL() + ":" + lineNumber + ":" + columnNumber + " enabled:" + enabled + " condition:" + condition); |
| - return breakpointManager.setBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled); |
| - } |
| - |
| - function removeBreakpoint(breakpointManager, uiSourceCode, lineNumber, columnNumber) |
| - { |
| - InspectorTest.addResult(" Removing breakpoint at " + uiSourceCode.originURL() + ":" + lineNumber + ":" + columnNumber); |
| - breakpointManager.findBreakpoint(uiSourceCode, lineNumber, columnNumber).remove(); |
| - } |
| - |
| - function dumpBreakpointStorage(breakpointManager) |
| - { |
| - var breakpoints = breakpointManager._storage._setting.get(); |
| - InspectorTest.addResult(" Dumping Storage"); |
| - for (var i = 0; i < breakpoints.length; ++i) |
| - InspectorTest.addResult(" " + breakpoints[i].sourceFileId + ":" + breakpoints[i].lineNumber + " enabled:" + breakpoints[i].enabled + " condition:" + breakpoints[i].condition); |
| - } |
| - |
| - function dumpBreakpointLocations(breakpointManager) |
| - { |
| - var allBreakpointLocations = breakpointManager.allBreakpointLocations(); |
| - InspectorTest.addResult(" Dumping Breakpoint Locations"); |
| - var lastUISourceCode = null; |
| - var locations = []; |
| - |
| - function dumpLocations(uiSourceCode, locations) |
| - { |
| - InspectorTest.addResult(" UISourceCode (url='" + uiSourceCode.url + "', uri='" + uiSourceCode.uri() + "')"); |
| - for (var i = 0; i < locations.length; ++i) |
| - InspectorTest.addResult(" Location: (" + locations[i].lineNumber + ", " + locations[i].columnNumber + ")"); |
| - } |
| - |
| - for (var i = 0; i < allBreakpointLocations.length; ++i) { |
| - var uiLocation = allBreakpointLocations[i].uiLocation; |
| - var uiSourceCode = uiLocation.uiSourceCode; |
| - if (lastUISourceCode && lastUISourceCode != uiSourceCode) { |
| - dumpLocations(uiSourceCode, locations); |
| - locations = []; |
| - } |
| - lastUISourceCode = uiSourceCode; |
| - locations.push(uiLocation); |
| - } |
| - if (lastUISourceCode) |
| - dumpLocations(lastUISourceCode, locations); |
| - } |
| - |
| - function resetBreakpointManager(breakpointManager, next) |
| - { |
| - dumpBreakpointStorage(breakpointManager); |
| - InspectorTest.addResult(" Resetting breakpoint manager"); |
| - breakpointManager.removeAllBreakpoints(); |
| - breakpointManager.removeProvisionalBreakpointsForTest(); |
| - uiSourceCodes = {}; |
| - next(); |
| - } |
| + var addUISourceCode = InspectorTest.addUISourceCode.bind(null, mockTarget); |
| + var createBreakpointManager = InspectorTest.createBreakpointManager.bind(null, targetManager); |
| InspectorTest.runTestSuite([ |
| function testSetBreakpoint(next) |
| { |
| var breakpointManager = createBreakpointManager(); |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| - setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); |
| - window.setBreakpointCallback = step2.bind(this); |
| - |
| - function step2() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| + InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, InspectorTest.resetAndFinish.bind(this, breakpointManager, next)); |
| }, |
| function testSetDisabledBreakpoint(next) |
| { |
| var breakpointManager = createBreakpointManager(); |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| - var breakpoint = setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", false); |
| - dumpBreakpointLocations(breakpointManager); |
| - dumpBreakpointStorage(breakpointManager); |
| + var breakpoint = InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", false); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointStorage(breakpointManager); |
| InspectorTest.addResult(" Enabling breakpoint"); |
| breakpoint.setEnabled(true); |
| - window.setBreakpointCallback = step2.bind(this); |
| - |
| - function step2() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| }, |
| function testSetConditionalBreakpoint(next) |
| { |
| var breakpointManager = createBreakpointManager(); |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| - var breakpoint = setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "condition", true); |
| - window.setBreakpointCallback = step2.bind(this); |
| + var breakpoint = InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "condition", true, step2); |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| - dumpBreakpointStorage(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointStorage(breakpointManager); |
| InspectorTest.addResult(" Updating condition"); |
| breakpoint.setCondition(""); |
| - window.setBreakpointCallback = step3.bind(this); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step4); |
| - } |
| - |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| } |
| }, |
| @@ -448,19 +134,7 @@ function test() |
| { |
| var breakpointManager = createBreakpointManager(serializedBreakpoints); |
| addUISourceCode(breakpointManager, "a.js"); |
| - window.setBreakpointCallback = step2.bind(this); |
| - |
| - function step2() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| }, |
| function testRestoreBreakpointsTwice(next) |
| @@ -468,19 +142,7 @@ function test() |
| var breakpointManager = createBreakpointManager(serializedBreakpoints); |
| addUISourceCode(breakpointManager, "a.js"); |
| addUISourceCode(breakpointManager, "a.js"); |
| - window.setBreakpointCallback = step2.bind(this); |
| - |
| - function step2() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| }, |
| function testRemoveBreakpoints(next) |
| @@ -491,25 +153,17 @@ function test() |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| - setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true); |
| - window.setBreakpointCallback = step3.bind(this); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step3); |
| } |
| function step3() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| - removeBreakpoint(breakpointManager, uiSourceCode, 30, 0); |
| - removeBreakpoint(breakpointManager, uiSourceCode, 10, 0); |
| - removeBreakpoint(breakpointManager, uiSourceCode, 20, 0); |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step4); |
| - } |
| - |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 30, 0); |
| + InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 10, 0); |
| + InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 20, 0); |
| + InspectorTest.resetAndFinish(breakpointManager, next); |
| } |
| }, |
| @@ -517,67 +171,28 @@ function test() |
| { |
| var breakpointManager = createBreakpointManager(); |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| - setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true); |
| - window.setBreakpointCallback = step2.bind(this); |
| - |
| - function step2() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| + 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?
|
| }, |
| function testSetBreakpointThatShiftsTwice(next) |
| { |
| var breakpointManager = createBreakpointManager(); |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| - setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true); |
| - window.setBreakpointCallback = step2.bind(this); |
| + InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true, step2); |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| - setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true); |
| - window.setBreakpointCallback = step3.bind(this); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step4); |
| - } |
| - |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true, InspectorTest.resetAndFinish.bind(this, breakpointManager, next)); |
| } |
| }, |
| function testSetBreakpointOutsideScript(next) |
| { |
| - var breakpointManager = createBreakpointManager([]); |
| + var breakpointManager = createBreakpointManager(); |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js"); |
| breakpointManager.setBreakpoint(uiSourceCode, 2500, 0, "", true); |
| - window.setBreakpointCallback = step2.bind(this); |
| - |
| - function step2() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| }, |
| function testNavigation(next) |
| @@ -588,7 +203,7 @@ function test() |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| InspectorTest.addResult("\n Navigating to B."); |
| mockTarget.debuggerModel.reset(); |
| resetWorkspace(breakpointManager); |
| @@ -598,7 +213,7 @@ function test() |
| function step3() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| InspectorTest.addResult("\n Navigating back to A."); |
| mockTarget.debuggerModel.reset(); |
| resetWorkspace(breakpointManager); |
| @@ -606,19 +221,7 @@ function test() |
| addTemporaryUISourceCode(breakpointManager, "a.js"); |
| mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); |
| addUISourceCode(breakpointManager, "a.js"); |
| - window.setBreakpointCallback = step4.bind(this); |
| - } |
| - |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step5); |
| - } |
| - |
| - function step5() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| } |
| }, |
| @@ -640,21 +243,15 @@ function test() |
| function step3() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| InspectorTest.addResult("\n Toggling source mapping."); |
| mockTarget.debuggerModel.pushSourceMapping(shiftingMapping); |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| InspectorTest.addResult("\n Toggling source mapping back."); |
| mockTarget.debuggerModel.disableSourceMapping(shiftingMapping); |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step4); |
| + InspectorTest.resetAndFinish(breakpointManager, next); |
| } |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| }, |
| function testProvisionalBreakpointsResolve(next) |
| @@ -668,7 +265,7 @@ function test() |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| mockTarget.debuggerModel.reset(); |
| resetWorkspace(breakpointManager); |
| InspectorTest.addResult(" Resolving provisional breakpoint."); |
| @@ -676,14 +273,7 @@ function test() |
| mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget, "a.js", 11, 5)); |
| var breakpoints = breakpointManager.allBreakpoints(); |
| InspectorTest.assertEquals(breakpoints.length, 1, "Exactly one provisional breakpoint should be registered in breakpoint manager."); |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step3); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| + InspectorTest.resetAndFinish(breakpointManager, next); |
| } |
| }, |
| @@ -709,7 +299,7 @@ function test() |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| InspectorTest.addResult("\n Reloading:"); |
| mockTarget.debuggerModel.reset(); |
| resetWorkspace(breakpointManager); |
| @@ -729,20 +319,9 @@ function test() |
| function provisionalBreakpointSetAfterReload() |
| { |
| - window.setBreakpointCallback = step3.bind(this); |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
| } |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step4); |
| - } |
| - |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| - } |
| }, |
| function testBreakpointInCollectedReload(next) |
| @@ -752,12 +331,11 @@ function test() |
| var uiSourceCode = addUISourceCode(breakpointManager, "a.js", true, true); |
| InspectorTest.addResult("\n Setting breakpoint:"); |
| - setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true); |
| - window.setBreakpointCallback = step2.bind(this); |
| + InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true, step2); |
| function step2() |
| { |
| - dumpBreakpointLocations(breakpointManager); |
| + InspectorTest.dumpBreakpointLocations(breakpointManager); |
| InspectorTest.addResult("\n Reloading:"); |
| mockTarget.debuggerModel.reset(); |
| resetWorkspace(breakpointManager); |
| @@ -769,19 +347,7 @@ function test() |
| mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget, "a.js", 10, 5)); |
| InspectorTest.addResult("\n Waiting for breakpoint to be set in debugger again:"); |
| - window.setBreakpointCallback = step3.bind(this); |
| - } |
| - |
| - function step3() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - resetBreakpointManager(breakpointManager, step4); |
| - } |
| - |
| - function step4() |
| - { |
| - dumpBreakpointLocations(breakpointManager); |
| - next(); |
| + window.setBreakpointCallback = InspectorTest.resetAndFinish.bind(this, breakpointManager, next); |
|
vsevik
2014/06/09 15:27:11
finishBreakpointTest?
sergeyv
2014/06/10 08:56:48
Done.
|
| } |
| }, |
| ]); |