Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / harness / should-be-now.html
blob036461348887840f68facad63f38802c49e0290f
1 <!DOCTYPE html>
3 <script src="../../resources/js-test.js"></script>
4 <script>
5 description('Test shouldBeNow() in js-test.js');
7 shouldBeNow("Date.now()");
8 shouldBeNow("new Date()");
10 debug("Testing type checking with a string. This should fail.");
11 shouldBeNow("'Hello world!'");
13 function stubDateNow(stubValue, callback)
15 var realDateNow = Date.now;
16 Date.now = function() { return stubValue; }
17 try {
18 callback();
19 } finally {
20 Date.now = realDateNow;
24 debug("Testing past dates. This should fail.");
25 stubDateNow(60000, function() {
26 shouldBeNow("50000");
27 });
29 debug("Testing future dates. This should fail.");
30 stubDateNow(60000, function() {
31 shouldBeNow("70000");
32 });
34 debug("Testing a slightly past date with the implicit delta. This should pass.");
35 stubDateNow(60000, function() {
36 shouldBeNow("59990");
37 });
39 debug("Testing a slightly future date with the implicit delta. This should pass.");
40 stubDateNow(60000, function() {
41 shouldBeNow("60010");
42 });
44 debug("Testing a past date with a large delta. This should pass.");
45 stubDateNow(60000, function() {
46 shouldBeNow("50000", 10000);
47 });
49 debug("Testing a future date with a large delta. This should pass.");
50 stubDateNow(60000, function() {
51 shouldBeNow("70000", 10000);
52 });
54 debug("Simulating a defective clock that always goes backwards. The test below should fail.");
55 var badClock = Date.now();
56 var realDateNow = Date.now;
57 Date.now = function() { return --badClock; }
58 shouldBeNow("new Date()");
59 Date.now = realDateNow;
60 </script>