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

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

Issue 10958007: sync: Refactor CreateRoot() test helper function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Found more stuff to clean up Created 8 years, 3 months 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
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/sync/abstract_profile_sync_service_test.h"
9 #include "chrome/browser/sync/glue/data_type_controller.h" 8 #include "chrome/browser/sync/glue/data_type_controller.h"
10 #include "chrome/browser/sync/glue/sync_backend_host.h" 9 #include "chrome/browser/sync/glue/sync_backend_host.h"
11 #include "chrome/browser/sync/profile_sync_components_factory.h" 10 #include "chrome/browser/sync/profile_sync_components_factory.h"
12 #include "chrome/browser/sync/test/test_http_bridge_factory.h" 11 #include "chrome/browser/sync/test/test_http_bridge_factory.h"
13 #include "chrome/common/chrome_notification_types.h" 12 #include "chrome/common/chrome_notification_types.h"
14 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 13 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
14 #include "sync/internal_api/public/test/test_user_share.h"
15 #include "sync/internal_api/public/user_share.h" 15 #include "sync/internal_api/public/user_share.h"
16 #include "sync/js/js_reply_handler.h" 16 #include "sync/js/js_reply_handler.h"
17 #include "sync/protocol/encryption.pb.h" 17 #include "sync/protocol/encryption.pb.h"
18 #include "sync/syncable/directory.h" 18 #include "sync/syncable/directory.h"
19 19
20 using syncer::InternalComponentsFactory; 20 using syncer::InternalComponentsFactory;
21 using syncer::ModelSafeRoutingInfo; 21 using syncer::ModelSafeRoutingInfo;
22 using syncer::TestInternalComponentsFactory; 22 using syncer::TestInternalComponentsFactory;
23 using syncer::sessions::ModelNeutralState; 23 using syncer::sessions::ModelNeutralState;
24 using syncer::sessions::SyncSessionSnapshot; 24 using syncer::sessions::SyncSessionSnapshot;
25 using syncer::sessions::SyncSourceInfo; 25 using syncer::sessions::SyncSourceInfo;
26 using syncer::UserShare; 26 using syncer::UserShare;
27 using syncer::syncable::Directory; 27 using syncer::syncable::Directory;
28 using syncer::NIGORI;
28 29
29 namespace browser_sync { 30 namespace browser_sync {
30 31
31 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( 32 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest(
32 Profile* profile, 33 Profile* profile,
33 const base::WeakPtr<SyncPrefs>& sync_prefs, 34 const base::WeakPtr<SyncPrefs>& sync_prefs,
34 const base::WeakPtr<InvalidatorStorage>& invalidator_storage, 35 const base::WeakPtr<InvalidatorStorage>& invalidator_storage,
35 syncer::TestIdFactory& id_factory, 36 syncer::TestIdFactory& id_factory,
36 base::Closure& callback, 37 base::Closure& callback,
37 bool set_initial_sync_ended_on_init, 38 bool set_initial_sync_ended_on_init,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if (!callback_.is_null()) { 112 if (!callback_.is_null()) {
112 callback_.Run(); 113 callback_.Run();
113 } 114 }
114 115
115 // Pretend we downloaded initial updates and set initial sync ended bits 116 // Pretend we downloaded initial updates and set initial sync ended bits
116 // if we were asked to. 117 // if we were asked to.
117 if (set_initial_sync_ended_on_init_) { 118 if (set_initial_sync_ended_on_init_) {
118 UserShare* user_share = GetUserShare(); 119 UserShare* user_share = GetUserShare();
119 Directory* directory = user_share->directory.get(); 120 Directory* directory = user_share->directory.get();
120 121
121 if (!directory->initial_sync_ended_for_type(syncer::NIGORI)) { 122 if (!directory->initial_sync_ended_for_type(NIGORI)) {
122 ProfileSyncServiceTestHelper::CreateRoot( 123 syncer::TestUserShare::CreateRoot(NIGORI, user_share);
123 syncer::NIGORI, user_share, &id_factory_);
124 124
125 // A side effect of adding the NIGORI mode (normally done by the 125 // A side effect of adding the NIGORI mode (normally done by the
126 // syncer) is a decryption attempt, which will fail the first time. 126 // syncer) is a decryption attempt, which will fail the first time.
127 } 127 }
128 128
129 SetInitialSyncEndedForAllTypes(); 129 SetInitialSyncEndedForAllTypes();
130 restored_types = syncer::ModelTypeSet::All(); 130 restored_types = syncer::ModelTypeSet::All();
131 } 131 }
132 } 132 }
133 133
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 profile(), 234 profile(),
235 sync_prefs_.AsWeakPtr(), 235 sync_prefs_.AsWeakPtr(),
236 invalidator_storage_.AsWeakPtr(), 236 invalidator_storage_.AsWeakPtr(),
237 id_factory_, 237 id_factory_,
238 callback_, 238 callback_,
239 set_initial_sync_ended_on_init_, 239 set_initial_sync_ended_on_init_,
240 synchronous_backend_initialization_, 240 synchronous_backend_initialization_,
241 fail_initial_download_, 241 fail_initial_download_,
242 storage_option_)); 242 storage_option_));
243 } 243 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | sync/internal_api/public/test/test_user_share.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698