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

Side by Side Diff: webkit/browser/fileapi/sandbox_file_system_test_helper.cc

Issue 15959006: Deprecate FileSystemMountPointProvider::GetFileSystemRootPathOnFileThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/browser/fileapi/sandbox_file_system_test_helper.h" 5 #include "webkit/browser/fileapi/sandbox_file_system_test_helper.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 quota_manager_proxy, base_dir); 54 quota_manager_proxy, base_dir);
55 55
56 SetUpFileSystem(); 56 SetUpFileSystem();
57 } 57 }
58 58
59 void SandboxFileSystemTestHelper::TearDown() { 59 void SandboxFileSystemTestHelper::TearDown() {
60 file_system_context_ = NULL; 60 file_system_context_ = NULL;
61 base::MessageLoop::current()->RunUntilIdle(); 61 base::MessageLoop::current()->RunUntilIdle();
62 } 62 }
63 63
64 base::FilePath SandboxFileSystemTestHelper::GetOriginRootPath() const { 64 base::FilePath SandboxFileSystemTestHelper::GetOriginRootPath() {
65 return file_system_context_->sandbox_provider()-> 65 return file_system_context_->sandbox_provider()->
66 GetBaseDirectoryForOriginAndType(origin_, type_, false); 66 GetBaseDirectoryForOriginAndType(origin_, type_, false);
67 } 67 }
68 68
69 base::FilePath SandboxFileSystemTestHelper::GetLocalPath( 69 base::FilePath SandboxFileSystemTestHelper::GetLocalPath(
70 const base::FilePath& path) { 70 const base::FilePath& path) {
71 DCHECK(file_util_); 71 DCHECK(file_util_);
72 base::FilePath local_path; 72 base::FilePath local_path;
73 scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); 73 scoped_ptr<FileSystemOperationContext> context(NewOperationContext());
74 file_util_->GetLocalFilePath(context.get(), CreateURL(path), &local_path); 74 file_util_->GetLocalFilePath(context.get(), CreateURL(path), &local_path);
(...skipping 22 matching lines...) Expand all
97 97
98 int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { 98 int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() {
99 usage_cache()->CloseCacheFiles(); 99 usage_cache()->CloseCacheFiles();
100 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath()); 100 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath());
101 if (file_util::PathExists(GetUsageCachePath())) 101 if (file_util::PathExists(GetUsageCachePath()))
102 size -= FileSystemUsageCache::kUsageFileSize; 102 size -= FileSystemUsageCache::kUsageFileSize;
103 return size; 103 return size;
104 } 104 }
105 105
106 int64 106 int64
107 SandboxFileSystemTestHelper::ComputeCurrentDirectoryDatabaseUsage() const { 107 SandboxFileSystemTestHelper::ComputeCurrentDirectoryDatabaseUsage() {
108 return file_util::ComputeDirectorySize( 108 return file_util::ComputeDirectorySize(
109 GetOriginRootPath().AppendASCII("Paths")); 109 GetOriginRootPath().AppendASCII("Paths"));
110 } 110 }
111 111
112 LocalFileSystemOperation* SandboxFileSystemTestHelper::NewOperation() { 112 LocalFileSystemOperation* SandboxFileSystemTestHelper::NewOperation() {
113 DCHECK(file_system_context_.get()); 113 DCHECK(file_system_context_.get());
114 DCHECK(file_util_); 114 DCHECK(file_util_);
115 LocalFileSystemOperation* operation = static_cast<LocalFileSystemOperation*>( 115 LocalFileSystemOperation* operation = static_cast<LocalFileSystemOperation*>(
116 file_system_context_->CreateFileSystemOperation( 116 file_system_context_->CreateFileSystemOperation(
117 CreateURL(base::FilePath()), NULL)); 117 CreateURL(base::FilePath()), NULL));
(...skipping 16 matching lines...) Expand all
134 134
135 void SandboxFileSystemTestHelper::SetUpFileSystem() { 135 void SandboxFileSystemTestHelper::SetUpFileSystem() {
136 DCHECK(file_system_context_); 136 DCHECK(file_system_context_);
137 DCHECK(file_system_context_->sandbox_provider()->CanHandleType(type_)); 137 DCHECK(file_system_context_->sandbox_provider()->CanHandleType(type_));
138 138
139 file_util_ = file_system_context_->GetFileUtil(type_); 139 file_util_ = file_system_context_->GetFileUtil(type_);
140 DCHECK(file_util_); 140 DCHECK(file_util_);
141 141
142 // Prepare the origin's root directory. 142 // Prepare the origin's root directory.
143 file_system_context_->sandbox_provider()-> 143 file_system_context_->sandbox_provider()->
144 GetFileSystemRootPathOnFileThread(CreateURL(base::FilePath()), 144 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */);
145 true /* create */);
146 145
147 // Initialize the usage cache file. 146 // Initialize the usage cache file.
148 base::FilePath usage_cache_path = GetUsageCachePath(); 147 base::FilePath usage_cache_path = GetUsageCachePath();
149 if (!usage_cache_path.empty()) 148 if (!usage_cache_path.empty())
150 usage_cache()->UpdateUsage(usage_cache_path, 0); 149 usage_cache()->UpdateUsage(usage_cache_path, 0);
151 } 150 }
152 151
153 } // namespace fileapi 152 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/sandbox_file_system_test_helper.h ('k') | webkit/browser/fileapi/sandbox_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698