OLD | NEW |
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/local_file_system_test_helper.h" | 5 #include "webkit/fileapi/local_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" |
11 #include "webkit/fileapi/external_mount_points.h" | 11 #include "webkit/fileapi/external_mount_points.h" |
12 #include "webkit/fileapi/file_system_context.h" | 12 #include "webkit/fileapi/file_system_context.h" |
13 #include "webkit/fileapi/file_system_operation_context.h" | 13 #include "webkit/fileapi/file_system_operation_context.h" |
14 #include "webkit/fileapi/file_system_task_runners.h" | 14 #include "webkit/fileapi/file_system_task_runners.h" |
15 #include "webkit/fileapi/file_system_url.h" | 15 #include "webkit/fileapi/file_system_url.h" |
16 #include "webkit/fileapi/file_system_usage_cache.h" | 16 #include "webkit/fileapi/file_system_usage_cache.h" |
17 #include "webkit/fileapi/file_system_util.h" | 17 #include "webkit/fileapi/file_system_util.h" |
18 #include "webkit/fileapi/file_util_helper.h" | |
19 #include "webkit/fileapi/local_file_system_operation.h" | 18 #include "webkit/fileapi/local_file_system_operation.h" |
20 #include "webkit/fileapi/mock_file_system_options.h" | 19 #include "webkit/fileapi/mock_file_system_options.h" |
21 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 20 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
22 #include "webkit/fileapi/test_mount_point_provider.h" | 21 #include "webkit/fileapi/test_mount_point_provider.h" |
23 #include "webkit/quota/mock_special_storage_policy.h" | 22 #include "webkit/quota/mock_special_storage_policy.h" |
24 | 23 |
25 namespace fileapi { | 24 namespace fileapi { |
26 | 25 |
27 LocalFileSystemTestOriginHelper::LocalFileSystemTestOriginHelper( | 26 LocalFileSystemTestOriginHelper::LocalFileSystemTestOriginHelper( |
28 const GURL& origin, FileSystemType type) | 27 const GURL& origin, FileSystemType type) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return base::FilePath(); | 116 return base::FilePath(); |
118 return file_system_context_-> | 117 return file_system_context_-> |
119 sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); | 118 sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); |
120 } | 119 } |
121 | 120 |
122 FileSystemURL LocalFileSystemTestOriginHelper::CreateURL(const base::FilePath& p
ath) | 121 FileSystemURL LocalFileSystemTestOriginHelper::CreateURL(const base::FilePath& p
ath) |
123 const { | 122 const { |
124 return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); | 123 return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); |
125 } | 124 } |
126 | 125 |
127 base::PlatformFileError LocalFileSystemTestOriginHelper::SameFileUtilCopy( | |
128 FileSystemOperationContext* context, | |
129 const FileSystemURL& src, | |
130 const FileSystemURL& dest) const { | |
131 return FileUtilHelper::Copy(context, file_util(), file_util(), src, dest); | |
132 } | |
133 | |
134 base::PlatformFileError LocalFileSystemTestOriginHelper::SameFileUtilMove( | |
135 FileSystemOperationContext* context, | |
136 const FileSystemURL& src, | |
137 const FileSystemURL& dest) const { | |
138 return FileUtilHelper::Move(context, file_util(), file_util(), src, dest); | |
139 } | |
140 | |
141 int64 LocalFileSystemTestOriginHelper::GetCachedOriginUsage() const { | 126 int64 LocalFileSystemTestOriginHelper::GetCachedOriginUsage() const { |
142 return file_system_context_->GetQuotaUtil(type_)->GetOriginUsageOnFileThread( | 127 return file_system_context_->GetQuotaUtil(type_)->GetOriginUsageOnFileThread( |
143 file_system_context_, origin_, type_); | 128 file_system_context_, origin_, type_); |
144 } | 129 } |
145 | 130 |
146 int64 LocalFileSystemTestOriginHelper::ComputeCurrentOriginUsage() const { | 131 int64 LocalFileSystemTestOriginHelper::ComputeCurrentOriginUsage() const { |
147 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath()); | 132 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath()); |
148 if (file_util::PathExists(GetUsageCachePath())) | 133 if (file_util::PathExists(GetUsageCachePath())) |
149 size -= FileSystemUsageCache::kUsageFileSize; | 134 size -= FileSystemUsageCache::kUsageFileSize; |
150 return size; | 135 return size; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 type_, | 169 type_, |
185 new TestMountPointProvider( | 170 new TestMountPointProvider( |
186 file_system_context_->task_runners()->file_task_runner(), | 171 file_system_context_->task_runners()->file_task_runner(), |
187 file_system_context_->partition_path())); | 172 file_system_context_->partition_path())); |
188 } | 173 } |
189 file_util_ = file_system_context_->GetFileUtil(type_); | 174 file_util_ = file_system_context_->GetFileUtil(type_); |
190 DCHECK(file_util_); | 175 DCHECK(file_util_); |
191 } | 176 } |
192 | 177 |
193 } // namespace fileapi | 178 } // namespace fileapi |
OLD | NEW |