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

Side by Side Diff: Source/core/fileapi/FileTest.cpp

Issue 660763004: Fix the hasBackingFile flag for File backed by a file system URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Add test. 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "File.h"
7
8 #include <gtest/gtest.h>
9
10 namespace blink {
11
12 TEST(FileTest, nativeFile)
13 {
14 File* const file = File::create("/native/path");
15 EXPECT_TRUE(file->hasBackingFile());
16 EXPECT_EQ("/native/path", file->path());
17 EXPECT_TRUE(file->fileSystemURL().isEmpty());
18 }
19
20 TEST(FileTest, blobBackingFile)
21 {
22 const RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create();
23 File* const file = File::create("name", 0.0, blobDataHandle);
24 EXPECT_FALSE(file->hasBackingFile());
25 EXPECT_TRUE(file->path().isEmpty());
26 EXPECT_TRUE(file->fileSystemURL().isEmpty());
27 }
28
29 TEST(FileTest, fileSystemFileWithNativeSnapshot)
30 {
31 FileMetadata metadata;
32 metadata.platformPath = "/native/snapshot";
33 File* const file = File::createForFileSystemFile("name", metadata, File::IsU serVisible);
34 EXPECT_TRUE(file->hasBackingFile());
35 EXPECT_EQ("/native/snapshot", file->path());
36 EXPECT_TRUE(file->fileSystemURL().isEmpty());
37 }
38
39 TEST(FileTest, fileSystemFileWithoutNativeSnapshot)
40 {
41 KURL url(ParsedURLStringTag(), "filesystem:http://example.com/isolated/hash/ non-native-file");
42 FileMetadata metadata;
43 File* const file = File::createForFileSystemFile(url, metadata);
44 EXPECT_FALSE(file->hasBackingFile());
45 EXPECT_TRUE(file->path().isEmpty());
46 EXPECT_EQ(url, file->fileSystemURL());
47 }
48
49 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fileapi/File.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698