OLD | NEW |
(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 |
OLD | NEW |