| OLD | NEW |
| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(), | 114 TestInternalComponentsFactory factory(InternalComponentsFactory::Switches(), |
| 115 storage_option); | 115 storage_option); |
| 116 | 116 |
| 117 base::RunLoop run_loop; | 117 base::RunLoop run_loop; |
| 118 manager->Init( | 118 SyncManager::InitArgs args; |
| 119 temp_dir_.path(), | 119 args.database_location = temp_dir_.path(); |
| 120 MakeWeakHandle(base::WeakPtr<JsEventHandler>()), | 120 args.service_url = GURL("https://example.com/"); |
| 121 GURL("https://example.com/"), | 121 args.workers.push_back(worker_); |
| 122 scoped_ptr<HttpPostProviderFactory>().Pass(), | 122 args.change_delegate = delegate; |
| 123 std::vector<scoped_refptr<ModelSafeWorker> >(1, worker_.get()), | 123 args.internal_components_factory = &factory; |
| 124 NULL, | 124 manager->Init(&args); |
| 125 delegate, | |
| 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()); | 125 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); |
| 136 run_loop.Run(); | 126 run_loop.Run(); |
| 137 } | 127 } |
| 138 | 128 |
| 139 // Create and persist an entry by unique tag in DB. | 129 // Create and persist an entry by unique tag in DB. |
| 140 void PrepopulateDb(ModelType type, const std::string& client_tag) { | 130 void PrepopulateDb(ModelType type, const std::string& client_tag) { |
| 141 SyncBackupManager backup_manager; | 131 SyncBackupManager backup_manager; |
| 142 TestChangeDelegate delegate; | 132 TestChangeDelegate delegate; |
| 143 InitManager(&backup_manager, ModelTypeSet(type), &delegate, | 133 InitManager(&backup_manager, ModelTypeSet(type), &delegate, |
| 144 STORAGE_ON_DISK); | 134 STORAGE_ON_DISK); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // Test graceful shutdown on initialization failure. | 256 // Test graceful shutdown on initialization failure. |
| 267 scoped_ptr<SyncRollbackManager> rollback_manager( | 257 scoped_ptr<SyncRollbackManager> rollback_manager( |
| 268 new SyncRollbackManager); | 258 new SyncRollbackManager); |
| 269 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, | 259 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, |
| 270 STORAGE_ON_DISK); | 260 STORAGE_ON_DISK); |
| 271 } | 261 } |
| 272 | 262 |
| 273 } // anonymous namespace | 263 } // anonymous namespace |
| 274 | 264 |
| 275 } // namespace syncer | 265 } // namespace syncer |
| OLD | NEW |