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

Side by Side Diff: components/browser_sync/abstract_profile_sync_service_test.cc

Issue 2538023002: [Sync] Pass a TaskRunner into SBHI/SBHC, not a thread or message loop. (Closed)
Patch Set: Remove thread check in destructor. Created 4 years 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
« no previous file with comments | « no previous file | components/browser_sync/profile_sync_components_factory_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/browser_sync/abstract_profile_sync_service_test.h" 5 #include "components/browser_sync/abstract_profile_sync_service_test.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 18 matching lines...) Expand all
29 29
30 namespace browser_sync { 30 namespace browser_sync {
31 31
32 namespace { 32 namespace {
33 33
34 class SyncBackendHostForProfileSyncTest : public SyncBackendHostImpl { 34 class SyncBackendHostForProfileSyncTest : public SyncBackendHostImpl {
35 public: 35 public:
36 SyncBackendHostForProfileSyncTest( 36 SyncBackendHostForProfileSyncTest(
37 const base::FilePath& temp_dir, 37 const base::FilePath& temp_dir,
38 syncer::SyncClient* sync_client, 38 syncer::SyncClient* sync_client,
39 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
40 invalidation::InvalidationService* invalidator, 39 invalidation::InvalidationService* invalidator,
41 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs, 40 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs,
42 const base::Closure& callback); 41 const base::Closure& callback);
43 ~SyncBackendHostForProfileSyncTest() override; 42 ~SyncBackendHostForProfileSyncTest() override;
44 43
45 void RequestConfigureSyncer( 44 void RequestConfigureSyncer(
46 syncer::ConfigureReason reason, 45 syncer::ConfigureReason reason,
47 syncer::ModelTypeSet to_download, 46 syncer::ModelTypeSet to_download,
48 syncer::ModelTypeSet to_purge, 47 syncer::ModelTypeSet to_purge,
49 syncer::ModelTypeSet to_journal, 48 syncer::ModelTypeSet to_journal,
(...skipping 12 matching lines...) Expand all
62 // Allows extra initialization work to be performed before the backend comes 61 // Allows extra initialization work to be performed before the backend comes
63 // up. 62 // up.
64 base::Closure callback_; 63 base::Closure callback_;
65 64
66 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostForProfileSyncTest); 65 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostForProfileSyncTest);
67 }; 66 };
68 67
69 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest( 68 SyncBackendHostForProfileSyncTest::SyncBackendHostForProfileSyncTest(
70 const base::FilePath& temp_dir, 69 const base::FilePath& temp_dir,
71 syncer::SyncClient* sync_client, 70 syncer::SyncClient* sync_client,
72 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
73 invalidation::InvalidationService* invalidator, 71 invalidation::InvalidationService* invalidator,
74 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs, 72 const base::WeakPtr<syncer::SyncPrefs>& sync_prefs,
75 const base::Closure& callback) 73 const base::Closure& callback)
76 : SyncBackendHostImpl( 74 : SyncBackendHostImpl(
77 "dummy_debug_name", 75 "dummy_debug_name",
78 sync_client, 76 sync_client,
79 ui_thread,
80 invalidator, 77 invalidator,
81 sync_prefs, 78 sync_prefs,
82 temp_dir.Append(base::FilePath(FILE_PATH_LITERAL("test")))), 79 temp_dir.Append(base::FilePath(FILE_PATH_LITERAL("test")))),
83 callback_(callback) {} 80 callback_(callback) {}
84 81
85 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {} 82 SyncBackendHostForProfileSyncTest::~SyncBackendHostForProfileSyncTest() {}
86 83
87 void SyncBackendHostForProfileSyncTest::InitCore( 84 void SyncBackendHostForProfileSyncTest::InitCore(
88 std::unique_ptr<syncer::DoInitializeOptions> options) { 85 std::unique_ptr<syncer::DoInitializeOptions> options) {
89 options->http_bridge_factory = base::MakeUnique<TestHttpBridgeFactory>(); 86 options->http_bridge_factory = base::MakeUnique<TestHttpBridgeFactory>();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 profile_sync_service_bundle_.CreateBasicInitParams( 187 profile_sync_service_bundle_.CreateBasicInitParams(
191 ProfileSyncService::AUTO_START, std::move(sync_client)); 188 ProfileSyncService::AUTO_START, std::move(sync_client));
192 sync_service_ = 189 sync_service_ =
193 base::MakeUnique<TestProfileSyncService>(std::move(init_params)); 190 base::MakeUnique<TestProfileSyncService>(std::move(init_params));
194 191
195 syncer::SyncApiComponentFactoryMock* components = 192 syncer::SyncApiComponentFactoryMock* components =
196 profile_sync_service_bundle_.component_factory(); 193 profile_sync_service_bundle_.component_factory();
197 EXPECT_CALL(*components, CreateSyncBackendHost(_, _, _, _)) 194 EXPECT_CALL(*components, CreateSyncBackendHost(_, _, _, _))
198 .WillOnce(Return(new SyncBackendHostForProfileSyncTest( 195 .WillOnce(Return(new SyncBackendHostForProfileSyncTest(
199 temp_dir_.GetPath(), sync_service_->GetSyncClient(), 196 temp_dir_.GetPath(), sync_service_->GetSyncClient(),
200 base::ThreadTaskRunnerHandle::Get(),
201 profile_sync_service_bundle_.fake_invalidation_service(), 197 profile_sync_service_bundle_.fake_invalidation_service(),
202 sync_service_->sync_prefs()->AsWeakPtr(), 198 sync_service_->sync_prefs()->AsWeakPtr(),
203 initialization_success_callback))); 199 initialization_success_callback)));
204 200
205 sync_service_->SetFirstSetupComplete(); 201 sync_service_->SetFirstSetupComplete();
206 } 202 }
207 203
208 base::Callback<syncer::SyncService*(void)> 204 base::Callback<syncer::SyncService*(void)>
209 AbstractProfileSyncServiceTest::GetSyncServiceCallback() { 205 AbstractProfileSyncServiceTest::GetSyncServiceCallback() {
210 return base::Bind(GetSyncService, 206 return base::Bind(GetSyncService,
(...skipping 17 matching lines...) Expand all
228 224
229 bool CreateRootHelper::success() { 225 bool CreateRootHelper::success() {
230 return success_; 226 return success_;
231 } 227 }
232 228
233 void CreateRootHelper::CreateRootCallback() { 229 void CreateRootHelper::CreateRootCallback() {
234 success_ = test_->CreateRoot(model_type_); 230 success_ = test_->CreateRoot(model_type_);
235 } 231 }
236 232
237 } // namespace browser_sync 233 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | components/browser_sync/profile_sync_components_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698