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/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::InternalComponentsFactory; |
20 using syncer::ModelSafeRoutingInfo; | 21 using syncer::ModelSafeRoutingInfo; |
21 using syncer::TestInternalComponentsFactory; | 22 using syncer::TestInternalComponentsFactory; |
22 using syncer::sessions::ModelNeutralState; | 23 using syncer::sessions::ModelNeutralState; |
23 using syncer::sessions::SyncSessionSnapshot; | 24 using syncer::sessions::SyncSessionSnapshot; |
24 using syncer::sessions::SyncSourceInfo; | 25 using syncer::sessions::SyncSourceInfo; |
25 using syncer::UserShare; | 26 using syncer::UserShare; |
26 using syncer::syncable::Directory; | 27 using syncer::syncable::Directory; |
27 | 28 |
28 namespace browser_sync { | 29 namespace browser_sync { |
29 | 30 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DoInitializeOptions test_options = options; | 63 DoInitializeOptions test_options = options; |
63 test_options.make_http_bridge_factory_fn = | 64 test_options.make_http_bridge_factory_fn = |
64 base::Bind(&MakeTestHttpBridgeFactory); | 65 base::Bind(&MakeTestHttpBridgeFactory); |
65 test_options.credentials.email = "testuser@gmail.com"; | 66 test_options.credentials.email = "testuser@gmail.com"; |
66 test_options.credentials.sync_token = "token"; | 67 test_options.credentials.sync_token = "token"; |
67 test_options.restored_key_for_bootstrapping = ""; | 68 test_options.restored_key_for_bootstrapping = ""; |
68 syncer::StorageOption storage = storage_option_; | 69 syncer::StorageOption storage = storage_option_; |
69 | 70 |
70 // It'd be nice if we avoided creating the InternalComponentsFactory in the | 71 // It'd be nice if we avoided creating the InternalComponentsFactory in the |
71 // first place, but SyncBackendHost will have created one by now so we must | 72 // first place, but SyncBackendHost will have created one by now so we must |
72 // free it. | 73 // free it. Grab the switches to pass on first. |
| 74 InternalComponentsFactory::Switches factory_switches = |
| 75 test_options.internal_components_factory->GetSwitches(); |
73 delete test_options.internal_components_factory; | 76 delete test_options.internal_components_factory; |
| 77 |
74 test_options.internal_components_factory = | 78 test_options.internal_components_factory = |
75 new TestInternalComponentsFactory(storage); | 79 new TestInternalComponentsFactory(factory_switches, storage); |
| 80 |
76 SyncBackendHost::InitCore(test_options); | 81 SyncBackendHost::InitCore(test_options); |
77 if (synchronous_init_) { | 82 if (synchronous_init_) { |
78 // The SyncBackend posts a task to the current loop when | 83 // The SyncBackend posts a task to the current loop when |
79 // initialization completes. | 84 // initialization completes. |
80 MessageLoop::current()->Run(); | 85 MessageLoop::current()->Run(); |
81 } | 86 } |
82 } | 87 } |
83 | 88 |
84 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( | 89 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( |
85 syncer::ConfigureReason reason, | 90 syncer::ConfigureReason reason, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 profile(), | 242 profile(), |
238 sync_prefs_.AsWeakPtr(), | 243 sync_prefs_.AsWeakPtr(), |
239 invalidator_storage_.AsWeakPtr(), | 244 invalidator_storage_.AsWeakPtr(), |
240 id_factory_, | 245 id_factory_, |
241 callback_, | 246 callback_, |
242 set_initial_sync_ended_on_init_, | 247 set_initial_sync_ended_on_init_, |
243 synchronous_backend_initialization_, | 248 synchronous_backend_initialization_, |
244 fail_initial_download_, | 249 fail_initial_download_, |
245 storage_option_)); | 250 storage_option_)); |
246 } | 251 } |
OLD | NEW |