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" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 void LocalFileSystemTestOriginHelper::SetUp( | 63 void LocalFileSystemTestOriginHelper::SetUp( |
64 const FilePath& base_dir, | 64 const FilePath& base_dir, |
65 bool unlimited_quota, | 65 bool unlimited_quota, |
66 quota::QuotaManagerProxy* quota_manager_proxy, | 66 quota::QuotaManagerProxy* quota_manager_proxy, |
67 FileSystemFileUtil* file_util) { | 67 FileSystemFileUtil* file_util) { |
68 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 68 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
69 new quota::MockSpecialStoragePolicy; | 69 new quota::MockSpecialStoragePolicy; |
70 special_storage_policy->SetAllUnlimited(unlimited_quota); | 70 special_storage_policy->SetAllUnlimited(unlimited_quota); |
71 file_system_context_ = new FileSystemContext( | 71 file_system_context_ = new FileSystemContext( |
72 FileSystemTaskRunners::CreateMockTaskRunners(), | 72 FileSystemTaskRunners::CreateMockTaskRunners(), |
73 special_storage_policy, | 73 special_storage_policy.get(), |
74 quota_manager_proxy, | 74 quota_manager_proxy, |
75 base_dir, | 75 base_dir, |
76 CreateAllowFileAccessOptions()); | 76 CreateAllowFileAccessOptions()); |
77 | 77 |
78 if (type_ == kFileSystemTypeTest) { | 78 if (type_ == kFileSystemTypeTest) { |
79 file_system_context_->RegisterMountPointProvider( | 79 file_system_context_->RegisterMountPointProvider( |
80 type_, | 80 type_, |
81 new TestMountPointProvider( | 81 new TestMountPointProvider( |
82 file_system_context_->task_runners()->file_task_runner(), | 82 file_system_context_->task_runners()->file_task_runner(), |
83 base_dir)); | 83 base_dir)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 base::PlatformFileError LocalFileSystemTestOriginHelper::SameFileUtilMove( | 149 base::PlatformFileError LocalFileSystemTestOriginHelper::SameFileUtilMove( |
150 FileSystemOperationContext* context, | 150 FileSystemOperationContext* context, |
151 const FileSystemURL& src, | 151 const FileSystemURL& src, |
152 const FileSystemURL& dest) const { | 152 const FileSystemURL& dest) const { |
153 return FileUtilHelper::Move(context, file_util(), file_util(), src, dest); | 153 return FileUtilHelper::Move(context, file_util(), file_util(), src, dest); |
154 } | 154 } |
155 | 155 |
156 int64 LocalFileSystemTestOriginHelper::GetCachedOriginUsage() const { | 156 int64 LocalFileSystemTestOriginHelper::GetCachedOriginUsage() const { |
157 return file_system_context_->GetQuotaUtil(type_)->GetOriginUsageOnFileThread( | 157 return file_system_context_->GetQuotaUtil(type_)->GetOriginUsageOnFileThread( |
158 file_system_context_, origin_, type_); | 158 file_system_context_.get(), origin_, type_); |
159 } | 159 } |
160 | 160 |
161 int64 LocalFileSystemTestOriginHelper::ComputeCurrentOriginUsage() const { | 161 int64 LocalFileSystemTestOriginHelper::ComputeCurrentOriginUsage() const { |
162 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath()); | 162 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath()); |
163 if (file_util::PathExists(GetUsageCachePath())) | 163 if (file_util::PathExists(GetUsageCachePath())) |
164 size -= FileSystemUsageCache::kUsageFileSize; | 164 size -= FileSystemUsageCache::kUsageFileSize; |
165 return size; | 165 return size; |
166 } | 166 } |
167 | 167 |
168 int64 | 168 int64 |
(...skipping 18 matching lines...) Expand all Loading... |
187 LocalFileSystemTestOriginHelper::NewOperationContext() { | 187 LocalFileSystemTestOriginHelper::NewOperationContext() { |
188 DCHECK(file_system_context_.get()); | 188 DCHECK(file_system_context_.get()); |
189 FileSystemOperationContext* context = | 189 FileSystemOperationContext* context = |
190 new FileSystemOperationContext(file_system_context_.get()); | 190 new FileSystemOperationContext(file_system_context_.get()); |
191 context->set_update_observers( | 191 context->set_update_observers( |
192 *file_system_context_->GetUpdateObservers(type_)); | 192 *file_system_context_->GetUpdateObservers(type_)); |
193 return context; | 193 return context; |
194 } | 194 } |
195 | 195 |
196 } // namespace fileapi | 196 } // namespace fileapi |
OLD | NEW |