| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test_profile_sync_service.h" | 5 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 7 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
| 8 #include "chrome/browser/sync/sessions/sync_protocol_error.h" |
| 8 #include "chrome/browser/sync/glue/data_type_controller.h" | 9 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 9 #include "chrome/browser/sync/glue/sync_backend_host.h" | 10 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 10 #include "chrome/browser/sync/internal_api/user_share.h" | 11 #include "chrome/browser/sync/internal_api/user_share.h" |
| 11 #include "chrome/browser/sync/js/js_reply_handler.h" | 12 #include "chrome/browser/sync/js/js_reply_handler.h" |
| 12 #include "chrome/browser/sync/profile_sync_factory.h" | 13 #include "chrome/browser/sync/profile_sync_factory.h" |
| 13 #include "chrome/browser/sync/sessions/session_state.h" | 14 #include "chrome/browser/sync/sessions/session_state.h" |
| 14 #include "chrome/browser/sync/signin_manager.h" | 15 #include "chrome/browser/sync/signin_manager.h" |
| 15 #include "chrome/browser/sync/syncable/directory_manager.h" | 16 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 16 #include "chrome/browser/sync/syncable/syncable.h" | 17 #include "chrome/browser/sync/syncable/syncable.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void SyncBackendHostForProfileSyncTest:: | 61 void SyncBackendHostForProfileSyncTest:: |
| 61 SimulateSyncCycleCompletedInitialSyncEnded( | 62 SimulateSyncCycleCompletedInitialSyncEnded( |
| 62 const tracked_objects::Location& location) { | 63 const tracked_objects::Location& location) { |
| 63 syncable::ModelTypeBitSet sync_ended; | 64 syncable::ModelTypeBitSet sync_ended; |
| 64 if (!fail_initial_download_) | 65 if (!fail_initial_download_) |
| 65 sync_ended.set(); | 66 sync_ended.set(); |
| 66 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 67 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 67 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( | 68 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( |
| 68 SyncerStatus(), ErrorCounters(), 0, false, | 69 SyncerStatus(), ErrorCounters(), 0, false, |
| 69 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, | 70 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, |
| 70 SyncSourceInfo(), 0, base::Time::Now())); | 71 SyncSourceInfo(), 0, base::Time::Now(), |
| 72 browser_sync::sessions::SyncProtocolError())); |
| 71 } | 73 } |
| 72 | 74 |
| 73 sync_api::HttpPostProviderFactory* | 75 sync_api::HttpPostProviderFactory* |
| 74 SyncBackendHostForProfileSyncTest::MakeHttpBridgeFactory( | 76 SyncBackendHostForProfileSyncTest::MakeHttpBridgeFactory( |
| 75 const scoped_refptr<net::URLRequestContextGetter>& getter) { | 77 const scoped_refptr<net::URLRequestContextGetter>& getter) { |
| 76 return new browser_sync::TestHttpBridgeFactory; | 78 return new browser_sync::TestHttpBridgeFactory; |
| 77 } | 79 } |
| 78 | 80 |
| 79 void SyncBackendHostForProfileSyncTest::InitCore( | 81 void SyncBackendHostForProfileSyncTest::InitCore( |
| 80 const Core::DoInitializeOptions& options) { | 82 const Core::DoInitializeOptions& options) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 98 SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(); | 100 SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(); |
| 99 if (initialization_state_ == DOWNLOADING_NIGORI) { | 101 if (initialization_state_ == DOWNLOADING_NIGORI) { |
| 100 syncable::ModelTypeBitSet sync_ended; | 102 syncable::ModelTypeBitSet sync_ended; |
| 101 | 103 |
| 102 if (!fail_initial_download_) | 104 if (!fail_initial_download_) |
| 103 sync_ended.set(syncable::NIGORI); | 105 sync_ended.set(syncable::NIGORI); |
| 104 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 106 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 105 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( | 107 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( |
| 106 SyncerStatus(), ErrorCounters(), 0, false, | 108 SyncerStatus(), ErrorCounters(), 0, false, |
| 107 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, | 109 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, |
| 108 SyncSourceInfo(), 0, base::Time::Now())); | 110 SyncSourceInfo(), 0, base::Time::Now(), |
| 111 browser_sync::sessions::SyncError())); |
| 109 } | 112 } |
| 110 } | 113 } |
| 111 | 114 |
| 112 void SyncBackendHostForProfileSyncTest:: | 115 void SyncBackendHostForProfileSyncTest:: |
| 113 SetDefaultExpectationsForWorkerCreation(ProfileMock* profile) { | 116 SetDefaultExpectationsForWorkerCreation(ProfileMock* profile) { |
| 114 EXPECT_CALL(*profile, GetPasswordStore(testing::_)). | 117 EXPECT_CALL(*profile, GetPasswordStore(testing::_)). |
| 115 WillOnce(testing::Return((PasswordStore*)NULL)); | 118 WillOnce(testing::Return((PasswordStore*)NULL)); |
| 116 } | 119 } |
| 117 | 120 |
| 118 void SyncBackendHostForProfileSyncTest::SetHistoryServiceExpectations( | 121 void SyncBackendHostForProfileSyncTest::SetHistoryServiceExpectations( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 fail_initial_download_ = true; | 238 fail_initial_download_ = true; |
| 236 } | 239 } |
| 237 | 240 |
| 238 void TestProfileSyncService::CreateBackend() { | 241 void TestProfileSyncService::CreateBackend() { |
| 239 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( | 242 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( |
| 240 profile(), | 243 profile(), |
| 241 set_initial_sync_ended_on_init_, | 244 set_initial_sync_ended_on_init_, |
| 242 synchronous_backend_initialization_, | 245 synchronous_backend_initialization_, |
| 243 fail_initial_download_)); | 246 fail_initial_download_)); |
| 244 } | 247 } |
| OLD | NEW |