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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
14 #include "base/guid.h" | 14 #include "base/guid.h" |
15 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/message_loop/message_loop_proxy.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
18 #include "base/task_runner_util.h" | 18 #include "base/task_runner_util.h" |
19 #include "chrome/browser/sync_file_system/file_change.h" | 19 #include "chrome/browser/sync_file_system/file_change.h" |
20 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 20 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
21 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 21 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
22 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 22 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
23 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 23 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
24 #include "content/public/test/mock_blob_url_request_context.h" | 24 #include "content/public/test/mock_blob_url_request_context.h" |
| 25 #include "content/public/test/mock_special_storage_policy.h" |
25 #include "content/public/test/test_file_system_options.h" | 26 #include "content/public/test/test_file_system_options.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "webkit/browser/fileapi/external_mount_points.h" | 28 #include "webkit/browser/fileapi/external_mount_points.h" |
28 #include "webkit/browser/fileapi/file_system_backend.h" | 29 #include "webkit/browser/fileapi/file_system_backend.h" |
29 #include "webkit/browser/fileapi/file_system_context.h" | 30 #include "webkit/browser/fileapi/file_system_context.h" |
30 #include "webkit/browser/fileapi/file_system_operation_context.h" | 31 #include "webkit/browser/fileapi/file_system_operation_context.h" |
31 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 32 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
32 #include "webkit/browser/quota/mock_special_storage_policy.h" | |
33 #include "webkit/browser/quota/quota_manager.h" | 33 #include "webkit/browser/quota/quota_manager.h" |
34 #include "webkit/common/blob/shareable_file_reference.h" | 34 #include "webkit/common/blob/shareable_file_reference.h" |
35 | 35 |
36 using base::File; | 36 using base::File; |
37 using fileapi::FileSystemContext; | 37 using fileapi::FileSystemContext; |
38 using fileapi::FileSystemOperationRunner; | 38 using fileapi::FileSystemOperationRunner; |
39 using fileapi::FileSystemURL; | 39 using fileapi::FileSystemURL; |
40 using fileapi::FileSystemURLSet; | 40 using fileapi::FileSystemURLSet; |
41 using quota::QuotaManager; | 41 using quota::QuotaManager; |
42 using content::MockBlobURLRequestContext; | 42 using content::MockBlobURLRequestContext; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 sync_status_observers_(new ObserverList) { | 220 sync_status_observers_(new ObserverList) { |
221 } | 221 } |
222 | 222 |
223 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} | 223 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} |
224 | 224 |
225 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { | 225 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { |
226 ASSERT_FALSE(is_filesystem_set_up_); | 226 ASSERT_FALSE(is_filesystem_set_up_); |
227 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 227 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
228 | 228 |
229 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 229 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
230 new quota::MockSpecialStoragePolicy(); | 230 new content::MockSpecialStoragePolicy(); |
231 | 231 |
232 if (quota_mode == QUOTA_ENABLED) { | 232 if (quota_mode == QUOTA_ENABLED) { |
233 quota_manager_ = new QuotaManager(false /* is_incognito */, | 233 quota_manager_ = new QuotaManager(false /* is_incognito */, |
234 data_dir_.path(), | 234 data_dir_.path(), |
235 io_task_runner_.get(), | 235 io_task_runner_.get(), |
236 base::MessageLoopProxy::current().get(), | 236 base::MessageLoopProxy::current().get(), |
237 storage_policy.get()); | 237 storage_policy.get()); |
238 } | 238 } |
239 | 239 |
240 std::vector<std::string> additional_allowed_schemes; | 240 std::vector<std::string> additional_allowed_schemes; |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 sync_status_ = status; | 746 sync_status_ = status; |
747 base::MessageLoop::current()->Quit(); | 747 base::MessageLoop::current()->Quit(); |
748 } | 748 } |
749 | 749 |
750 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 750 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
751 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 751 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
752 backend()->sync_context()->sync_status()->AddObserver(this); | 752 backend()->sync_context()->sync_status()->AddObserver(this); |
753 } | 753 } |
754 | 754 |
755 } // namespace sync_file_system | 755 } // namespace sync_file_system |
OLD | NEW |