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

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

Issue 442403003: Update SyncManager::Init to use a GURL for the sync server URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix sync_client.cc too. 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"
11 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 11 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
12 #include "sync/internal_api/public/test/test_internal_components_factory.h" 12 #include "sync/internal_api/public/test/test_internal_components_factory.h"
13 #include "sync/internal_api/public/write_node.h" 13 #include "sync/internal_api/public/write_node.h"
14 #include "sync/internal_api/public/write_transaction.h" 14 #include "sync/internal_api/public/write_transaction.h"
15 #include "sync/internal_api/sync_backup_manager.h" 15 #include "sync/internal_api/sync_backup_manager.h"
16 #include "sync/syncable/entry.h" 16 #include "sync/syncable/entry.h"
17 #include "sync/test/engine/fake_model_worker.h" 17 #include "sync/test/engine/fake_model_worker.h"
18 #include "sync/test/test_directory_backing_store.h" 18 #include "sync/test/test_directory_backing_store.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "url/gurl.h"
21 22
22 using ::testing::_; 23 using ::testing::_;
23 using ::testing::DoDefault; 24 using ::testing::DoDefault;
24 using ::testing::Invoke; 25 using ::testing::Invoke;
25 using ::testing::Truly; 26 using ::testing::Truly;
26 using ::testing::WithArgs; 27 using ::testing::WithArgs;
27 28
28 namespace syncer { 29 namespace syncer {
29 30
30 namespace { 31 namespace {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _)) 109 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _))
109 .WillOnce(WithArgs<2>(Invoke(this, 110 .WillOnce(WithArgs<2>(Invoke(this,
110 &SyncRollbackManagerTest::HandleInit))); 111 &SyncRollbackManagerTest::HandleInit)));
111 112
112 manager->AddObserver(this); 113 manager->AddObserver(this);
113 TestInternalComponentsFactory factory(InternalComponentsFactory::Switches(), 114 TestInternalComponentsFactory factory(InternalComponentsFactory::Switches(),
114 storage_option); 115 storage_option);
115 116
116 base::RunLoop run_loop; 117 base::RunLoop run_loop;
117 manager->Init(temp_dir_.path(), 118 manager->Init(
118 MakeWeakHandle(base::WeakPtr<JsEventHandler>()), 119 temp_dir_.path(),
119 "", 0, true, scoped_ptr<HttpPostProviderFactory>().Pass(), 120 MakeWeakHandle(base::WeakPtr<JsEventHandler>()),
120 std::vector<scoped_refptr<ModelSafeWorker> >(1, 121 GURL("https://example.com/"),
121 worker_.get()), 122 scoped_ptr<HttpPostProviderFactory>().Pass(),
122 NULL, delegate, SyncCredentials(), "", "", "", &factory, 123 std::vector<scoped_refptr<ModelSafeWorker> >(1, worker_.get()),
123 NULL, scoped_ptr<UnrecoverableErrorHandler>().Pass(), 124 NULL,
124 NULL, NULL); 125 delegate,
126 SyncCredentials(),
127 "",
128 "",
129 "",
130 &factory,
131 NULL,
132 scoped_ptr<UnrecoverableErrorHandler>().Pass(),
133 NULL,
134 NULL);
125 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); 135 loop_.PostTask(FROM_HERE, run_loop.QuitClosure());
126 run_loop.Run(); 136 run_loop.Run();
127 } 137 }
128 138
129 // Create and persist an entry by unique tag in DB. 139 // Create and persist an entry by unique tag in DB.
130 void PrepopulateDb(ModelType type, const std::string& client_tag) { 140 void PrepopulateDb(ModelType type, const std::string& client_tag) {
131 SyncBackupManager backup_manager; 141 SyncBackupManager backup_manager;
132 TestChangeDelegate delegate; 142 TestChangeDelegate delegate;
133 InitManager(&backup_manager, ModelTypeSet(type), &delegate, 143 InitManager(&backup_manager, ModelTypeSet(type), &delegate,
134 STORAGE_ON_DISK); 144 STORAGE_ON_DISK);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // Test graceful shutdown on initialization failure. 266 // Test graceful shutdown on initialization failure.
257 scoped_ptr<SyncRollbackManager> rollback_manager( 267 scoped_ptr<SyncRollbackManager> rollback_manager(
258 new SyncRollbackManager); 268 new SyncRollbackManager);
259 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, 269 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL,
260 STORAGE_ON_DISK); 270 STORAGE_ON_DISK);
261 } 271 }
262 272
263 } // anonymous namespace 273 } // anonymous namespace
264 274
265 } // namespace syncer 275 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698