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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/DOMFileSystemBaseTest.cpp

Issue 2297043002: Web expose FileSystemFileEntry, FileSystemDirectoryEntry and friends (Closed)
Patch Set: Rebased Created 4 years 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
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 "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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698