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

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

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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
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/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
10 #include "components/browser_sync/profile_sync_test_util.h" 11 #include "components/browser_sync/profile_sync_test_util.h"
11 #include "components/prefs/pref_service.h" 12 #include "components/prefs/pref_service.h"
12 #include "components/signin/core/browser/account_tracker_service.h" 13 #include "components/signin/core/browser/account_tracker_service.h"
13 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" 14 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
14 #include "components/signin/core/browser/profile_oauth2_token_service.h" 15 #include "components/signin/core/browser/profile_oauth2_token_service.h"
15 #include "components/signin/core/browser/signin_manager.h" 16 #include "components/signin/core/browser/signin_manager.h"
16 #include "components/signin/core/common/signin_pref_names.h" 17 #include "components/signin/core/common/signin_pref_names.h"
17 #include "components/sync/base/pref_names.h" 18 #include "components/sync/base/pref_names.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 84 }
84 85
85 void CreateSyncService(ProfileSyncService::StartBehavior start_behavior) { 86 void CreateSyncService(ProfileSyncService::StartBehavior start_behavior) {
86 component_factory_ = profile_sync_service_bundle_.component_factory(); 87 component_factory_ = profile_sync_service_bundle_.component_factory();
87 ProfileSyncServiceBundle::SyncClientBuilder builder( 88 ProfileSyncServiceBundle::SyncClientBuilder builder(
88 &profile_sync_service_bundle_); 89 &profile_sync_service_bundle_);
89 ProfileSyncService::InitParams init_params = 90 ProfileSyncService::InitParams init_params =
90 profile_sync_service_bundle_.CreateBasicInitParams(start_behavior, 91 profile_sync_service_bundle_.CreateBasicInitParams(start_behavior,
91 builder.Build()); 92 builder.Build());
92 93
93 sync_service_.reset(new ProfileSyncService(std::move(init_params))); 94 sync_service_ =
95 base::MakeUnique<ProfileSyncService>(std::move(init_params));
94 sync_service_->RegisterDataTypeController( 96 sync_service_->RegisterDataTypeController(
95 base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS)); 97 base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS));
96 sync_service_->AddObserver(&observer_); 98 sync_service_->AddObserver(&observer_);
97 } 99 }
98 100
99 void IssueTestTokens(const std::string& account_id) { 101 void IssueTestTokens(const std::string& account_id) {
100 profile_sync_service_bundle_.auth_service()->UpdateCredentials( 102 profile_sync_service_bundle_.auth_service()->UpdateCredentials(
101 account_id, "oauth2_login_token"); 103 account_id, "oauth2_login_token");
102 } 104 }
103 105
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 467 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
466 sync_service_->Initialize(); 468 sync_service_->Initialize();
467 469
468 auto sync_blocker = sync_service_->GetSetupInProgressHandle(); 470 auto sync_blocker = sync_service_->GetSetupInProgressHandle();
469 IssueTestTokens(account_id); 471 IssueTestTokens(account_id);
470 sync_blocker.reset(); 472 sync_blocker.reset();
471 EXPECT_FALSE(sync_service_->IsSyncActive()); 473 EXPECT_FALSE(sync_service_->IsSyncActive());
472 } 474 }
473 475
474 } // namespace browser_sync 476 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698