Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: chrome/browser/sync/test_profile_sync_service.cc

Issue 11474036: Remove initial_sync_ended bits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.h ('k') | sync/engine/all_status.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test_profile_sync_service.h" 5 #include "chrome/browser/sync/test_profile_sync_service.h"
6 6
7 #include "chrome/browser/signin/signin_manager.h" 7 #include "chrome/browser/signin/signin_manager.h"
8 #include "chrome/browser/signin/signin_manager_factory.h" 8 #include "chrome/browser/signin/signin_manager_factory.h"
9 #include "chrome/browser/sync/glue/data_type_controller.h" 9 #include "chrome/browser/sync/glue/data_type_controller.h"
10 #include "chrome/browser/sync/glue/sync_backend_host.h" 10 #include "chrome/browser/sync/glue/sync_backend_host.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (!callback_.is_null()) { 126 if (!callback_.is_null()) {
127 callback_.Run(); 127 callback_.Run();
128 } 128 }
129 129
130 // Pretend we downloaded initial updates and set initial sync ended bits 130 // Pretend we downloaded initial updates and set initial sync ended bits
131 // if we were asked to. 131 // if we were asked to.
132 if (set_initial_sync_ended_on_init_) { 132 if (set_initial_sync_ended_on_init_) {
133 UserShare* user_share = GetUserShare(); 133 UserShare* user_share = GetUserShare();
134 Directory* directory = user_share->directory.get(); 134 Directory* directory = user_share->directory.get();
135 135
136 if (!directory->initial_sync_ended_for_type(NIGORI)) { 136 if (!directory->InitialSyncEndedForType(NIGORI)) {
137 syncer::TestUserShare::CreateRoot(NIGORI, user_share); 137 syncer::TestUserShare::CreateRoot(NIGORI, user_share);
138 138
139 // A side effect of adding the NIGORI mode (normally done by the 139 // A side effect of adding the NIGORI mode (normally done by the
140 // syncer) is a decryption attempt, which will fail the first time. 140 // syncer) is a decryption attempt, which will fail the first time.
141 } 141 }
142 142
143 if (!directory->initial_sync_ended_for_type(DEVICE_INFO)) { 143 if (!directory->InitialSyncEndedForType(DEVICE_INFO)) {
144 syncer::TestUserShare::CreateRoot(DEVICE_INFO, user_share); 144 syncer::TestUserShare::CreateRoot(DEVICE_INFO, user_share);
145 } 145 }
146 146
147 if (!directory->initial_sync_ended_for_type(EXPERIMENTS)) { 147 if (!directory->InitialSyncEndedForType(EXPERIMENTS)) {
148 syncer::TestUserShare::CreateRoot(EXPERIMENTS, user_share); 148 syncer::TestUserShare::CreateRoot(EXPERIMENTS, user_share);
149 } 149 }
150 150
151 SetInitialSyncEndedForAllTypes();
152 restored_types = syncer::ModelTypeSet::All(); 151 restored_types = syncer::ModelTypeSet::All();
153 } 152 }
154 153
155 initial_download_closure_ = base::Bind( 154 initial_download_closure_ = base::Bind(
156 &SyncBackendHostForProfileSyncTest::ContinueInitialization, 155 &SyncBackendHostForProfileSyncTest::ContinueInitialization,
157 weak_ptr_factory_.GetWeakPtr(), 156 weak_ptr_factory_.GetWeakPtr(),
158 js_backend, 157 js_backend,
159 debug_info_listener, 158 debug_info_listener,
160 restored_types); 159 restored_types);
161 if (fail_initial_download_) { 160 if (fail_initial_download_) {
162 frontend()->OnSyncConfigureRetry(); 161 frontend()->OnSyncConfigureRetry();
163 if (synchronous_init_) 162 if (synchronous_init_)
164 MessageLoop::current()->Quit(); 163 MessageLoop::current()->Quit();
165 } else { 164 } else {
166 initial_download_closure_.Run(); 165 initial_download_closure_.Run();
167 initial_download_closure_.Reset(); 166 initial_download_closure_.Reset();
168 } 167 }
169 } 168 }
170 169
171 void SyncBackendHostForProfileSyncTest::SetInitialSyncEndedForAllTypes() {
172 UserShare* user_share = GetUserShare();
173 Directory* directory = user_share->directory.get();
174
175 for (int i = syncer::FIRST_REAL_MODEL_TYPE;
176 i < syncer::MODEL_TYPE_COUNT; ++i) {
177 directory->set_initial_sync_ended_for_type(
178 syncer::ModelTypeFromInt(i), true);
179 }
180 }
181
182 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange( 170 void SyncBackendHostForProfileSyncTest::EmitOnInvalidatorStateChange(
183 syncer::InvalidatorState state) { 171 syncer::InvalidatorState state) {
184 frontend()->OnInvalidatorStateChange(state); 172 frontend()->OnInvalidatorStateChange(state);
185 } 173 }
186 174
187 void SyncBackendHostForProfileSyncTest::EmitOnIncomingInvalidation( 175 void SyncBackendHostForProfileSyncTest::EmitOnIncomingInvalidation(
188 const syncer::ObjectIdInvalidationMap& invalidation_map, 176 const syncer::ObjectIdInvalidationMap& invalidation_map,
189 const syncer::IncomingInvalidationSource source) { 177 const syncer::IncomingInvalidationSource source) {
190 frontend()->OnIncomingInvalidation(invalidation_map, source); 178 frontend()->OnIncomingInvalidation(invalidation_map, source);
191 } 179 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 profile(), 282 profile(),
295 sync_prefs_.AsWeakPtr(), 283 sync_prefs_.AsWeakPtr(),
296 invalidator_storage_.AsWeakPtr(), 284 invalidator_storage_.AsWeakPtr(),
297 id_factory_, 285 id_factory_,
298 callback_, 286 callback_,
299 set_initial_sync_ended_on_init_, 287 set_initial_sync_ended_on_init_,
300 synchronous_backend_initialization_, 288 synchronous_backend_initialization_,
301 fail_initial_download_, 289 fail_initial_download_,
302 storage_option_)); 290 storage_option_));
303 } 291 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.h ('k') | sync/engine/all_status.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698