| OLD | NEW |
| 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 "modules/filesystem/DOMFileSystemBase.h" | 5 #include "modules/filesystem/FileSystemBase.h" |
| 6 | 6 |
| 7 #include "core/fileapi/File.h" | 7 #include "core/fileapi/File.h" |
| 8 #include "platform/testing/UnitTestHelpers.h" | 8 #include "platform/testing/UnitTestHelpers.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class DOMFileSystemBaseTest : public ::testing::Test { | 13 class FileSystemBaseTest : public ::testing::Test { |
| 14 public: | 14 public: |
| 15 DOMFileSystemBaseTest() { | 15 FileSystemBaseTest() { |
| 16 m_filePath = testing::blinkRootDir(); | 16 m_filePath = testing::blinkRootDir(); |
| 17 m_filePath.append("/Source/modules/filesystem/DOMFileSystemBaseTest.cpp"); | 17 m_filePath.append("/Source/modules/filesystem/FileSystemBaseTest.cpp"); |
| 18 getFileMetadata(m_filePath, m_fileMetadata); | 18 getFileMetadata(m_filePath, m_fileMetadata); |
| 19 m_fileMetadata.platformPath = m_filePath; | 19 m_fileMetadata.platformPath = m_filePath; |
| 20 } | 20 } |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 String m_filePath; | 23 String m_filePath; |
| 24 FileMetadata m_fileMetadata; | 24 FileMetadata m_fileMetadata; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 TEST_F(DOMFileSystemBaseTest, externalFilesystemFilesAreUserVisible) { | 27 TEST_F(FileSystemBaseTest, externalFilesystemFilesAreUserVisible) { |
| 28 KURL rootUrl = DOMFileSystemBase::createFileSystemRootURL( | 28 KURL rootUrl = FileSystemBase::createFileSystemRootURL( |
| 29 "http://chromium.org/", FileSystemTypeExternal); | 29 "http://chromium.org/", FileSystemTypeExternal); |
| 30 | 30 |
| 31 File* file = DOMFileSystemBase::createFile(m_fileMetadata, rootUrl, | 31 File* file = FileSystemBase::createFile(m_fileMetadata, rootUrl, |
| 32 FileSystemTypeExternal, | 32 FileSystemTypeExternal, |
| 33 "DOMFileSystemBaseTest.cpp"); | 33 "FileSystemBaseTest.cpp"); |
| 34 EXPECT_TRUE(file); | 34 EXPECT_TRUE(file); |
| 35 EXPECT_TRUE(file->hasBackingFile()); | 35 EXPECT_TRUE(file->hasBackingFile()); |
| 36 EXPECT_EQ(File::IsUserVisible, file->getUserVisibility()); | 36 EXPECT_EQ(File::IsUserVisible, file->getUserVisibility()); |
| 37 EXPECT_EQ("DOMFileSystemBaseTest.cpp", file->name()); | 37 EXPECT_EQ("FileSystemBaseTest.cpp", file->name()); |
| 38 EXPECT_EQ(m_filePath, file->path()); | 38 EXPECT_EQ(m_filePath, file->path()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TEST_F(DOMFileSystemBaseTest, temporaryFilesystemFilesAreNotUserVisible) { | 41 TEST_F(FileSystemBaseTest, temporaryFilesystemFilesAreNotUserVisible) { |
| 42 KURL rootUrl = DOMFileSystemBase::createFileSystemRootURL( | 42 KURL rootUrl = FileSystemBase::createFileSystemRootURL( |
| 43 "http://chromium.org/", FileSystemTypeTemporary); | 43 "http://chromium.org/", FileSystemTypeTemporary); |
| 44 | 44 |
| 45 File* file = DOMFileSystemBase::createFile( | 45 File* file = FileSystemBase::createFile( |
| 46 m_fileMetadata, rootUrl, FileSystemTypeTemporary, "UserVisibleName.txt"); | 46 m_fileMetadata, rootUrl, FileSystemTypeTemporary, "UserVisibleName.txt"); |
| 47 EXPECT_TRUE(file); | 47 EXPECT_TRUE(file); |
| 48 EXPECT_TRUE(file->hasBackingFile()); | 48 EXPECT_TRUE(file->hasBackingFile()); |
| 49 EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility()); | 49 EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility()); |
| 50 EXPECT_EQ("UserVisibleName.txt", file->name()); | 50 EXPECT_EQ("UserVisibleName.txt", file->name()); |
| 51 EXPECT_EQ(m_filePath, file->path()); | 51 EXPECT_EQ(m_filePath, file->path()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 TEST_F(DOMFileSystemBaseTest, persistentFilesystemFilesAreNotUserVisible) { | 54 TEST_F(FileSystemBaseTest, persistentFilesystemFilesAreNotUserVisible) { |
| 55 KURL rootUrl = DOMFileSystemBase::createFileSystemRootURL( | 55 KURL rootUrl = FileSystemBase::createFileSystemRootURL( |
| 56 "http://chromium.org/", FileSystemTypePersistent); | 56 "http://chromium.org/", FileSystemTypePersistent); |
| 57 | 57 |
| 58 File* file = DOMFileSystemBase::createFile( | 58 File* file = FileSystemBase::createFile( |
| 59 m_fileMetadata, rootUrl, FileSystemTypePersistent, "UserVisibleName.txt"); | 59 m_fileMetadata, rootUrl, FileSystemTypePersistent, "UserVisibleName.txt"); |
| 60 EXPECT_TRUE(file); | 60 EXPECT_TRUE(file); |
| 61 EXPECT_TRUE(file->hasBackingFile()); | 61 EXPECT_TRUE(file->hasBackingFile()); |
| 62 EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility()); | 62 EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility()); |
| 63 EXPECT_EQ("UserVisibleName.txt", file->name()); | 63 EXPECT_EQ("UserVisibleName.txt", file->name()); |
| 64 EXPECT_EQ(m_filePath, file->path()); | 64 EXPECT_EQ(m_filePath, file->path()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace blink | 67 } // namespace blink |
| OLD | NEW |