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

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

Issue 10701046: sync: Remove SyncManager::TestingMode in favour of InternalComponentsFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 8 years, 5 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/test/test_internal_components_factory.h"
15 #include "sync/internal_api/public/user_share.h" 16 #include "sync/internal_api/public/user_share.h"
16 #include "sync/js/js_reply_handler.h" 17 #include "sync/js/js_reply_handler.h"
17 #include "sync/protocol/encryption.pb.h" 18 #include "sync/protocol/encryption.pb.h"
18 #include "sync/syncable/directory.h" 19 #include "sync/syncable/directory.h"
19 20
20 using syncer::ModelSafeRoutingInfo; 21 using syncer::ModelSafeRoutingInfo;
22 using syncer::TestInternalComponentsFactory;
21 using syncer::sessions::ModelNeutralState; 23 using syncer::sessions::ModelNeutralState;
22 using syncer::sessions::SyncSessionSnapshot; 24 using syncer::sessions::SyncSessionSnapshot;
23 using syncer::sessions::SyncSourceInfo; 25 using syncer::sessions::SyncSourceInfo;
24 using syncer::UserShare; 26 using syncer::UserShare;
25 using syncer::syncable::Directory; 27 using syncer::syncable::Directory;
26 28
27 namespace browser_sync { 29 namespace browser_sync {
28 30
29 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( 31 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest(
30 Profile* profile, 32 Profile* profile,
(...skipping 20 matching lines...) Expand all
51 } // namespace 53 } // namespace
52 54
53 void SyncBackendHostForProfileSyncTest::InitCore( 55 void SyncBackendHostForProfileSyncTest::InitCore(
54 const DoInitializeOptions& options) { 56 const DoInitializeOptions& options) {
55 DoInitializeOptions test_options = options; 57 DoInitializeOptions test_options = options;
56 test_options.make_http_bridge_factory_fn = 58 test_options.make_http_bridge_factory_fn =
57 base::Bind(&MakeTestHttpBridgeFactory); 59 base::Bind(&MakeTestHttpBridgeFactory);
58 test_options.credentials.email = "testuser@gmail.com"; 60 test_options.credentials.email = "testuser@gmail.com";
59 test_options.credentials.sync_token = "token"; 61 test_options.credentials.sync_token = "token";
60 test_options.restored_key_for_bootstrapping = ""; 62 test_options.restored_key_for_bootstrapping = "";
61 test_options.testing_mode = 63 TestInternalComponentsFactory::StorageOption storage =
62 use_real_database_ ? syncer::SyncManager::TEST_ON_DISK 64 use_real_database_ ? TestInternalComponentsFactory::ON_DISK
63 : syncer::SyncManager::TEST_IN_MEMORY; 65 : TestInternalComponentsFactory::IN_MEMORY;
66
67 // It'd be nice if we avoided creating the InternalComponentsFactory in the
68 // first place, but SyncBackendHost will have created one by now so we must
69 // free it.
70 delete test_options.internal_components_factory;
71 test_options.internal_components_factory =
72 new TestInternalComponentsFactory(storage);
64 SyncBackendHost::InitCore(test_options); 73 SyncBackendHost::InitCore(test_options);
65 // TODO(akalin): Figure out a better way to do this. 74 // TODO(akalin): Figure out a better way to do this.
66 if (synchronous_init_) { 75 if (synchronous_init_) {
67 // The SyncBackend posts a task to the current loop when 76 // The SyncBackend posts a task to the current loop when
68 // initialization completes. 77 // initialization completes.
69 MessageLoop::current()->Run(); 78 MessageLoop::current()->Run();
70 } 79 }
71 } 80 }
72 81
73 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer( 82 void SyncBackendHostForProfileSyncTest::RequestConfigureSyncer(
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void TestProfileSyncService::CreateBackend() { 212 void TestProfileSyncService::CreateBackend() {
204 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest( 213 backend_.reset(new browser_sync::SyncBackendHostForProfileSyncTest(
205 profile(), 214 profile(),
206 sync_prefs_.AsWeakPtr(), 215 sync_prefs_.AsWeakPtr(),
207 invalidator_storage_.AsWeakPtr(), 216 invalidator_storage_.AsWeakPtr(),
208 set_initial_sync_ended_on_init_, 217 set_initial_sync_ended_on_init_,
209 synchronous_backend_initialization_, 218 synchronous_backend_initialization_,
210 fail_initial_download_, 219 fail_initial_download_,
211 use_real_database_)); 220 use_real_database_));
212 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698