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

Side by Side Diff: chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fetcher_unittest.cc

Issue 1878143002: Convert //chrome/browser/supervised_user from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 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 "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe tcher.h"
6
7 #include <memory>
8
5 #include "base/bind.h" 9 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe tcher.h"
9 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
10 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" 12 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
11 #include "content/public/test/test_browser_thread_bundle.h" 13 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "google_apis/gaia/gaia_constants.h" 14 #include "google_apis/gaia/gaia_constants.h"
13 #include "google_apis/gaia/gaia_oauth_client.h" 15 #include "google_apis/gaia/gaia_oauth_client.h"
14 #include "google_apis/gaia/gaia_urls.h" 16 #include "google_apis/gaia/gaia_urls.h"
15 #include "google_apis/gaia/google_service_auth_error.h" 17 #include "google_apis/gaia/google_service_auth_error.h"
16 #include "google_apis/gaia/oauth2_token_service.h" 18 #include "google_apis/gaia/oauth2_token_service.h"
17 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
18 #include "net/base/url_util.h" 20 #include "net/base/url_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 const std::string& token() const { return token_; } 111 const std::string& token() const { return token_; }
110 112
111 private: 113 private:
112 void OnTokenFetched(const GoogleServiceAuthError& error, 114 void OnTokenFetched(const GoogleServiceAuthError& error,
113 const std::string& token); 115 const std::string& token);
114 116
115 content::TestBrowserThreadBundle thread_bundle_; 117 content::TestBrowserThreadBundle thread_bundle_;
116 TestingProfile profile_; 118 TestingProfile profile_;
117 FakeProfileOAuth2TokenService oauth2_token_service_; 119 FakeProfileOAuth2TokenService oauth2_token_service_;
118 net::TestURLFetcherFactory url_fetcher_factory_; 120 net::TestURLFetcherFactory url_fetcher_factory_;
119 scoped_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher_; 121 std::unique_ptr<SupervisedUserRefreshTokenFetcher> token_fetcher_;
120 std::string device_id_; 122 std::string device_id_;
121 123
122 GoogleServiceAuthError error_; 124 GoogleServiceAuthError error_;
123 std::string token_; 125 std::string token_;
124 base::WeakPtrFactory<SupervisedUserRefreshTokenFetcherTest> weak_ptr_factory_; 126 base::WeakPtrFactory<SupervisedUserRefreshTokenFetcherTest> weak_ptr_factory_;
125 }; 127 };
126 128
127 SupervisedUserRefreshTokenFetcherTest::SupervisedUserRefreshTokenFetcherTest() 129 SupervisedUserRefreshTokenFetcherTest::SupervisedUserRefreshTokenFetcherTest()
128 : error_(GoogleServiceAuthError::NONE), 130 : error_(GoogleServiceAuthError::NONE),
129 weak_ptr_factory_(this) {} 131 weak_ptr_factory_(this) {}
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 370
369 TEST_F(SupervisedUserRefreshTokenFetcherTest, CancelWhileFetchingRefreshToken) { 371 TEST_F(SupervisedUserRefreshTokenFetcherTest, CancelWhileFetchingRefreshToken) {
370 StartFetching(); 372 StartFetching();
371 MakeOAuth2TokenServiceRequestSucceed(); 373 MakeOAuth2TokenServiceRequestSucceed();
372 MakeIssueTokenRequestSucceed(); 374 MakeIssueTokenRequestSucceed();
373 Reset(); 375 Reset();
374 376
375 EXPECT_EQ(GoogleServiceAuthError::NONE, error().state()); 377 EXPECT_EQ(GoogleServiceAuthError::NONE, error().state());
376 EXPECT_EQ(std::string(), token()); 378 EXPECT_EQ(std::string(), token());
377 } 379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698