Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: LayoutTests/inspector/sources/debugger/breakpoint-manager.html

Issue 1153923005: DevTools: shard inspector/debugger tests for faster execution. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
deleted file mode 100644
index 890f71adf69d73a315297f87257849d4321a2e2a..0000000000000000000000000000000000000000
--- a/LayoutTests/inspector/sources/debugger/breakpoint-manager.html
+++ /dev/null
@@ -1,366 +0,0 @@
-<html>
-<head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
-<script src="../../../http/tests/inspector/workspace-test.js"></script>
-<script src="breakpoint-manager.js"></script>
-
-<script>
-
-function test()
-{
- var mockTarget;
-
- function createWorkspace()
- {
- InspectorTest.createWorkspace(true);
- mockTarget = InspectorTest.createMockTarget(1, InspectorTest.DebuggerModelMock);
- }
-
- function resetWorkspace(breakpointManager)
- {
- mockTarget.debuggerModel.reset();
- InspectorTest.addResult(" Resetting workspace.");
- breakpointManager._debuggerWorkspaceBinding._reset(mockTarget);
- InspectorTest.testNetworkProject._reset();
- }
-
- function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled)
- {
- return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition: condition, enabled: enabled };
- }
-
- 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));
-
- createWorkspace();
- InspectorTest.setupLiveLocationSniffers();
-
- var addUISourceCode = function() {
- var args = [mockTarget].concat(Array.prototype.slice.call(arguments));
- return InspectorTest.addUISourceCode.apply(null, args);
- }
- var createBreakpointManager = function(serializedBreakpoints) {
- return InspectorTest.createBreakpointManager(InspectorTest.testTargetManager, InspectorTest.testDebuggerWorkspaceBinding, serializedBreakpoints);
- }
-
- InspectorTest.runTestSuite([
- function testSetBreakpoint(next)
- {
- var breakpointManager = createBreakpointManager();
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- },
-
- function testSetDisabledBreakpoint(next)
- {
- var breakpointManager = createBreakpointManager();
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- var breakpoint = InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", false);
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.dumpBreakpointStorage(breakpointManager);
- InspectorTest.addResult(" Enabling breakpoint");
- breakpoint.setEnabled(true);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- },
-
- function testSetConditionalBreakpoint(next)
- {
- var breakpointManager = createBreakpointManager();
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- var breakpoint = InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "condition", true, step2);
-
- function step2()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.dumpBreakpointStorage(breakpointManager);
- InspectorTest.addResult(" Updating condition");
- breakpoint.setCondition("");
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- },
-
- function testRestoreBreakpoints(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- addUISourceCode(breakpointManager, "a.js");
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- },
-
- function testRestoreBreakpointsTwice(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- addUISourceCode(breakpointManager, "a.js");
- addUISourceCode(breakpointManager, "a.js");
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- },
-
- function testRemoveBreakpoints(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- window.setBreakpointCallback = step2.bind(this);
-
- function step2()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 30, 0, "", true, step3);
- }
-
- function step3()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 30, 0);
- InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 10, 0);
- InspectorTest.removeBreakpoint(breakpointManager, uiSourceCode, 20, 0);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- },
-
- function testSetBreakpointThatShifts(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager();
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- },
-
- function testSetBreakpointThatShiftsTwice(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager();
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true, step2);
-
- function step2()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 1015, 0, "", true);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- },
-
- function testSetBreakpointOutsideScript(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager();
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- breakpointManager.setBreakpoint(uiSourceCode, 2500, 0, "", true);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- },
-
- function testNavigation(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js");
- window.setBreakpointCallback = step2.bind(this);
-
- function step2()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.addResult("\n Navigating to B.");
- resetWorkspace(breakpointManager);
- var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js");
- window.setBreakpointCallback = step3.bind(this);
- }
-
- function step3()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.addResult("\n Navigating back to A.");
- resetWorkspace(breakpointManager);
- InspectorTest.addResult(" Resolving provisional breakpoint.");
- InspectorTest.addScript(mockTarget, breakpointManager, "a.js");
- mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0));
- addUISourceCode(breakpointManager, "a.js", false, true);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- },
-
- function testSourceMapping(next)
- {
- var shiftingMapping = {
- rawLocationToUILocation: function(rawLocation)
- {
- if (this._disabled)
- return null;
- return InspectorTest.uiSourceCodes[rawLocation.scriptId].uiLocation(rawLocation.lineNumber + 10, 0);
- },
-
- uiLocationToRawLocation: function(uiSourceCode, lineNumber)
- {
- var networkURL = InspectorTest.testNetworkMapping.networkURL(uiSourceCode);
- return new WebInspector.DebuggerModel.Location(mockTarget.debuggerModel, networkURL, lineNumber - 10, 0);
- },
-
- isIdentity: function()
- {
- return false;
- }
- };
-
- // Source mapping will shift everything 10 lines ahead so that breakpoint 1 clashes with breakpoint 2.
- var serializedBreakpoints = [];
- serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true));
- serializedBreakpoints.push(createBreakpoint("a.js", 20, "", true));
-
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js");
- window.setBreakpointCallback = step2.bind(this);
-
- function step2()
- {
- window.setBreakpointCallback = step3.bind(this);
- }
-
- function step3()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.addResult("\n Toggling source mapping.");
- mockTarget.debuggerModel.pushSourceMapping(shiftingMapping);
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.addResult("\n Toggling source mapping back.");
- mockTarget.debuggerModel.disableSourceMapping(shiftingMapping);
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
-
- },
-
- function testProvisionalBreakpointsResolve(next)
- {
- var serializedBreakpoints = [];
- serializedBreakpoints.push(createBreakpoint("a.js", 10, "foo == bar", true));
-
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
- window.setBreakpointCallback = step2.bind(this);
-
- function step2()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- resetWorkspace(breakpointManager);
- InspectorTest.addResult(" Resolving provisional breakpoint.");
- InspectorTest.addScript(mockTarget, breakpointManager, "a.js");
- mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 11, 0));
- var breakpoints = breakpointManager.allBreakpoints();
- InspectorTest.assertEquals(1, breakpoints.length, "Exactly one provisional breakpoint should be registered in breakpoint manager.");
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- },
-
- function testSourceMappingReload(next)
- {
- function createSourceMapping(uiSourceCodeA, uiSourceCodeB)
- {
- var mapping = {
- rawLocationToUILocation: function(rawLocation)
- {
- if (this._disabled)
- return null;
- return uiSourceCodeB.uiLocation(rawLocation.lineNumber + 10, 0);
- },
-
- uiLocationToRawLocation: function(uiSourceCode, lineNumber)
- {
- var networkURL = InspectorTest.testNetworkMapping.networkURL(uiSourceCodeA);
- return new WebInspector.DebuggerModel.Location(mockTarget.debuggerModel, networkURL, lineNumber - 10, 0);
- },
-
- isIdentity: function()
- {
- return false;
- }
- };
-
- return mapping;
- }
- // Source mapping will shift everything 10 lines ahead.
- var serializedBreakpoints = [createBreakpoint("b.js", 20, "foo == bar", true)];
- createWorkspace();
- var breakpointManager = createBreakpointManager(serializedBreakpoints);
- InspectorTest.addResult("\n Adding files:");
- var uiSourceCodeA = addUISourceCode(breakpointManager, "a.js");
- var uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true);
-
- InspectorTest.addResult("\n Toggling source mapping.");
- var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceCodeB);
- mockTarget.debuggerModel.pushSourceMapping(sourceMapping);
- breakpointManager._debuggerWorkspaceBinding.setSourceMapping(mockTarget, uiSourceCodeB, sourceMapping);
- InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, breakpointActionsPerformedBeforeReload.bind(this));
-
- function breakpointActionsPerformedBeforeReload()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.addResult("\n Reloading:");
- resetWorkspace(breakpointManager);
-
- InspectorTest.addResult("\n Adding files:");
- InspectorTest.addScript(mockTarget, breakpointManager, "a.js");
- mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0));
- uiSourceCodeA = addUISourceCode(breakpointManager, "a.js", false, true);
- uiSourceCodeB = addUISourceCode(breakpointManager, "b.js", true, true);
-
- InspectorTest.addResult("\n Toggling source mapping.");
- var sourceMapping = createSourceMapping(uiSourceCodeA, uiSourceCodeB);
- mockTarget.debuggerModel.pushSourceMapping(sourceMapping);
- breakpointManager._debuggerWorkspaceBinding.setSourceMapping(mockTarget, uiSourceCodeB, sourceMapping);
- InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, breakpointActionsPerformed.bind(this));
- }
-
- function breakpointActionsPerformed()
- {
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- },
-
- function testBreakpointInCollectedReload(next)
- {
- createWorkspace();
- var breakpointManager = createBreakpointManager();
- InspectorTest.addResult("\n Adding file without script:");
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js", true, true);
-
- InspectorTest.addResult("\n Setting breakpoint:");
- InspectorTest.setBreakpoint(breakpointManager, uiSourceCode, 10, 0, "", true, step2);
-
- function step2()
- {
- InspectorTest.dumpBreakpointLocations(breakpointManager);
- InspectorTest.addResult("\n Reloading:");
- resetWorkspace(breakpointManager);
-
- InspectorTest.addResult("\n Adding file with script:");
- var uiSourceCode = addUISourceCode(breakpointManager, "a.js");
-
- InspectorTest.addResult("\n Emulating breakpoint resolved event:");
- mockTarget.debuggerModel._breakpointResolved("a.js:10", new WebInspector.DebuggerModel.Location(mockTarget.debuggerModel, "a.js", 10, 0));
-
- InspectorTest.addResult("\n Make sure we don't do any unnecessary breakpoint actions:");
- InspectorTest.runAfterPendingBreakpointUpdates(breakpointManager, breakpointActionsPerformed.bind(this));
-
- function breakpointActionsPerformed()
- {
- InspectorTest.finishBreakpointTest(breakpointManager, next);
- }
- }
- },
- ]);
-};
-</script>
-
-</head>
-
-<body onload="runTest()">
-<p>Tests BreakpointManager class.</p>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698