Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/misc/last-modified-parsing.html

Issue 2698773005: document.lastModified: treat invalid dates like unknown ones. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/misc/last-modified-parsing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 if (window.testRunner) { 2 if (window.testRunner) {
3 testRunner.dumpAsText(); 3 testRunner.dumpAsText();
4 testRunner.dumpChildFramesAsText(); 4 testRunner.dumpChildFramesAsText();
5 } 5 }
6 6
7 function getExpectedLastModified(lastModified) { 7 function getExpectedLastModified(lastModified) {
8 var date = new Date(lastModified); 8 var date = new Date(lastModified);
9 if (isNaN(date.getTime()))
10 return "illformed-date";
9 var month = ('0' + (date.getMonth() + 1)).slice(-2); 11 var month = ('0' + (date.getMonth() + 1)).slice(-2);
10 var day = ('0' + date.getDate()).slice(-2); 12 var day = ('0' + date.getDate()).slice(-2);
11 var hour = ('0' + date.getHours()).slice(-2); 13 var hour = ('0' + date.getHours()).slice(-2);
12 var minute = ('0' + date.getMinutes()).slice(-2); 14 var minute = ('0' + date.getMinutes()).slice(-2);
13 var second = ('0' + date.getSeconds()).slice(-2); 15 var second = ('0' + date.getSeconds()).slice(-2);
14 var result = month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + minute + ':' + second; 16 var result = month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + minute + ':' + second;
15 return result; 17 return result;
16 } 18 }
17 19
18 function test(text) { 20 function test(text) {
19 var url = '../resources/last-modified.php?date=' + escape(text) + '&expected =' + escape(getExpectedLastModified(text)); 21 var url = '../resources/last-modified.php?date=' + escape(text) + '&expected =' + escape(getExpectedLastModified(text));
20 document.write('<iframe id="test" src="' + url + '"></iframe>'); 22 document.write('<iframe id="test" src="' + url + '"></iframe>');
21 } 23 }
22 24
23 test('Mon, 21 Nov 2008 01:03:33 GMT'); 25 test('Mon, 21 Nov 2008 01:03:33 GMT');
24 test('Tuesday, 21 Nov 2008 01:03:33 GMT'); 26 test('Tuesday, 21 Nov 2008 01:03:33 GMT');
25 test('Mon, 21 Nov 97 01:03:33 GMT'); 27 test('Mon, 21 Nov 97 01:03:33 GMT');
26 test('Mon, 21-Nov-2008 01:03:33 GMT'); 28 test('Mon, 21-Nov-2008 01:03:33 GMT');
27 test('Mon, 21-Feb-2008 01:03:33 GMT'); 29 test('Mon, 21-Feb-2008 01:03:33 GMT');
28 test('Mon, 03-Feb-2008 01:03:33 GMT'); 30 test('Mon, 03-Feb-2008 01:03:33 GMT');
29 test('Mon, 3-Mar-2008 01:03:33 GMT'); 31 test('Mon, 3-Mar-2008 01:03:33 GMT');
32 test('Something ill-formed');
30 </script> 33 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/misc/last-modified-parsing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698