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

Side by Side Diff: webkit/fileapi/sandbox_mount_point_provider_unittest.cc

Issue 14265022: [Quota][FileAPI] Add quota policy to FileSystemOperationContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add special storage policy Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/sandbox_mount_point_provider.cc ('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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/fileapi/sandbox_mount_point_provider.h" 5 #include "webkit/fileapi/sandbox_mount_point_provider.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 22 matching lines...) Expand all
33 33
34 class SandboxMountPointProviderOriginEnumeratorTest : public testing::Test { 34 class SandboxMountPointProviderOriginEnumeratorTest : public testing::Test {
35 public: 35 public:
36 virtual void SetUp() { 36 virtual void SetUp() {
37 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 37 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
38 sandbox_provider_.reset( 38 sandbox_provider_.reset(
39 new SandboxMountPointProvider( 39 new SandboxMountPointProvider(
40 NULL, 40 NULL,
41 base::MessageLoopProxy::current(), 41 base::MessageLoopProxy::current(),
42 data_dir_.path(), 42 data_dir_.path(),
43 CreateAllowFileAccessOptions())); 43 CreateAllowFileAccessOptions(),
44 NULL));
44 } 45 }
45 46
46 SandboxMountPointProvider::OriginEnumerator* CreateEnumerator() const { 47 SandboxMountPointProvider::OriginEnumerator* CreateEnumerator() const {
47 return sandbox_provider_->CreateOriginEnumerator(); 48 return sandbox_provider_->CreateOriginEnumerator();
48 } 49 }
49 50
50 protected: 51 protected:
51 void CreateOriginTypeDirectory(const GURL& origin, 52 void CreateOriginTypeDirectory(const GURL& origin,
52 fileapi::FileSystemType type) { 53 fileapi::FileSystemType type) {
53 base::FilePath target = sandbox_provider_-> 54 base::FilePath target = sandbox_provider_->
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 114
114 EXPECT_EQ(temporary_size, temporary_actual_size); 115 EXPECT_EQ(temporary_size, temporary_actual_size);
115 EXPECT_EQ(persistent_size, persistent_actual_size); 116 EXPECT_EQ(persistent_size, persistent_actual_size);
116 } 117 }
117 118
118 TEST(SandboxMountPointProviderTest, AccessPermissions) { 119 TEST(SandboxMountPointProviderTest, AccessPermissions) {
119 MessageLoop message_loop_; 120 MessageLoop message_loop_;
120 SandboxMountPointProvider provider( 121 SandboxMountPointProvider provider(
121 NULL, base::MessageLoopProxy::current(), base::FilePath(), 122 NULL, base::MessageLoopProxy::current(), base::FilePath(),
122 CreateAllowFileAccessOptions()); 123 CreateAllowFileAccessOptions(), NULL);
123 124
124 // Any access should be allowed in sandbox directory. 125 // Any access should be allowed in sandbox directory.
125 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW, 126 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW,
126 provider.GetPermissionPolicy(CreateFileSystemURL("foo"), 127 provider.GetPermissionPolicy(CreateFileSystemURL("foo"),
127 kReadFilePermissions)); 128 kReadFilePermissions));
128 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW, 129 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW,
129 provider.GetPermissionPolicy(CreateFileSystemURL("foo"), 130 provider.GetPermissionPolicy(CreateFileSystemURL("foo"),
130 kWriteFilePermissions)); 131 kWriteFilePermissions));
131 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW, 132 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW,
132 provider.GetPermissionPolicy(CreateFileSystemURL("foo"), 133 provider.GetPermissionPolicy(CreateFileSystemURL("foo"),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 provider.GetPermissionPolicy(CreateFileSystemURL(".b"), 193 provider.GetPermissionPolicy(CreateFileSystemURL(".b"),
193 kCreateFilePermissions)); 194 kCreateFilePermissions));
194 195
195 // A path that looks like a drive letter. 196 // A path that looks like a drive letter.
196 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW, 197 EXPECT_EQ(FILE_PERMISSION_ALWAYS_ALLOW,
197 provider.GetPermissionPolicy(CreateFileSystemURL("c:"), 198 provider.GetPermissionPolicy(CreateFileSystemURL("c:"),
198 kCreateFilePermissions)); 199 kCreateFilePermissions));
199 } 200 }
200 201
201 } // namespace fileapi 202 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/sandbox_mount_point_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698