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

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

Issue 9016020: Cleanup FileSystemOperation for preparing for adding FSO-factory method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 11 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 "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 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 SandboxMountPointProvider* sandbox_provider() { 152 SandboxMountPointProvider* sandbox_provider() {
153 return file_system_context_->sandbox_provider(); 153 return file_system_context_->sandbox_provider();
154 } 154 }
155 155
156 FileSystemFileUtil* file_util() { 156 FileSystemFileUtil* file_util() {
157 return sandbox_provider()->GetFileUtil(); 157 return sandbox_provider()->GetFileUtil();
158 } 158 }
159 159
160 void OnGetRootPath(bool success, const FilePath& unused, 160 void OnValidate(base::PlatformFileError result) {
161 const std::string& unused_also) { 161 EXPECT_NE(base::PLATFORM_FILE_OK, result); // We told it not to create.
162 EXPECT_FALSE(success); // We told it not to create.
163 } 162 }
164 163
165 FileSystemMountPointProvider::GetRootPathCallback GetRootPathCallback() { 164 FileSystemMountPointProvider::ValidateFileSystemCallback
166 return base::Bind(&SandboxMountPointProviderMigrationTest::OnGetRootPath, 165 GetValidateCallback() {
166 return base::Bind(&SandboxMountPointProviderMigrationTest::OnValidate,
167 weak_factory_.GetWeakPtr()); 167 weak_factory_.GetWeakPtr());
168 } 168 }
169 169
170 void EnsureFileExists(const FilePath& path) { 170 void EnsureFileExists(const FilePath& path) {
171 bool created = false; 171 bool created = false;
172 PlatformFileError error_code = base::PLATFORM_FILE_OK; 172 PlatformFileError error_code = base::PLATFORM_FILE_OK;
173 PlatformFile handle = base::CreatePlatformFile( 173 PlatformFile handle = base::CreatePlatformFile(
174 path, 174 path,
175 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ, 175 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ,
176 &created, &error_code); 176 &created, &error_code);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 bool create = false; 276 bool create = false;
277 std::set<GURL> origins; 277 std::set<GURL> origins;
278 std::string host = "the host with the most"; 278 std::string host = "the host with the most";
279 int64 delta = 0; 279 int64 delta = 0;
280 280
281 // We want to make sure that all the public methods of 281 // We want to make sure that all the public methods of
282 // SandboxMountPointProvider which might access the filesystem will cause a 282 // SandboxMountPointProvider which might access the filesystem will cause a
283 // migration if one is needed. 283 // migration if one is needed.
284 switch (method) { 284 switch (method) {
285 case 0: 285 case 0:
286 sandbox_provider()->ValidateFileSystemRootAndGetURL( 286 sandbox_provider()->ValidateFileSystemRoot(
287 origin_url, type, create, GetRootPathCallback()); 287 origin_url, type, create, GetValidateCallback());
288 MessageLoop::current()->RunAllPending(); 288 MessageLoop::current()->RunAllPending();
289 break; 289 break;
290 case 1: 290 case 1:
291 sandbox_provider()->ValidateFileSystemRootAndGetPathOnFileThread( 291 sandbox_provider()->GetFileSystemRootPathOnFileThread(
292 origin_url, type, FilePath(), create); 292 origin_url, type, FilePath(), create);
293 break; 293 break;
294 case 2: 294 case 2:
295 sandbox_provider()->GetBaseDirectoryForOriginAndType( 295 sandbox_provider()->GetBaseDirectoryForOriginAndType(
296 origin_url, type, create); 296 origin_url, type, create);
297 break; 297 break;
298 case 3: 298 case 3:
299 sandbox_provider()->DeleteOriginDataOnFileThread( 299 sandbox_provider()->DeleteOriginDataOnFileThread(
300 NULL, origin_url, type); 300 NULL, origin_url, type);
301 break; 301 break;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 385
386 TEST_F(SandboxMountPointProviderMigrationTest, TestMigrateViaMethod8) { 386 TEST_F(SandboxMountPointProviderMigrationTest, TestMigrateViaMethod8) {
387 RunMigrationTest(8); 387 RunMigrationTest(8);
388 } 388 }
389 389
390 TEST_F(SandboxMountPointProviderMigrationTest, TestMigrateViaMethod9) { 390 TEST_F(SandboxMountPointProviderMigrationTest, TestMigrateViaMethod9) {
391 RunMigrationTest(9); 391 RunMigrationTest(9);
392 } 392 }
393 393
394 } // namespace fileapi 394 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698