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