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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc

Issue 2251263003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/sync/one_click_signin_sync_starter.h" 5 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Number of times that the callback is called with SYNC_SETUP_FAILURE. 90 // Number of times that the callback is called with SYNC_SETUP_FAILURE.
91 int failed_count_; 91 int failed_count_;
92 92
93 // Number of times that the callback is called with SYNC_SETUP_SUCCESS. 93 // Number of times that the callback is called with SYNC_SETUP_SUCCESS.
94 int succeeded_count_; 94 int succeeded_count_;
95 95
96 private: 96 private:
97 static std::unique_ptr<KeyedService> BuildSigninManager( 97 static std::unique_ptr<KeyedService> BuildSigninManager(
98 content::BrowserContext* context) { 98 content::BrowserContext* context) {
99 Profile* profile = static_cast<Profile*>(context); 99 Profile* profile = static_cast<Profile*>(context);
100 return base::WrapUnique(new FakeSigninManager( 100 return base::MakeUnique<FakeSigninManager>(
101 ChromeSigninClientFactory::GetForProfile(profile), 101 ChromeSigninClientFactory::GetForProfile(profile),
102 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 102 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
103 AccountTrackerServiceFactory::GetForProfile(profile), 103 AccountTrackerServiceFactory::GetForProfile(profile),
104 GaiaCookieManagerServiceFactory::GetForProfile(profile))); 104 GaiaCookieManagerServiceFactory::GetForProfile(profile));
105 } 105 }
106 106
107 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarterTest); 107 DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarterTest);
108 }; 108 };
109 109
110 // Verifies that the callback is invoked when sync setup fails. 110 // Verifies that the callback is invoked when sync setup fails.
111 TEST_F(OneClickSigninSyncStarterTest, CallbackSigninFailed) { 111 TEST_F(OneClickSigninSyncStarterTest, CallbackSigninFailed) {
112 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, 112 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback,
113 base::Unretained(this)), 113 base::Unretained(this)),
114 GURL()); 114 GURL());
(...skipping 26 matching lines...) Expand all
141 141
142 const GURL kTestURL = GURL("http://www.example.com"); 142 const GURL kTestURL = GURL("http://www.example.com");
143 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback, 143 CreateSyncStarter(base::Bind(&OneClickSigninSyncStarterTest::Callback,
144 base::Unretained(this)), 144 base::Unretained(this)),
145 kTestURL); 145 kTestURL);
146 sync_starter_->AccountAddedToCookie( 146 sync_starter_->AccountAddedToCookie(
147 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); 147 GoogleServiceAuthError(GoogleServiceAuthError::NONE));
148 EXPECT_EQ(1, succeeded_count_); 148 EXPECT_EQ(1, succeeded_count_);
149 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL()); 149 EXPECT_EQ(kTestURL, controller.GetPendingEntry()->GetURL());
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698