Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / date-DST-time-cusps.js
blob710945d2053ca0c192b02bf7b4ddb7f9bfb7966b
1 description(
2 "This tests times that shouldn't happen because of DST, or times that happen twice"
3 );
5 description(
6 "For times that shouldn't happen we currently go back an hour, but in reality we would like to go forward an hour. This has been filed as a radar: 4777813"
7 );
9 description(
10 "For times that happen twice the behavior of all major browsers seems to be to pick the second occurance, i.e. Standard Time not Daylight Time"
13 var testCases = [];
14 if ((new Date(2009, 9, 1)).toString().match("PDT")) {
15 testCases.push(["(new Date(1982, 2, 14, 2, 10)).getHours()", "1"]);
16 testCases.push(["(new Date(1982, 2, 14, 2)).getHours()", "1"]);
17 testCases.push(["(new Date(1982, 11, 7, 1, 10)).getTimezoneOffset()", "480"]);
18 testCases.push(["(new Date(1982, 11, 7, 1)).getTimezoneOffset()", "480"]);
21 var errors = [];
22 for (var i = 0; i < testCases.length; i++) {
23 var actual = eval(testCases[i][0]);
24 var expected = eval(testCases[i][1]);
25 if (actual != expected) {
26 errors.push(testCases[i][0] + " should be " + testCases[i][1] + ". Was " + actual + ".");
30 if (errors.length) {
31 testFailed(errors.length + "/" + testCases.length + " tests were failed: " + errors.join(", "));
32 } else {
33 testPassed("Passed all tests (or skipped all tests if your timezone isn't PST/PDT)");