OLD | NEW |
---|---|
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" |
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/test/test_user_share.h" | 15 #include "sync/internal_api/public/test/test_user_share.h" |
16 #include "sync/internal_api/public/user_share.h" | 16 #include "sync/internal_api/public/user_share.h" |
17 #include "sync/js/js_reply_handler.h" | 17 #include "sync/js/js_reply_handler.h" |
18 #include "sync/protocol/encryption.pb.h" | 18 #include "sync/protocol/encryption.pb.h" |
19 #include "sync/syncable/directory.h" | 19 #include "sync/syncable/directory.h" |
20 | 20 |
21 using syncer::InternalComponentsFactory; | 21 using syncer::InternalComponentsFactory; |
22 using syncer::ModelSafeRoutingInfo; | 22 using syncer::ModelSafeRoutingInfo; |
23 using syncer::TestInternalComponentsFactory; | 23 using syncer::TestInternalComponentsFactory; |
24 using syncer::sessions::ModelNeutralState; | 24 using syncer::sessions::ModelNeutralState; |
25 using syncer::sessions::SyncSessionSnapshot; | 25 using syncer::sessions::SyncSessionSnapshot; |
26 using syncer::sessions::SyncSourceInfo; | 26 using syncer::sessions::SyncSourceInfo; |
27 using syncer::UserShare; | 27 using syncer::UserShare; |
28 using syncer::syncable::Directory; | 28 using syncer::syncable::Directory; |
29 using syncer::NIGORI; | 29 using syncer::CONTROL_PREFERENCES; |
30 using syncer::DEVICE_INFO; | 30 using syncer::DEVICE_INFO; |
31 using syncer::EXPERIMENTS; | 31 using syncer::EXPERIMENTS; |
32 using syncer::NIGORI; | |
32 | 33 |
33 namespace browser_sync { | 34 namespace browser_sync { |
34 | 35 |
35 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( | 36 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( |
36 Profile* profile, | 37 Profile* profile, |
37 const base::WeakPtr<SyncPrefs>& sync_prefs, | 38 const base::WeakPtr<SyncPrefs>& sync_prefs, |
38 const base::WeakPtr<InvalidatorStorage>& invalidator_storage, | 39 const base::WeakPtr<InvalidatorStorage>& invalidator_storage, |
39 syncer::TestIdFactory& id_factory, | 40 syncer::TestIdFactory& id_factory, |
40 base::Closure& callback, | 41 base::Closure& callback, |
41 bool set_initial_sync_ended_on_init, | 42 bool set_initial_sync_ended_on_init, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 | 130 |
130 // Pretend we downloaded initial updates and set initial sync ended bits | 131 // Pretend we downloaded initial updates and set initial sync ended bits |
131 // if we were asked to. | 132 // if we were asked to. |
132 if (set_initial_sync_ended_on_init_) { | 133 if (set_initial_sync_ended_on_init_) { |
133 UserShare* user_share = GetUserShare(); | 134 UserShare* user_share = GetUserShare(); |
134 Directory* directory = user_share->directory.get(); | 135 Directory* directory = user_share->directory.get(); |
135 | 136 |
136 if (!directory->InitialSyncEndedForType(NIGORI)) { | 137 if (!directory->InitialSyncEndedForType(NIGORI)) { |
137 syncer::TestUserShare::CreateRoot(NIGORI, user_share); | 138 syncer::TestUserShare::CreateRoot(NIGORI, user_share); |
138 | 139 |
139 // A side effect of adding the NIGORI mode (normally done by the | 140 // A side effect of adding the NIGORI node (normally done by the |
140 // syncer) is a decryption attempt, which will fail the first time. | 141 // syncer) is a decryption attempt, which will fail the first time. |
141 } | 142 } |
142 | 143 |
143 if (!directory->InitialSyncEndedForType(DEVICE_INFO)) { | 144 if (!directory->InitialSyncEndedForType(DEVICE_INFO)) { |
144 syncer::TestUserShare::CreateRoot(DEVICE_INFO, user_share); | 145 syncer::TestUserShare::CreateRoot(DEVICE_INFO, user_share); |
145 } | 146 } |
146 | 147 |
147 if (!directory->InitialSyncEndedForType(EXPERIMENTS)) { | 148 if (!directory->InitialSyncEndedForType(EXPERIMENTS)) { |
148 syncer::TestUserShare::CreateRoot(EXPERIMENTS, user_share); | 149 syncer::TestUserShare::CreateRoot(EXPERIMENTS, user_share); |
149 } | 150 } |
150 | 151 |
152 // XXX | |
rlarocque
2013/01/03 22:40:44
If you want to leave a TODO, please use the standa
albertb
2013/01/07 19:00:01
Done.
| |
153 if (!directory->InitialSyncEndedForType(CONTROL_PREFERENCES)) { | |
154 syncer::TestUserShare::CreateRoot(CONTROL_PREFERENCES, user_share); | |
155 } | |
156 | |
151 restored_types = syncer::ModelTypeSet::All(); | 157 restored_types = syncer::ModelTypeSet::All(); |
152 } | 158 } |
153 | 159 |
154 initial_download_closure_ = base::Bind( | 160 initial_download_closure_ = base::Bind( |
155 &SyncBackendHostForProfileSyncTest::ContinueInitialization, | 161 &SyncBackendHostForProfileSyncTest::ContinueInitialization, |
156 weak_ptr_factory_.GetWeakPtr(), | 162 weak_ptr_factory_.GetWeakPtr(), |
157 js_backend, | 163 js_backend, |
158 debug_info_listener, | 164 debug_info_listener, |
159 restored_types); | 165 restored_types); |
160 if (fail_initial_download_) { | 166 if (fail_initial_download_) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 profile(), | 288 profile(), |
283 sync_prefs_.AsWeakPtr(), | 289 sync_prefs_.AsWeakPtr(), |
284 invalidator_storage_.AsWeakPtr(), | 290 invalidator_storage_.AsWeakPtr(), |
285 id_factory_, | 291 id_factory_, |
286 callback_, | 292 callback_, |
287 set_initial_sync_ended_on_init_, | 293 set_initial_sync_ended_on_init_, |
288 synchronous_backend_initialization_, | 294 synchronous_backend_initialization_, |
289 fail_initial_download_, | 295 fail_initial_download_, |
290 storage_option_)); | 296 storage_option_)); |
291 } | 297 } |
OLD | NEW |