| 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/local_file_sync_context.h" | 5 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/location.h" |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/single_thread_task_runner.h" |
| 14 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 15 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 17 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 16 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 18 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 17 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 19 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 18 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 20 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
| 19 #include "chrome/browser/sync_file_system/sync_status_code.h" | 21 #include "chrome/browser/sync_file_system/sync_status_code.h" |
| 20 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 22 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 21 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/test/mock_blob_url_request_context.h" | 24 #include "content/public/test/mock_blob_url_request_context.h" |
| 23 #include "content/public/test/test_browser_thread_bundle.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 status_(SYNC_FILE_ERROR_FAILED), | 60 status_(SYNC_FILE_ERROR_FAILED), |
| 59 file_error_(base::File::FILE_ERROR_FAILED), | 61 file_error_(base::File::FILE_ERROR_FAILED), |
| 60 async_modify_finished_(false), | 62 async_modify_finished_(false), |
| 61 has_inflight_prepare_for_sync_(false) {} | 63 has_inflight_prepare_for_sync_(false) {} |
| 62 | 64 |
| 63 void SetUp() override { | 65 void SetUp() override { |
| 64 RegisterSyncableFileSystem(); | 66 RegisterSyncableFileSystem(); |
| 65 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 67 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
| 66 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); | 68 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); |
| 67 | 69 |
| 68 ui_task_runner_ = base::MessageLoop::current()->message_loop_proxy(); | 70 ui_task_runner_ = base::MessageLoop::current()->task_runner(); |
| 69 io_task_runner_ = BrowserThread::GetMessageLoopProxyForThread( | 71 io_task_runner_ = BrowserThread::GetMessageLoopProxyForThread( |
| 70 BrowserThread::IO); | 72 BrowserThread::IO); |
| 71 file_task_runner_ = BrowserThread::GetMessageLoopProxyForThread( | 73 file_task_runner_ = BrowserThread::GetMessageLoopProxyForThread( |
| 72 BrowserThread::IO); | 74 BrowserThread::IO); |
| 73 } | 75 } |
| 74 | 76 |
| 75 void TearDown() override { RevokeSyncableFileSystem(); } | 77 void TearDown() override { RevokeSyncableFileSystem(); } |
| 76 | 78 |
| 77 void StartPrepareForSync(FileSystemContext* file_system_context, | 79 void StartPrepareForSync(FileSystemContext* file_system_context, |
| 78 const FileSystemURL& url, | 80 const FileSystemURL& url, |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 950 |
| 949 // Make sure kDir and kFile are created by ApplyRemoteChange. | 951 // Make sure kDir and kFile are created by ApplyRemoteChange. |
| 950 EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile)); | 952 EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile)); |
| 951 EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir)); | 953 EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir)); |
| 952 | 954 |
| 953 sync_context_->ShutdownOnUIThread(); | 955 sync_context_->ShutdownOnUIThread(); |
| 954 file_system.TearDown(); | 956 file_system.TearDown(); |
| 955 } | 957 } |
| 956 | 958 |
| 957 } // namespace sync_file_system | 959 } // namespace sync_file_system |
| OLD | NEW |