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

Side by Side Diff: sync/internal_api/sync_rollback_manager_unittest.cc

Issue 451743002: Pass args to SyncManager::Init via a struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use scoped_ptr instead of raw pointer. Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sync/internal_api/sync_rollback_manager.h" 5 #include "sync/internal_api/sync_rollback_manager.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "sync/internal_api/public/read_node.h" 9 #include "sync/internal_api/public/read_node.h"
10 #include "sync/internal_api/public/read_transaction.h" 10 #include "sync/internal_api/public/read_transaction.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void InitManager(SyncManager* manager, ModelTypeSet types, 104 void InitManager(SyncManager* manager, ModelTypeSet types,
105 TestChangeDelegate* delegate, StorageOption storage_option) { 105 TestChangeDelegate* delegate, StorageOption storage_option) {
106 manager_ = manager; 106 manager_ = manager;
107 types_ = types; 107 types_ = types;
108 108
109 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _)) 109 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _))
110 .WillOnce(WithArgs<2>(Invoke(this, 110 .WillOnce(WithArgs<2>(Invoke(this,
111 &SyncRollbackManagerTest::HandleInit))); 111 &SyncRollbackManagerTest::HandleInit)));
112 112
113 manager->AddObserver(this); 113 manager->AddObserver(this);
114 TestInternalComponentsFactory factory(InternalComponentsFactory::Switches(),
115 storage_option);
116 114
117 base::RunLoop run_loop; 115 base::RunLoop run_loop;
118 manager->Init( 116 SyncManager::InitArgs args;
119 temp_dir_.path(), 117 args.database_location = temp_dir_.path();
120 MakeWeakHandle(base::WeakPtr<JsEventHandler>()), 118 args.service_url = GURL("https://example.com/");
121 GURL("https://example.com/"), 119 args.workers.push_back(worker_);
122 scoped_ptr<HttpPostProviderFactory>().Pass(), 120 args.change_delegate = delegate;
123 std::vector<scoped_refptr<ModelSafeWorker> >(1, worker_.get()), 121 args.internal_components_factory.reset(new TestInternalComponentsFactory(
124 NULL, 122 InternalComponentsFactory::Switches(), storage_option));
125 delegate, 123 manager->Init(&args);
126 SyncCredentials(),
127 "",
128 "",
129 "",
130 &factory,
131 NULL,
132 scoped_ptr<UnrecoverableErrorHandler>().Pass(),
133 NULL,
134 NULL);
135 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); 124 loop_.PostTask(FROM_HERE, run_loop.QuitClosure());
136 run_loop.Run(); 125 run_loop.Run();
137 } 126 }
138 127
139 // Create and persist an entry by unique tag in DB. 128 // Create and persist an entry by unique tag in DB.
140 void PrepopulateDb(ModelType type, const std::string& client_tag) { 129 void PrepopulateDb(ModelType type, const std::string& client_tag) {
141 SyncBackupManager backup_manager; 130 SyncBackupManager backup_manager;
142 TestChangeDelegate delegate; 131 TestChangeDelegate delegate;
143 InitManager(&backup_manager, ModelTypeSet(type), &delegate, 132 InitManager(&backup_manager, ModelTypeSet(type), &delegate,
144 STORAGE_ON_DISK); 133 STORAGE_ON_DISK);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Test graceful shutdown on initialization failure. 255 // Test graceful shutdown on initialization failure.
267 scoped_ptr<SyncRollbackManager> rollback_manager( 256 scoped_ptr<SyncRollbackManager> rollback_manager(
268 new SyncRollbackManager); 257 new SyncRollbackManager);
269 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, 258 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL,
270 STORAGE_ON_DISK); 259 STORAGE_ON_DISK);
271 } 260 }
272 261
273 } // anonymous namespace 262 } // anonymous namespace
274 263
275 } // namespace syncer 264 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_rollback_manager_base_unittest.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698