| 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_backend.h" |
| 20 #include "webkit/browser/fileapi/file_system_context.h" | 20 #include "webkit/browser/fileapi/file_system_context.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_file_system_backend.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/sync_file_system_backend.h" |
| 28 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" | 29 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" |
| 29 #include "webkit/browser/quota/mock_special_storage_policy.h" | 30 #include "webkit/browser/quota/mock_special_storage_policy.h" |
| 30 #include "webkit/browser/quota/quota_manager.h" | 31 #include "webkit/browser/quota/quota_manager.h" |
| 31 #include "webkit/common/blob/shareable_file_reference.h" | 32 #include "webkit/common/blob/shareable_file_reference.h" |
| 32 | 33 |
| 33 using base::PlatformFileError; | 34 using base::PlatformFileError; |
| 34 using fileapi::FileSystemContext; | 35 using fileapi::FileSystemContext; |
| 35 using fileapi::FileSystemOperationRunner; | 36 using fileapi::FileSystemOperationRunner; |
| 36 using fileapi::FileSystemURL; | 37 using fileapi::FileSystemURL; |
| 37 using fileapi::FileSystemURLSet; | 38 using fileapi::FileSystemURLSet; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 io_task_runner_.get(), | 226 io_task_runner_.get(), |
| 226 base::MessageLoopProxy::current().get(), | 227 base::MessageLoopProxy::current().get(), |
| 227 storage_policy.get()); | 228 storage_policy.get()); |
| 228 | 229 |
| 229 std::vector<std::string> additional_allowed_schemes; | 230 std::vector<std::string> additional_allowed_schemes; |
| 230 additional_allowed_schemes.push_back(origin_.scheme()); | 231 additional_allowed_schemes.push_back(origin_.scheme()); |
| 231 fileapi::FileSystemOptions options( | 232 fileapi::FileSystemOptions options( |
| 232 fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, | 233 fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, |
| 233 additional_allowed_schemes); | 234 additional_allowed_schemes); |
| 234 | 235 |
| 236 ScopedVector<fileapi::FileSystemBackend> additional_backends; |
| 237 additional_backends.push_back(new SyncFileSystemBackend(options)); |
| 238 |
| 235 file_system_context_ = new FileSystemContext( | 239 file_system_context_ = new FileSystemContext( |
| 236 make_scoped_ptr( | 240 make_scoped_ptr( |
| 237 new fileapi::FileSystemTaskRunners(io_task_runner_.get(), | 241 new fileapi::FileSystemTaskRunners(io_task_runner_.get(), |
| 238 file_task_runner_.get())), | 242 file_task_runner_.get())), |
| 239 fileapi::ExternalMountPoints::CreateRefCounted().get(), | 243 fileapi::ExternalMountPoints::CreateRefCounted().get(), |
| 240 storage_policy.get(), | 244 storage_policy.get(), |
| 241 quota_manager_->proxy(), | 245 quota_manager_->proxy(), |
| 242 ScopedVector<fileapi::FileSystemBackend>(), | 246 additional_backends.Pass(), |
| 243 data_dir_.path(), options); | 247 data_dir_.path(), options); |
| 244 | 248 |
| 245 is_filesystem_set_up_ = true; | 249 is_filesystem_set_up_ = true; |
| 246 } | 250 } |
| 247 | 251 |
| 248 void CannedSyncableFileSystem::TearDown() { | 252 void CannedSyncableFileSystem::TearDown() { |
| 249 quota_manager_ = NULL; | 253 quota_manager_ = NULL; |
| 250 file_system_context_ = NULL; | 254 file_system_context_ = NULL; |
| 251 | 255 |
| 252 // Make sure we give some more time to finish tasks on other threads. | 256 // 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; | 667 sync_status_ = status; |
| 664 base::MessageLoop::current()->Quit(); | 668 base::MessageLoop::current()->Quit(); |
| 665 } | 669 } |
| 666 | 670 |
| 667 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 671 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
| 668 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 672 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 669 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 673 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
| 670 } | 674 } |
| 671 | 675 |
| 672 } // namespace sync_file_system | 676 } // namespace sync_file_system |
| OLD | NEW |