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

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

Issue 14096022: Make MountPointProvider pluggable from outside webkit/fileapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } // namespace 109 } // namespace
110 110
111 class FileSystemMountPointProviderTest : public testing::Test { 111 class FileSystemMountPointProviderTest : public testing::Test {
112 public: 112 public:
113 FileSystemMountPointProviderTest() 113 FileSystemMountPointProviderTest()
114 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 114 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
115 } 115 }
116 116
117 virtual void SetUp() { 117 virtual void SetUp() {
118 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 118 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
119 special_storage_policy_ = new quota::MockSpecialStoragePolicy;
120 } 119 }
121 120
122 protected: 121 protected:
123 void SetupNewContext(const FileSystemOptions& options) { 122 void SetupNewContext(const FileSystemOptions& options) {
124 scoped_refptr<ExternalMountPoints> external_mount_points( 123 scoped_refptr<ExternalMountPoints> external_mount_points(
125 ExternalMountPoints::CreateRefCounted()); 124 ExternalMountPoints::CreateRefCounted());
125 std::vector<MountPoints*> additional_mount_points;
126 additional_mount_points.push_back(external_mount_points);
126 file_system_context_ = new FileSystemContext( 127 file_system_context_ = new FileSystemContext(
127 FileSystemTaskRunners::CreateMockTaskRunners(), 128 FileSystemTaskRunners::CreateMockTaskRunners(),
128 external_mount_points.get(),
129 special_storage_policy_,
130 NULL, 129 NULL,
130 ScopedVector<FileSystemMountPointProvider>(),
131 additional_mount_points,
131 data_dir_.path(), 132 data_dir_.path(),
132 options); 133 options);
133 #if defined(OS_CHROMEOS) 134 #if defined(OS_CHROMEOS)
134 base::FilePath mount_point_path = base::FilePath(kMountPoint); 135 base::FilePath mount_point_path = base::FilePath(kMountPoint);
135 external_mount_points->RegisterFileSystem( 136 external_mount_points->RegisterFileSystem(
136 mount_point_path.BaseName().AsUTF8Unsafe(), 137 mount_point_path.BaseName().AsUTF8Unsafe(),
137 kFileSystemTypeNativeLocal, 138 kFileSystemTypeNativeLocal,
138 mount_point_path); 139 mount_point_path);
139 #endif 140 #endif
140 } 141 }
(...skipping 26 matching lines...) Expand all
167 } 168 }
168 FileSystemContext* file_system_context() const { 169 FileSystemContext* file_system_context() const {
169 return file_system_context_.get(); 170 return file_system_context_.get();
170 } 171 }
171 172
172 private: 173 private:
173 base::ScopedTempDir data_dir_; 174 base::ScopedTempDir data_dir_;
174 MessageLoop message_loop_; 175 MessageLoop message_loop_;
175 base::WeakPtrFactory<FileSystemMountPointProviderTest> weak_factory_; 176 base::WeakPtrFactory<FileSystemMountPointProviderTest> weak_factory_;
176 177
177 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
178 scoped_refptr<FileSystemContext> file_system_context_; 178 scoped_refptr<FileSystemContext> file_system_context_;
179 179
180 DISALLOW_COPY_AND_ASSIGN(FileSystemMountPointProviderTest); 180 DISALLOW_COPY_AND_ASSIGN(FileSystemMountPointProviderTest);
181 }; 181 };
182 182
183 TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamine) { 183 TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamine) {
184 std::vector<base::FilePath> returned_root_path( 184 std::vector<base::FilePath> returned_root_path(
185 ARRAYSIZE_UNSAFE(kRootPathTestCases)); 185 ARRAYSIZE_UNSAFE(kRootPathTestCases));
186 SetupNewContext(CreateAllowFileAccessOptions()); 186 SetupNewContext(CreateAllowFileAccessOptions());
187 187
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 kRootPathFileURITestCases[i].type, 297 kRootPathFileURITestCases[i].type,
298 true /* create */, &root_path)); 298 true /* create */, &root_path));
299 base::FilePath expected = file_system_path().AppendASCII( 299 base::FilePath expected = file_system_path().AppendASCII(
300 kRootPathFileURITestCases[i].expected_path); 300 kRootPathFileURITestCases[i].expected_path);
301 EXPECT_EQ(expected.value(), root_path.value()); 301 EXPECT_EQ(expected.value(), root_path.value());
302 EXPECT_TRUE(file_util::DirectoryExists(root_path)); 302 EXPECT_TRUE(file_util::DirectoryExists(root_path));
303 } 303 }
304 } 304 }
305 305
306 } // namespace fileapi 306 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698