| <html> |
| <head> |
| <script src="../http/tests/inspector/inspector-test.js"></script> |
| <script> |
| function test() |
| { |
| function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) |
| { |
| return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition: condition, enabled: enabled }; |
| } |
| |
| InspectorTest.runTestSuite([ |
| function testMethodsToRunToUpdateVersion(next) |
| { |
| function runVersionControllerTest(oldVersion, currentVersion) |
| { |
| InspectorTest.addResult("Testing methods to run to upgrade from " + oldVersion + " to " + currentVersion + "."); |
| var versionController = new WebInspector.VersionController(); |
| var methodsToRun = versionController._methodsToRunToUpdateVersion(oldVersion, currentVersion); |
| InspectorTest.addResult("Methods to run: " + JSON.stringify(methodsToRun)); |
| InspectorTest.addResult(""); |
| } |
| |
| runVersionControllerTest(0, 0); |
| runVersionControllerTest(0, 1); |
| runVersionControllerTest(0, 2); |
| runVersionControllerTest(0, 3); |
| runVersionControllerTest(1, 1); |
| runVersionControllerTest(1, 2); |
| runVersionControllerTest(1, 3); |
| runVersionControllerTest(2, 2); |
| runVersionControllerTest(2, 3); |
| next(); |
| }, |
| |
| function testClearBreakpointsWhenTooMany(next) |
| { |
| function runClearBreakpointsTest(breakpointsCount, maxBreakpointsCount) |
| { |
| InspectorTest.addResult("Starting test with " + breakpointsCount + " breakpoints and " + maxBreakpointsCount + " allowed at max."); |
| var versionController = new WebInspector.VersionController(); |
| var serializedBreakpoints = []; |
| for (var i = 0; i < breakpointsCount; ++i) |
| serializedBreakpoints.push(createBreakpoint("file" + i + ".js", i % 10, "", true)); |
| var breakpointsSetting = new InspectorTest.MockSetting(serializedBreakpoints); |
| versionController._clearBreakpointsWhenTooMany(breakpointsSetting, maxBreakpointsCount); |
| InspectorTest.addResult("Number of breakpoints left in the setting after the test: " + breakpointsSetting.get().length + "."); |
| InspectorTest.addResult(""); |
| } |
| |
| runClearBreakpointsTest(0, 500); |
| runClearBreakpointsTest(1, 500); |
| runClearBreakpointsTest(2, 500); |
| runClearBreakpointsTest(499, 500); |
| runClearBreakpointsTest(500, 500); |
| runClearBreakpointsTest(501, 500); |
| runClearBreakpointsTest(1000, 500); |
| next(); |
| } |
| ]); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests inspector version controller.</p> |
| </body> |
| </html> |