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

Side by Side 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: Fixed. 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 unified diff | Download patch
« no previous file with comments | « Source/core/fileapi/File.cpp ('k') | Source/core/html/forms/FileInputType.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "File.h" 6 #include "File.h"
7 7
8 #include <gtest/gtest.h> 8 #include <gtest/gtest.h>
9 9
10 namespace blink { 10 namespace blink {
(...skipping 28 matching lines...) Expand all
39 TEST(FileTest, fileSystemFileWithoutNativeSnapshot) 39 TEST(FileTest, fileSystemFileWithoutNativeSnapshot)
40 { 40 {
41 KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/ non-native-file"); 41 KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/ non-native-file");
42 FileMetadata metadata; 42 FileMetadata metadata;
43 File* const file = File::createForFileSystemFile(url, metadata); 43 File* const file = File::createForFileSystemFile(url, metadata);
44 EXPECT_FALSE(file->hasBackingFile()); 44 EXPECT_FALSE(file->hasBackingFile());
45 EXPECT_TRUE(file->path().isEmpty()); 45 EXPECT_TRUE(file->path().isEmpty());
46 EXPECT_EQ(url, file->fileSystemURL()); 46 EXPECT_EQ(url, file->fileSystemURL());
47 } 47 }
48 48
49 TEST(FileTest, hsaSameSource)
50 {
51 File* const nativeFileA1 = File::create("/native/pathA");
52 File* const nativeFileA2 = File::create("/native/pathA");
53 File* const nativeFileB = File::create("/native/pathB");
54
55 const RefPtr<BlobDataHandle> blobDataA = BlobDataHandle::create();
56 const RefPtr<BlobDataHandle> blobDataB = BlobDataHandle::create();
57 File* const blobFileA1 = File::create("name", 0.0, blobDataA);
58 File* const blobFileA2 = File::create("name", 0.0, blobDataA);
59 File* const blobFileB = File::create("name", 0.0, blobDataB);
60
61 KURL urlA(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash /non-native-file-A");
62 KURL urlB(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash /non-native-file-B");
63 FileMetadata metadata;
64 File* const fileSystemFileA1 = File::createForFileSystemFile(urlA, metadata) ;
65 File* const fileSystemFileA2 = File::createForFileSystemFile(urlA, metadata) ;
66 File* const fileSystemFileB = File::createForFileSystemFile(urlB, metadata);
67
68 EXPECT_FALSE(nativeFileA1->hasSameSource(*blobFileA1));
69 EXPECT_FALSE(blobFileA1->hasSameSource(*fileSystemFileA1));
70 EXPECT_FALSE(fileSystemFileA1->hasSameSource(*nativeFileA1));
71
72 EXPECT_TRUE(nativeFileA1->hasSameSource(*nativeFileA1));
73 EXPECT_TRUE(nativeFileA1->hasSameSource(*nativeFileA2));
74 EXPECT_FALSE(nativeFileA1->hasSameSource(*nativeFileB));
75
76 EXPECT_TRUE(blobFileA1->hasSameSource(*blobFileA1));
77 EXPECT_TRUE(blobFileA1->hasSameSource(*blobFileA2));
78 EXPECT_FALSE(blobFileA1->hasSameSource(*blobFileB));
79
80 EXPECT_TRUE(fileSystemFileA1->hasSameSource(*fileSystemFileA1));
81 EXPECT_TRUE(fileSystemFileA1->hasSameSource(*fileSystemFileA2));
82 EXPECT_FALSE(fileSystemFileA1->hasSameSource(*fileSystemFileB));
83 }
84
49 } // namespace blink 85 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/File.cpp ('k') | Source/core/html/forms/FileInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698