OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 5 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <utility> | 10 #include <utility> |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} | 233 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} |
234 | 234 |
235 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { | 235 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { |
236 ASSERT_FALSE(is_filesystem_set_up_); | 236 ASSERT_FALSE(is_filesystem_set_up_); |
237 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 237 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
238 | 238 |
239 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = | 239 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = |
240 new content::MockSpecialStoragePolicy(); | 240 new content::MockSpecialStoragePolicy(); |
241 | 241 |
242 if (quota_mode == QUOTA_ENABLED) { | 242 if (quota_mode == QUOTA_ENABLED) { |
243 quota_manager_ = new QuotaManager(false /* is_incognito */, | 243 quota_manager_ = new QuotaManager( |
244 data_dir_.path(), | 244 false /* is_incognito */, data_dir_.GetPath(), io_task_runner_.get(), |
245 io_task_runner_.get(), | 245 base::ThreadTaskRunnerHandle::Get().get(), storage_policy.get()); |
246 base::ThreadTaskRunnerHandle::Get().get(), | |
247 storage_policy.get()); | |
248 } | 246 } |
249 | 247 |
250 std::vector<std::string> additional_allowed_schemes; | 248 std::vector<std::string> additional_allowed_schemes; |
251 additional_allowed_schemes.push_back(origin_.scheme()); | 249 additional_allowed_schemes.push_back(origin_.scheme()); |
252 storage::FileSystemOptions options( | 250 storage::FileSystemOptions options( |
253 storage::FileSystemOptions::PROFILE_MODE_NORMAL, | 251 storage::FileSystemOptions::PROFILE_MODE_NORMAL, |
254 additional_allowed_schemes, | 252 additional_allowed_schemes, |
255 env_override_); | 253 env_override_); |
256 | 254 |
257 ScopedVector<storage::FileSystemBackend> additional_backends; | 255 ScopedVector<storage::FileSystemBackend> additional_backends; |
258 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); | 256 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); |
259 | 257 |
260 file_system_context_ = new FileSystemContext( | 258 file_system_context_ = new FileSystemContext( |
261 io_task_runner_.get(), file_task_runner_.get(), | 259 io_task_runner_.get(), file_task_runner_.get(), |
262 storage::ExternalMountPoints::CreateRefCounted().get(), | 260 storage::ExternalMountPoints::CreateRefCounted().get(), |
263 storage_policy.get(), | 261 storage_policy.get(), |
264 quota_manager_.get() ? quota_manager_->proxy() : nullptr, | 262 quota_manager_.get() ? quota_manager_->proxy() : nullptr, |
265 std::move(additional_backends), | 263 std::move(additional_backends), |
266 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.path(), | 264 std::vector<storage::URLRequestAutoMountHandler>(), data_dir_.GetPath(), |
267 options); | 265 options); |
268 | 266 |
269 is_filesystem_set_up_ = true; | 267 is_filesystem_set_up_ = true; |
270 } | 268 } |
271 | 269 |
272 void CannedSyncableFileSystem::TearDown() { | 270 void CannedSyncableFileSystem::TearDown() { |
273 quota_manager_ = nullptr; | 271 quota_manager_ = nullptr; |
274 file_system_context_ = nullptr; | 272 file_system_context_ = nullptr; |
275 | 273 |
276 // Make sure we give some more time to finish tasks on other threads. | 274 // Make sure we give some more time to finish tasks on other threads. |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 sync_status_ = status; | 753 sync_status_ = status; |
756 quit_closure.Run(); | 754 quit_closure.Run(); |
757 } | 755 } |
758 | 756 |
759 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 757 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
760 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 758 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
761 backend()->sync_context()->sync_status()->AddObserver(this); | 759 backend()->sync_context()->sync_status()->AddObserver(this); |
762 } | 760 } |
763 | 761 |
764 } // namespace sync_file_system | 762 } // namespace sync_file_system |
OLD | NEW |