| 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> | 4 <script> |
| 5 function test() | 5 function test() |
| 6 { | 6 { |
| 7 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) | 7 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled) |
| 8 { | 8 { |
| 9 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition
: condition, enabled: enabled }; | 9 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition
: condition, enabled: enabled }; |
| 10 } | 10 } |
| 11 | 11 |
| 12 InspectorTest.runTestSuite([ | 12 InspectorTest.runTestSuite([ |
| 13 function testMethodsToRunToUpdateVersion(next) | 13 function testMethodsToRunToUpdateVersion(next) |
| 14 { | 14 { |
| 15 function runVersionControllerTest(oldVersion, currentVersion) | 15 function runVersionControllerTest(oldVersion, currentVersion) |
| 16 { | 16 { |
| 17 InspectorTest.addResult("Testing methods to run to upgrade from
" + oldVersion + " to " + currentVersion + "."); | 17 InspectorTest.addResult("Testing methods to run to upgrade from
" + oldVersion + " to " + currentVersion + "."); |
| 18 var versionController = new WebInspector.VersionController(); | 18 var versionController = new Common.VersionController(); |
| 19 var methodsToRun = versionController._methodsToRunToUpdateVersio
n(oldVersion, currentVersion); | 19 var methodsToRun = versionController._methodsToRunToUpdateVersio
n(oldVersion, currentVersion); |
| 20 InspectorTest.addResult("Methods to run: " + JSON.stringify(meth
odsToRun)); | 20 InspectorTest.addResult("Methods to run: " + JSON.stringify(meth
odsToRun)); |
| 21 InspectorTest.addResult(""); | 21 InspectorTest.addResult(""); |
| 22 } | 22 } |
| 23 | 23 |
| 24 runVersionControllerTest(0, 0); | 24 runVersionControllerTest(0, 0); |
| 25 runVersionControllerTest(0, 1); | 25 runVersionControllerTest(0, 1); |
| 26 runVersionControllerTest(0, 2); | 26 runVersionControllerTest(0, 2); |
| 27 runVersionControllerTest(0, 3); | 27 runVersionControllerTest(0, 3); |
| 28 runVersionControllerTest(1, 1); | 28 runVersionControllerTest(1, 1); |
| 29 runVersionControllerTest(1, 2); | 29 runVersionControllerTest(1, 2); |
| 30 runVersionControllerTest(1, 3); | 30 runVersionControllerTest(1, 3); |
| 31 runVersionControllerTest(2, 2); | 31 runVersionControllerTest(2, 2); |
| 32 runVersionControllerTest(2, 3); | 32 runVersionControllerTest(2, 3); |
| 33 next(); | 33 next(); |
| 34 }, | 34 }, |
| 35 | 35 |
| 36 function testClearBreakpointsWhenTooMany(next) | 36 function testClearBreakpointsWhenTooMany(next) |
| 37 { | 37 { |
| 38 function runClearBreakpointsTest(breakpointsCount, maxBreakpointsCou
nt) | 38 function runClearBreakpointsTest(breakpointsCount, maxBreakpointsCou
nt) |
| 39 { | 39 { |
| 40 InspectorTest.addResult("Starting test with " + breakpointsCount
+ " breakpoints and " + maxBreakpointsCount + " allowed at max."); | 40 InspectorTest.addResult("Starting test with " + breakpointsCount
+ " breakpoints and " + maxBreakpointsCount + " allowed at max."); |
| 41 var versionController = new WebInspector.VersionController(); | 41 var versionController = new Common.VersionController(); |
| 42 var serializedBreakpoints = []; | 42 var serializedBreakpoints = []; |
| 43 for (var i = 0; i < breakpointsCount; ++i) | 43 for (var i = 0; i < breakpointsCount; ++i) |
| 44 serializedBreakpoints.push(createBreakpoint("file" + i + ".j
s", i % 10, "", true)); | 44 serializedBreakpoints.push(createBreakpoint("file" + i + ".j
s", i % 10, "", true)); |
| 45 var breakpointsSetting = new InspectorTest.MockSetting(serialize
dBreakpoints); | 45 var breakpointsSetting = new InspectorTest.MockSetting(serialize
dBreakpoints); |
| 46 versionController._clearBreakpointsWhenTooMany(breakpointsSettin
g, maxBreakpointsCount); | 46 versionController._clearBreakpointsWhenTooMany(breakpointsSettin
g, maxBreakpointsCount); |
| 47 InspectorTest.addResult("Number of breakpoints left in the setti
ng after the test: " + breakpointsSetting.get().length + "."); | 47 InspectorTest.addResult("Number of breakpoints left in the setti
ng after the test: " + breakpointsSetting.get().length + "."); |
| 48 InspectorTest.addResult(""); | 48 InspectorTest.addResult(""); |
| 49 } | 49 } |
| 50 | 50 |
| 51 runClearBreakpointsTest(0, 500); | 51 runClearBreakpointsTest(0, 500); |
| 52 runClearBreakpointsTest(1, 500); | 52 runClearBreakpointsTest(1, 500); |
| 53 runClearBreakpointsTest(2, 500); | 53 runClearBreakpointsTest(2, 500); |
| 54 runClearBreakpointsTest(499, 500); | 54 runClearBreakpointsTest(499, 500); |
| 55 runClearBreakpointsTest(500, 500); | 55 runClearBreakpointsTest(500, 500); |
| 56 runClearBreakpointsTest(501, 500); | 56 runClearBreakpointsTest(501, 500); |
| 57 runClearBreakpointsTest(1000, 500); | 57 runClearBreakpointsTest(1000, 500); |
| 58 next(); | 58 next(); |
| 59 } | 59 } |
| 60 ]); | 60 ]); |
| 61 } | 61 } |
| 62 </script> | 62 </script> |
| 63 </head> | 63 </head> |
| 64 <body onload="runTest()"> | 64 <body onload="runTest()"> |
| 65 <p>Tests inspector version controller.</p> | 65 <p>Tests inspector version controller.</p> |
| 66 </body> | 66 </body> |
| 67 </html> | 67 </html> |
| OLD | NEW |