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

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

Issue 10825137: FYI: Control Data + Per-Device Metadata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PER_USER_METADATA, refactor some encryption code Created 8 years, 4 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" 8 #include "chrome/browser/sync/abstract_profile_sync_service_test.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"
11 #include "chrome/browser/sync/profile_sync_components_factory.h" 11 #include "chrome/browser/sync/profile_sync_components_factory.h"
12 #include "chrome/browser/sync/test/test_http_bridge_factory.h" 12 #include "chrome/browser/sync/test/test_http_bridge_factory.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 14 #include "sync/internal_api/public/sessions/sync_session_snapshot.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::ModelSafeRoutingInfo; 20 using syncer::ModelSafeRoutingInfo;
21 using syncer::TestInternalComponentsFactory; 21 using syncer::TestInternalComponentsFactory;
22 using syncer::sessions::ModelNeutralState; 22 using syncer::sessions::ModelNeutralState;
23 using syncer::sessions::SyncSessionSnapshot; 23 using syncer::sessions::SyncSessionSnapshot;
24 using syncer::sessions::SyncSourceInfo; 24 using syncer::sessions::SyncSourceInfo;
25 using syncer::UserShare; 25 using syncer::UserShare;
26 using syncer::syncable::Directory; 26 using syncer::syncable::Directory;
27 using syncer::NIGORI;
28 using syncer::PER_DEVICE_METADATA;
29 using syncer::PER_USER_METADATA;
27 30
28 namespace browser_sync { 31 namespace browser_sync {
29 32
30 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( 33 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest(
31 Profile* profile, 34 Profile* profile,
32 const base::WeakPtr<SyncPrefs>& sync_prefs, 35 const base::WeakPtr<SyncPrefs>& sync_prefs,
33 const base::WeakPtr<InvalidatorStorage>& invalidator_storage, 36 const base::WeakPtr<InvalidatorStorage>& invalidator_storage,
34 syncer::TestIdFactory& id_factory, 37 syncer::TestIdFactory& id_factory,
35 base::Closure& callback, 38 base::Closure& callback,
36 bool set_initial_sync_ended_on_init, 39 bool set_initial_sync_ended_on_init,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (!callback_.is_null()) { 109 if (!callback_.is_null()) {
107 callback_.Run(); 110 callback_.Run();
108 } 111 }
109 112
110 // Pretend we downloaded initial updates and set initial sync ended bits 113 // Pretend we downloaded initial updates and set initial sync ended bits
111 // if we were asked to. 114 // if we were asked to.
112 if (set_initial_sync_ended_on_init_) { 115 if (set_initial_sync_ended_on_init_) {
113 UserShare* user_share = GetUserShare(); 116 UserShare* user_share = GetUserShare();
114 Directory* directory = user_share->directory.get(); 117 Directory* directory = user_share->directory.get();
115 118
116 if (!directory->initial_sync_ended_for_type(syncer::NIGORI)) { 119 if (!directory->initial_sync_ended_for_type(NIGORI)) {
117 ProfileSyncServiceTestHelper::CreateRoot( 120 ProfileSyncServiceTestHelper::CreateRoot(
118 syncer::NIGORI, user_share, &id_factory_); 121 NIGORI, user_share, &id_factory_);
119 122
120 // A side effect of adding the NIGORI mode (normally done by the 123 // A side effect of adding the NIGORI mode (normally done by the
121 // syncer) is a decryption attempt, which will fail the first time. 124 // syncer) is a decryption attempt, which will fail the first time.
122 } 125 }
123 126
127 if (!directory->initial_sync_ended_for_type(PER_DEVICE_METADATA)) {
rlarocque 2012/08/11 01:31:52 These if statements are probably not required...
128 ProfileSyncServiceTestHelper::CreateRoot(
129 PER_DEVICE_METADATA, user_share, &id_factory_);
130 }
131
132 if (!directory->initial_sync_ended_for_type(PER_USER_METADATA)) {
133 ProfileSyncServiceTestHelper::CreateRoot(
134 PER_USER_METADATA, user_share, &id_factory_);
135 }
136
124 SetInitialSyncEndedForAllTypes(); 137 SetInitialSyncEndedForAllTypes();
125 restored_types = syncer::ModelTypeSet::All(); 138 restored_types = syncer::ModelTypeSet::All();
126 } 139 }
127 } 140 }
128 141
129 SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop( 142 SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop(
130 js_backend, success, restored_types); 143 js_backend, success, restored_types);
131 } 144 }
132 145
133 void SyncBackendHostForProfileSyncTest::SetInitialSyncEndedForAllTypes() { 146 void SyncBackendHostForProfileSyncTest::SetInitialSyncEndedForAllTypes() {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 profile(), 250 profile(),
238 sync_prefs_.AsWeakPtr(), 251 sync_prefs_.AsWeakPtr(),
239 invalidator_storage_.AsWeakPtr(), 252 invalidator_storage_.AsWeakPtr(),
240 id_factory_, 253 id_factory_,
241 callback_, 254 callback_,
242 set_initial_sync_ended_on_init_, 255 set_initial_sync_ended_on_init_,
243 synchronous_backend_initialization_, 256 synchronous_backend_initialization_,
244 fail_initial_download_, 257 fail_initial_download_,
245 storage_option_)); 258 storage_option_));
246 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698