| 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 "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 14 #include "webkit/browser/fileapi/file_system_url.h" | 14 #include "storage/browser/fileapi/file_system_url.h" |
| 15 | 15 |
| 16 using ::testing::_; | 16 using ::testing::_; |
| 17 using ::testing::Invoke; | 17 using ::testing::Invoke; |
| 18 using ::testing::Return; | 18 using ::testing::Return; |
| 19 | 19 |
| 20 namespace sync_file_system { | 20 namespace sync_file_system { |
| 21 | 21 |
| 22 MockRemoteFileSyncService::MockRemoteFileSyncService() | 22 MockRemoteFileSyncService::MockRemoteFileSyncService() |
| 23 : conflict_resolution_policy_(CONFLICT_RESOLUTION_POLICY_MANUAL), | 23 : conflict_resolution_policy_(CONFLICT_RESOLUTION_POLICY_MANUAL), |
| 24 state_(REMOTE_SERVICE_OK) { | 24 state_(REMOTE_SERVICE_OK) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 void MockRemoteFileSyncService::NotifyRemoteServiceStateUpdated( | 65 void MockRemoteFileSyncService::NotifyRemoteServiceStateUpdated( |
| 66 RemoteServiceState state, | 66 RemoteServiceState state, |
| 67 const std::string& description) { | 67 const std::string& description) { |
| 68 FOR_EACH_OBSERVER(Observer, service_observers_, | 68 FOR_EACH_OBSERVER(Observer, service_observers_, |
| 69 OnRemoteServiceStateUpdated(state, description)); | 69 OnRemoteServiceStateUpdated(state, description)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void MockRemoteFileSyncService::NotifyFileStatusChanged( | 72 void MockRemoteFileSyncService::NotifyFileStatusChanged( |
| 73 const fileapi::FileSystemURL& url, | 73 const storage::FileSystemURL& url, |
| 74 SyncFileStatus sync_status, | 74 SyncFileStatus sync_status, |
| 75 SyncAction action_taken, | 75 SyncAction action_taken, |
| 76 SyncDirection direction) { | 76 SyncDirection direction) { |
| 77 FOR_EACH_OBSERVER(FileStatusObserver, file_status_observers_, | 77 FOR_EACH_OBSERVER(FileStatusObserver, file_status_observers_, |
| 78 OnFileStatusChanged(url, sync_status, | 78 OnFileStatusChanged(url, sync_status, |
| 79 action_taken, direction)); | 79 action_taken, direction)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void MockRemoteFileSyncService::AddServiceObserverStub(Observer* observer) { | 82 void MockRemoteFileSyncService::AddServiceObserverStub(Observer* observer) { |
| 83 service_observers_.AddObserver(observer); | 83 service_observers_.AddObserver(observer); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 102 const SyncStatusCallback& callback) { | 102 const SyncStatusCallback& callback) { |
| 103 base::ThreadTaskRunnerHandle::Get()->PostTask( | 103 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 104 FROM_HERE, | 104 FROM_HERE, |
| 105 base::Bind(callback, SYNC_STATUS_OK)); | 105 base::Bind(callback, SYNC_STATUS_OK)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void MockRemoteFileSyncService::ProcessRemoteChangeStub( | 108 void MockRemoteFileSyncService::ProcessRemoteChangeStub( |
| 109 const SyncFileCallback& callback) { | 109 const SyncFileCallback& callback) { |
| 110 base::ThreadTaskRunnerHandle::Get()->PostTask( | 110 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 111 FROM_HERE, | 111 FROM_HERE, |
| 112 base::Bind(callback, SYNC_STATUS_NO_CHANGE_TO_SYNC, | 112 base::Bind( |
| 113 fileapi::FileSystemURL())); | 113 callback, SYNC_STATUS_NO_CHANGE_TO_SYNC, storage::FileSystemURL())); |
| 114 } | 114 } |
| 115 | 115 |
| 116 RemoteServiceState MockRemoteFileSyncService::GetCurrentStateStub() const { | 116 RemoteServiceState MockRemoteFileSyncService::GetCurrentStateStub() const { |
| 117 return state_; | 117 return state_; |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace sync_file_system | 120 } // namespace sync_file_system |
| OLD | NEW |