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" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 run_loop.Run(); | 85 run_loop.Run(); |
86 } | 86 } |
87 | 87 |
88 void EnsureRunningOn(base::SingleThreadTaskRunner* runner) { | 88 void EnsureRunningOn(base::SingleThreadTaskRunner* runner) { |
89 EXPECT_TRUE(runner->RunsTasksOnCurrentThread()); | 89 EXPECT_TRUE(runner->RunsTasksOnCurrentThread()); |
90 } | 90 } |
91 | 91 |
92 void VerifySameTaskRunner( | 92 void VerifySameTaskRunner( |
93 base::SingleThreadTaskRunner* runner1, | 93 base::SingleThreadTaskRunner* runner1, |
94 base::SingleThreadTaskRunner* runner2) { | 94 base::SingleThreadTaskRunner* runner2) { |
95 ASSERT_TRUE(runner1 != NULL); | 95 ASSERT_TRUE(runner1 != nullptr); |
96 ASSERT_TRUE(runner2 != NULL); | 96 ASSERT_TRUE(runner2 != nullptr); |
97 runner1->PostTask(FROM_HERE, | 97 runner1->PostTask(FROM_HERE, |
98 base::Bind(&EnsureRunningOn, make_scoped_refptr(runner2))); | 98 base::Bind(&EnsureRunningOn, make_scoped_refptr(runner2))); |
99 } | 99 } |
100 | 100 |
101 void OnCreateSnapshotFileAndVerifyData( | 101 void OnCreateSnapshotFileAndVerifyData( |
102 const std::string& expected_data, | 102 const std::string& expected_data, |
103 const CannedSyncableFileSystem::StatusCallback& callback, | 103 const CannedSyncableFileSystem::StatusCallback& callback, |
104 base::File::Error result, | 104 base::File::Error result, |
105 const base::File::Info& file_info, | 105 const base::File::Info& file_info, |
106 const base::FilePath& platform_path, | 106 const base::FilePath& platform_path, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 env_override_); | 248 env_override_); |
249 | 249 |
250 ScopedVector<storage::FileSystemBackend> additional_backends; | 250 ScopedVector<storage::FileSystemBackend> additional_backends; |
251 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); | 251 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); |
252 | 252 |
253 file_system_context_ = new FileSystemContext( | 253 file_system_context_ = new FileSystemContext( |
254 io_task_runner_.get(), | 254 io_task_runner_.get(), |
255 file_task_runner_.get(), | 255 file_task_runner_.get(), |
256 storage::ExternalMountPoints::CreateRefCounted().get(), | 256 storage::ExternalMountPoints::CreateRefCounted().get(), |
257 storage_policy.get(), | 257 storage_policy.get(), |
258 quota_manager_.get() ? quota_manager_->proxy() : NULL, | 258 quota_manager_.get() ? quota_manager_->proxy() : nullptr, |
259 additional_backends.Pass(), | 259 additional_backends.Pass(), |
260 std::vector<storage::URLRequestAutoMountHandler>(), | 260 std::vector<storage::URLRequestAutoMountHandler>(), |
261 data_dir_.path(), | 261 data_dir_.path(), |
262 options); | 262 options); |
263 | 263 |
264 is_filesystem_set_up_ = true; | 264 is_filesystem_set_up_ = true; |
265 } | 265 } |
266 | 266 |
267 void CannedSyncableFileSystem::TearDown() { | 267 void CannedSyncableFileSystem::TearDown() { |
268 quota_manager_ = NULL; | 268 quota_manager_ = nullptr; |
269 file_system_context_ = NULL; | 269 file_system_context_ = nullptr; |
270 | 270 |
271 // Make sure we give some more time to finish tasks on other threads. | 271 // Make sure we give some more time to finish tasks on other threads. |
272 EnsureLastTaskRuns(io_task_runner_.get()); | 272 EnsureLastTaskRuns(io_task_runner_.get()); |
273 EnsureLastTaskRuns(file_task_runner_.get()); | 273 EnsureLastTaskRuns(file_task_runner_.get()); |
274 } | 274 } |
275 | 275 |
276 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { | 276 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { |
277 EXPECT_TRUE(is_filesystem_set_up_); | 277 EXPECT_TRUE(is_filesystem_set_up_); |
278 EXPECT_FALSE(root_url_.is_empty()); | 278 EXPECT_FALSE(root_url_.is_empty()); |
279 | 279 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 sync_status_ = status; | 757 sync_status_ = status; |
758 quit_closure.Run(); | 758 quit_closure.Run(); |
759 } | 759 } |
760 | 760 |
761 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 761 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
762 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 762 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
763 backend()->sync_context()->sync_status()->AddObserver(this); | 763 backend()->sync_context()->sync_status()->AddObserver(this); |
764 } | 764 } |
765 | 765 |
766 } // namespace sync_file_system | 766 } // namespace sync_file_system |
OLD | NEW |