Index: LayoutTests/fast/files/file-constructor.html |
diff --git a/LayoutTests/fast/files/file-constructor.html b/LayoutTests/fast/files/file-constructor.html |
index f615864f75e496d559deab8828f0874b669cf0b7..61c979b27d90a9d5de9dee57506f8fafabdbaf40 100644 |
--- a/LayoutTests/fast/files/file-constructor.html |
+++ b/LayoutTests/fast/files/file-constructor.html |
@@ -87,6 +87,23 @@ shouldBe("(new File([], 'world.html', {type:'text/html'})).type", "'text/html'") |
shouldBe("(new File([], 'world.html', {type:'text/html'})).size", "0"); |
shouldBe("(new File([], 'world.html', {type:'text/plain;charset=UTF-8'})).type", "'text/plain;charset=utf-8'"); |
+// Test that the lastModified is correctly added to the File. |
+var aDate = new Date(441532800000); |
+shouldBe("(new File([], 'world.html', {lastModified: 441532800000})).lastModified", "441532800000"); |
+// Unless specified, lastModifiedDate should default to now. |
kinuko
2013/11/20 08:01:22
nit: lastModifiedDate -> lastModified
pwnall-personal
2013/11/20 09:51:07
Done.
Thank you!
|
+var startTime = Date.now(); |
+var fileTime = (new File([], 'world.html')).lastModified; |
+var endTime = Date.now(); |
+// FIXME: these checks will fail if time goes backwards, e.g. NTP updates. We should have a generic bullet-proof method for comparing against Date.now(). http://crbug.com/320686 |
+shouldBeTrue("startTime <= fileTime"); |
+shouldBeTrue("fileTime <= endTime"); |
+// Test that Date instances are implicitly converted to numbers. |
+shouldBe("(new File([], 'world.html', {lastModified: new Date(441532800000)})).lastModified", "441532800000"); |
+ |
+// Test the deprecated attribute lastModifiedTime. |
kinuko
2013/11/20 08:01:22
lastModifiedTime -> lastModifiedDate ?
pwnall-personal
2013/11/20 09:51:07
Done.
I'm so glad this name is going away :)
|
+shouldBeTrue("(new File([], 'world.html', {lastModified: 441532800000})).lastModifiedDate instanceof Date"); |
+shouldBe("(new File([], 'world.html', {lastModified: 441532800000})).lastModifiedDate.valueOf()", "441532800000"); |
+ |
// Test the number of expected arguments in the File constructor. |
shouldBe("window.File.length", "2"); |