| 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 "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" | 5 #include "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "webkit/browser/blob/mock_blob_url_request_context.h" | 17 #include "webkit/browser/blob/mock_blob_url_request_context.h" |
| 18 #include "webkit/browser/fileapi/external_mount_points.h" | 18 #include "webkit/browser/fileapi/external_mount_points.h" |
| 19 #include "webkit/browser/fileapi/file_system_backend.h" |
| 19 #include "webkit/browser/fileapi/file_system_context.h" | 20 #include "webkit/browser/fileapi/file_system_context.h" |
| 20 #include "webkit/browser/fileapi/file_system_mount_point_provider.h" | |
| 21 #include "webkit/browser/fileapi/file_system_operation_context.h" | 21 #include "webkit/browser/fileapi/file_system_operation_context.h" |
| 22 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 22 #include "webkit/browser/fileapi/file_system_operation_runner.h" |
| 23 #include "webkit/browser/fileapi/file_system_task_runners.h" | 23 #include "webkit/browser/fileapi/file_system_task_runners.h" |
| 24 #include "webkit/browser/fileapi/mock_file_system_options.h" | 24 #include "webkit/browser/fileapi/mock_file_system_options.h" |
| 25 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" | 25 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" |
| 26 #include "webkit/browser/fileapi/syncable/local_file_change_tracker.h" | 26 #include "webkit/browser/fileapi/syncable/local_file_change_tracker.h" |
| 27 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" | 27 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" |
| 28 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" | 28 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" |
| 29 #include "webkit/browser/quota/mock_special_storage_policy.h" | 29 #include "webkit/browser/quota/mock_special_storage_policy.h" |
| 30 #include "webkit/browser/quota/quota_manager.h" | 30 #include "webkit/browser/quota/quota_manager.h" |
| 31 #include "webkit/common/blob/shareable_file_reference.h" | 31 #include "webkit/common/blob/shareable_file_reference.h" |
| 32 | 32 |
| 33 using base::PlatformFileError; | 33 using base::PlatformFileError; |
| 34 using fileapi::FileSystemContext; | 34 using fileapi::FileSystemContext; |
| 35 using fileapi::FileSystemOperationRunner; | 35 using fileapi::FileSystemOperationRunner; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, | 232 fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, |
| 233 additional_allowed_schemes); | 233 additional_allowed_schemes); |
| 234 | 234 |
| 235 file_system_context_ = new FileSystemContext( | 235 file_system_context_ = new FileSystemContext( |
| 236 make_scoped_ptr( | 236 make_scoped_ptr( |
| 237 new fileapi::FileSystemTaskRunners(io_task_runner_.get(), | 237 new fileapi::FileSystemTaskRunners(io_task_runner_.get(), |
| 238 file_task_runner_.get())), | 238 file_task_runner_.get())), |
| 239 fileapi::ExternalMountPoints::CreateRefCounted().get(), | 239 fileapi::ExternalMountPoints::CreateRefCounted().get(), |
| 240 storage_policy.get(), | 240 storage_policy.get(), |
| 241 quota_manager_->proxy(), | 241 quota_manager_->proxy(), |
| 242 ScopedVector<fileapi::FileSystemMountPointProvider>(), | 242 ScopedVector<fileapi::FileSystemBackend>(), |
| 243 data_dir_.path(), options); | 243 data_dir_.path(), options); |
| 244 | 244 |
| 245 is_filesystem_set_up_ = true; | 245 is_filesystem_set_up_ = true; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void CannedSyncableFileSystem::TearDown() { | 248 void CannedSyncableFileSystem::TearDown() { |
| 249 quota_manager_ = NULL; | 249 quota_manager_ = NULL; |
| 250 file_system_context_ = NULL; | 250 file_system_context_ = NULL; |
| 251 | 251 |
| 252 // Make sure we give some more time to finish tasks on other threads. | 252 // Make sure we give some more time to finish tasks on other threads. |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 sync_status_ = status; | 663 sync_status_ = status; |
| 664 base::MessageLoop::current()->Quit(); | 664 base::MessageLoop::current()->Quit(); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 667 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
| 668 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 668 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 669 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 669 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
| 670 } | 670 } |
| 671 | 671 |
| 672 } // namespace sync_file_system | 672 } // namespace sync_file_system |
| OLD | NEW |