| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/fileapi/syncable/canned_syncable_file_system.h" | 5 #include "webkit/fileapi/syncable/canned_syncable_file_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "webkit/blob/mock_blob_url_request_context.h" | 15 #include "webkit/blob/mock_blob_url_request_context.h" |
| 16 #include "webkit/fileapi/external_mount_points.h" |
| 16 #include "webkit/fileapi/file_system_context.h" | 17 #include "webkit/fileapi/file_system_context.h" |
| 17 #include "webkit/fileapi/file_system_operation_context.h" | 18 #include "webkit/fileapi/file_system_operation_context.h" |
| 18 #include "webkit/fileapi/file_system_task_runners.h" | 19 #include "webkit/fileapi/file_system_task_runners.h" |
| 19 #include "webkit/fileapi/local_file_system_operation.h" | 20 #include "webkit/fileapi/local_file_system_operation.h" |
| 20 #include "webkit/fileapi/mock_file_system_options.h" | 21 #include "webkit/fileapi/mock_file_system_options.h" |
| 21 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 22 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 22 #include "webkit/fileapi/syncable/local_file_change_tracker.h" | 23 #include "webkit/fileapi/syncable/local_file_change_tracker.h" |
| 23 #include "webkit/fileapi/syncable/local_file_sync_context.h" | 24 #include "webkit/fileapi/syncable/local_file_sync_context.h" |
| 24 #include "webkit/quota/mock_special_storage_policy.h" | 25 #include "webkit/quota/mock_special_storage_policy.h" |
| 25 #include "webkit/quota/quota_manager.h" | 26 #include "webkit/quota/quota_manager.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 file_system_context_ = NULL; | 223 file_system_context_ = NULL; |
| 223 | 224 |
| 224 // Make sure we give some more time to finish tasks on other threads. | 225 // Make sure we give some more time to finish tasks on other threads. |
| 225 EnsureLastTaskRuns(io_task_runner_); | 226 EnsureLastTaskRuns(io_task_runner_); |
| 226 EnsureLastTaskRuns(file_task_runner_); | 227 EnsureLastTaskRuns(file_task_runner_); |
| 227 } | 228 } |
| 228 | 229 |
| 229 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { | 230 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { |
| 230 EXPECT_TRUE(is_filesystem_set_up_); | 231 EXPECT_TRUE(is_filesystem_set_up_); |
| 231 EXPECT_TRUE(is_filesystem_opened_); | 232 EXPECT_TRUE(is_filesystem_opened_); |
| 232 return FileSystemURL(GURL(root_url_.spec() + path)); | 233 |
| 234 GURL url(root_url_.spec() + path); |
| 235 return file_system_context_->CrackURL(url); |
| 233 } | 236 } |
| 234 | 237 |
| 235 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { | 238 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { |
| 236 EXPECT_TRUE(is_filesystem_set_up_); | 239 EXPECT_TRUE(is_filesystem_set_up_); |
| 237 EXPECT_FALSE(is_filesystem_opened_); | 240 EXPECT_FALSE(is_filesystem_opened_); |
| 238 file_system_context_->OpenSyncableFileSystem( | 241 file_system_context_->OpenSyncableFileSystem( |
| 239 service_name_, origin_, type_, true /* create */, | 242 service_name_, origin_, type_, true /* create */, |
| 240 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, | 243 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, |
| 241 base::Unretained(this))); | 244 base::Unretained(this))); |
| 242 MessageLoop::current()->Run(); | 245 MessageLoop::current()->Run(); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 sync_status_ = status; | 592 sync_status_ = status; |
| 590 MessageLoop::current()->Quit(); | 593 MessageLoop::current()->Quit(); |
| 591 } | 594 } |
| 592 | 595 |
| 593 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 596 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
| 594 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 597 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 595 file_system_context_->sync_context()->sync_status()->AddObserver(this); | 598 file_system_context_->sync_context()->sync_status()->AddObserver(this); |
| 596 } | 599 } |
| 597 | 600 |
| 598 } // namespace fileapi | 601 } // namespace fileapi |
| OLD | NEW |