Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / version-controller.html
blob7289f1f1e611d905984424b675c3cf3208fdf1ff
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script>
5 function test()
7 function createBreakpoint(uiSourceCodeId, lineNumber, condition, enabled)
9 return { sourceFileId: uiSourceCodeId, lineNumber: lineNumber, condition: condition, enabled: enabled };
12 InspectorTest.runTestSuite([
13 function testMethodsToRunToUpdateVersion(next)
15 function runVersionControllerTest(oldVersion, currentVersion)
17 InspectorTest.addResult("Testing methods to run to upgrade from " + oldVersion + " to " + currentVersion + ".");
18 var versionController = new WebInspector.VersionController();
19 var methodsToRun = versionController._methodsToRunToUpdateVersion(oldVersion, currentVersion);
20 InspectorTest.addResult("Methods to run: " + JSON.stringify(methodsToRun));
21 InspectorTest.addResult("");
24 runVersionControllerTest(0, 0);
25 runVersionControllerTest(0, 1);
26 runVersionControllerTest(0, 2);
27 runVersionControllerTest(0, 3);
28 runVersionControllerTest(1, 1);
29 runVersionControllerTest(1, 2);
30 runVersionControllerTest(1, 3);
31 runVersionControllerTest(2, 2);
32 runVersionControllerTest(2, 3);
33 next();
36 function testClearBreakpointsWhenTooMany(next)
38 function runClearBreakpointsTest(breakpointsCount, maxBreakpointsCount)
40 InspectorTest.addResult("Starting test with " + breakpointsCount + " breakpoints and " + maxBreakpointsCount + " allowed at max.");
41 var versionController = new WebInspector.VersionController();
42 var serializedBreakpoints = [];
43 for (var i = 0; i < breakpointsCount; ++i)
44 serializedBreakpoints.push(createBreakpoint("file" + i + ".js", i % 10, "", true));
45 var breakpointsSetting = new InspectorTest.MockSetting(serializedBreakpoints);
46 versionController._clearBreakpointsWhenTooMany(breakpointsSetting, maxBreakpointsCount);
47 InspectorTest.addResult("Number of breakpoints left in the setting after the test: " + breakpointsSetting.get().length + ".");
48 InspectorTest.addResult("");
51 runClearBreakpointsTest(0, 500);
52 runClearBreakpointsTest(1, 500);
53 runClearBreakpointsTest(2, 500);
54 runClearBreakpointsTest(499, 500);
55 runClearBreakpointsTest(500, 500);
56 runClearBreakpointsTest(501, 500);
57 runClearBreakpointsTest(1000, 500);
58 next();
60 ]);
62 </script>
63 </head>
64 <body onload="runTest()">
65 <p>Tests inspector version controller.</p>
66 </body>
67 </html>