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 "components/browser_sync/profile_sync_service.h" | 5 #include "components/browser_sync/profile_sync_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void ClearServerData( | 179 void ClearServerData( |
180 const syncer::SyncManager::ClearServerDataCallback& callback) override { | 180 const syncer::SyncManager::ClearServerDataCallback& callback) override { |
181 clear_server_data_called_.Run(callback); | 181 clear_server_data_called_.Run(callback); |
182 } | 182 } |
183 | 183 |
184 private: | 184 private: |
185 ClearServerDataCalled clear_server_data_called_; | 185 ClearServerDataCalled clear_server_data_called_; |
186 }; | 186 }; |
187 | 187 |
188 ACTION(ReturnNewSyncBackendHostMock) { | 188 ACTION(ReturnNewSyncBackendHostMock) { |
189 return new browser_sync::SyncBackendHostMock(); | 189 return new SyncBackendHostMock(); |
190 } | 190 } |
191 | 191 |
192 ACTION(ReturnNewSyncBackendHostNoReturn) { | 192 ACTION(ReturnNewSyncBackendHostNoReturn) { |
193 return new browser_sync::SyncBackendHostNoReturn(); | 193 return new SyncBackendHostNoReturn(); |
194 } | 194 } |
195 | 195 |
196 ACTION_P(ReturnNewMockHostCollectDeleteDirParam, delete_dir_param) { | 196 ACTION_P(ReturnNewMockHostCollectDeleteDirParam, delete_dir_param) { |
197 return new browser_sync::SyncBackendHostMockCollectDeleteDirParam( | 197 return new SyncBackendHostMockCollectDeleteDirParam(delete_dir_param); |
198 delete_dir_param); | |
199 } | 198 } |
200 | 199 |
201 void OnClearServerDataCalled( | 200 void OnClearServerDataCalled( |
202 syncer::SyncManager::ClearServerDataCallback* captured_callback, | 201 syncer::SyncManager::ClearServerDataCallback* captured_callback, |
203 const syncer::SyncManager::ClearServerDataCallback& callback) { | 202 const syncer::SyncManager::ClearServerDataCallback& callback) { |
204 *captured_callback = callback; | 203 *captured_callback = callback; |
205 } | 204 } |
206 | 205 |
207 ACTION_P(ReturnNewMockHostCaptureClearServerData, captured_callback) { | 206 ACTION_P(ReturnNewMockHostCaptureClearServerData, captured_callback) { |
208 return new SyncBackendHostCaptureClearServerData(base::Bind( | 207 return new SyncBackendHostCaptureClearServerData(base::Bind( |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 protected: | 376 protected: |
378 void PumpLoop() { | 377 void PumpLoop() { |
379 base::RunLoop run_loop; | 378 base::RunLoop run_loop; |
380 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 379 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
381 run_loop.QuitClosure()); | 380 run_loop.QuitClosure()); |
382 run_loop.Run(); | 381 run_loop.Run(); |
383 } | 382 } |
384 | 383 |
385 private: | 384 private: |
386 base::MessageLoop message_loop_; | 385 base::MessageLoop message_loop_; |
387 browser_sync::ProfileSyncServiceBundle profile_sync_service_bundle_; | 386 ProfileSyncServiceBundle profile_sync_service_bundle_; |
388 std::unique_ptr<ProfileSyncService> service_; | 387 std::unique_ptr<ProfileSyncService> service_; |
389 | 388 |
390 // The current component factory used by sync. May be null if the server | 389 // The current component factory used by sync. May be null if the server |
391 // hasn't been created yet. | 390 // hasn't been created yet. |
392 SyncApiComponentFactoryMock* component_factory_; | 391 SyncApiComponentFactoryMock* component_factory_; |
393 }; | 392 }; |
394 | 393 |
395 // Verify that the server URLs are sane. | 394 // Verify that the server URLs are sane. |
396 TEST_F(ProfileSyncServiceTest, InitialState) { | 395 TEST_F(ProfileSyncServiceTest, InitialState) { |
397 CreateService(ProfileSyncService::AUTO_START); | 396 CreateService(ProfileSyncService::AUTO_START); |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if | 962 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if |
964 // entry for sessions exists in map. | 963 // entry for sessions exists in map. |
965 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { | 964 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { |
966 CreateService(ProfileSyncService::AUTO_START); | 965 CreateService(ProfileSyncService::AUTO_START); |
967 service()->OnSessionRestoreComplete(); | 966 service()->OnSessionRestoreComplete(); |
968 service()->OnSyncCycleCompleted(); | 967 service()->OnSyncCycleCompleted(); |
969 } | 968 } |
970 | 969 |
971 } // namespace | 970 } // namespace |
972 } // namespace browser_sync | 971 } // namespace browser_sync |
OLD | NEW |