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

Unified Diff: Source/core/fileapi/FileTest.cpp

Issue 640723006: Pass the selected non-native file information from the browser to FileInputType. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Exclude the separated patch's lines Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/fileapi/FileTest.cpp
diff --git a/Source/core/fileapi/FileTest.cpp b/Source/core/fileapi/FileTest.cpp
index a7f409b3a1eb293ff2888a988c1dbc3fb52668db..3d117cb1eea575f2852d3a14ea1401c2c0b0386b 100644
--- a/Source/core/fileapi/FileTest.cpp
+++ b/Source/core/fileapi/FileTest.cpp
@@ -46,4 +46,40 @@ TEST(FileTest, fileSystemFileWithoutNativeSnapshot)
EXPECT_EQ(url, file->fileSystemURL());
}
+TEST(FileTest, hsaSameSource)
+{
+ File* const nativeFileA1 = File::create("/native/pathA");
+ File* const nativeFileA2 = File::create("/native/pathA");
+ File* const nativeFileB = File::create("/native/pathB");
+
+ const RefPtr<BlobDataHandle> blobDataA = BlobDataHandle::create();
+ const RefPtr<BlobDataHandle> blobDataB = BlobDataHandle::create();
+ File* const blobFileA1 = File::create("name", 0.0, blobDataA);
+ File* const blobFileA2 = File::create("name", 0.0, blobDataA);
+ File* const blobFileB = File::create("name", 0.0, blobDataB);
+
+ KURL urlA(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/non-native-file-A");
+ KURL urlB(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/non-native-file-B");
+ FileMetadata metadata;
+ File* const fileSystemFileA1 = File::createForFileSystemFile(urlA, metadata);
+ File* const fileSystemFileA2 = File::createForFileSystemFile(urlA, metadata);
+ File* const fileSystemFileB = File::createForFileSystemFile(urlB, metadata);
+
+ EXPECT_FALSE(nativeFileA1->hasSameSource(*blobFileA1));
+ EXPECT_FALSE(blobFileA1->hasSameSource(*fileSystemFileA1));
+ EXPECT_FALSE(fileSystemFileA1->hasSameSource(*nativeFileA1));
+
+ EXPECT_TRUE(nativeFileA1->hasSameSource(*nativeFileA1));
+ EXPECT_TRUE(nativeFileA1->hasSameSource(*nativeFileA2));
+ EXPECT_FALSE(nativeFileA1->hasSameSource(*nativeFileB));
+
+ EXPECT_TRUE(blobFileA1->hasSameSource(*blobFileA1));
+ EXPECT_TRUE(blobFileA1->hasSameSource(*blobFileA2));
+ EXPECT_FALSE(blobFileA1->hasSameSource(*blobFileB));
+
+ EXPECT_TRUE(fileSystemFileA1->hasSameSource(*fileSystemFileA1));
+ EXPECT_TRUE(fileSystemFileA1->hasSameSource(*fileSystemFileA2));
+ EXPECT_FALSE(fileSystemFileA1->hasSameSource(*fileSystemFileB));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698