| 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/glue/data_type_controller.h" | 8 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 9 #include "chrome/browser/sync/glue/sync_backend_host.h" | 9 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 10 #include "chrome/browser/sync/internal_api/user_share.h" | 10 #include "chrome/browser/sync/internal_api/user_share.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 : browser_sync::SyncBackendHost( | 55 : browser_sync::SyncBackendHost( |
| 56 profile->GetDebugName(), profile, sync_prefs), | 56 profile->GetDebugName(), profile, sync_prefs), |
| 57 synchronous_init_(synchronous_init), | 57 synchronous_init_(synchronous_init), |
| 58 fail_initial_download_(fail_initial_download) {} | 58 fail_initial_download_(fail_initial_download) {} |
| 59 | 59 |
| 60 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} | 60 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} |
| 61 | 61 |
| 62 void SyncBackendHostForProfileSyncTest:: | 62 void SyncBackendHostForProfileSyncTest:: |
| 63 SimulateSyncCycleCompletedInitialSyncEnded( | 63 SimulateSyncCycleCompletedInitialSyncEnded( |
| 64 const tracked_objects::Location& location) { | 64 const tracked_objects::Location& location) { |
| 65 syncable::ModelTypeBitSet sync_ended; | 65 syncable::ModelEnumSet sync_ended; |
| 66 if (!fail_initial_download_) | 66 if (!fail_initial_download_) |
| 67 sync_ended.set(); | 67 sync_ended = syncable::ModelEnumSet::All(); |
| 68 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 68 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 69 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( | 69 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( |
| 70 SyncerStatus(), ErrorCounters(), 0, false, | 70 SyncerStatus(), ErrorCounters(), 0, false, |
| 71 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, | 71 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, |
| 72 SyncSourceInfo(), 0, base::Time::Now())); | 72 SyncSourceInfo(), 0, base::Time::Now())); |
| 73 } | 73 } |
| 74 | 74 |
| 75 sync_api::HttpPostProviderFactory* | 75 sync_api::HttpPostProviderFactory* |
| 76 SyncBackendHostForProfileSyncTest::MakeHttpBridgeFactory( | 76 SyncBackendHostForProfileSyncTest::MakeHttpBridgeFactory( |
| 77 const scoped_refptr<net::URLRequestContextGetter>& getter) { | 77 const scoped_refptr<net::URLRequestContextGetter>& getter) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 // The SyncBackend posts a task to the current loop when | 91 // The SyncBackend posts a task to the current loop when |
| 92 // initialization completes. | 92 // initialization completes. |
| 93 MessageLoop::current()->Run(); | 93 MessageLoop::current()->Run(); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void SyncBackendHostForProfileSyncTest::StartConfiguration( | 97 void SyncBackendHostForProfileSyncTest::StartConfiguration( |
| 98 const base::Closure& callback) { | 98 const base::Closure& callback) { |
| 99 SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(); | 99 SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop(); |
| 100 if (initialization_state_ == DOWNLOADING_NIGORI) { | 100 if (initialization_state_ == DOWNLOADING_NIGORI) { |
| 101 syncable::ModelTypeBitSet sync_ended; | 101 syncable::ModelEnumSet sync_ended; |
| 102 | 102 |
| 103 if (!fail_initial_download_) | 103 if (!fail_initial_download_) |
| 104 sync_ended.set(syncable::NIGORI); | 104 sync_ended.Put(syncable::NIGORI); |
| 105 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 105 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 106 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( | 106 core_->HandleSyncCycleCompletedOnFrontendLoop(new SyncSessionSnapshot( |
| 107 SyncerStatus(), ErrorCounters(), 0, false, | 107 SyncerStatus(), ErrorCounters(), 0, false, |
| 108 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, | 108 sync_ended, download_progress_markers, false, false, 0, 0, 0, false, |
| 109 SyncSourceInfo(), 0, base::Time::Now())); | 109 SyncSourceInfo(), 0, base::Time::Now())); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 void SyncBackendHostForProfileSyncTest:: | 113 void SyncBackendHostForProfileSyncTest:: |
| 114 SetDefaultExpectationsForWorkerCreation(ProfileMock* profile) { | 114 SetDefaultExpectationsForWorkerCreation(ProfileMock* profile) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 void TestProfileSyncService::CreateBackend() { | 239 void TestProfileSyncService::CreateBackend() { |
| 240 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( | 240 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( |
| 241 profile(), | 241 profile(), |
| 242 sync_prefs_.AsWeakPtr(), | 242 sync_prefs_.AsWeakPtr(), |
| 243 set_initial_sync_ended_on_init_, | 243 set_initial_sync_ended_on_init_, |
| 244 synchronous_backend_initialization_, | 244 synchronous_backend_initialization_, |
| 245 fail_initial_download_)); | 245 fail_initial_download_)); |
| 246 } | 246 } |
| OLD | NEW |