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

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

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 8 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
9 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe tcher.h" 9 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe tcher.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 : error_(GoogleServiceAuthError::NONE), 128 : error_(GoogleServiceAuthError::NONE),
129 weak_ptr_factory_(this) {} 129 weak_ptr_factory_(this) {}
130 130
131 void SupervisedUserRefreshTokenFetcherTest::StartFetching() { 131 void SupervisedUserRefreshTokenFetcherTest::StartFetching() {
132 StartFetchingWithDeviceId(std::string()); 132 StartFetchingWithDeviceId(std::string());
133 } 133 }
134 134
135 void SupervisedUserRefreshTokenFetcherTest::StartFetchingWithDeviceId( 135 void SupervisedUserRefreshTokenFetcherTest::StartFetchingWithDeviceId(
136 const std::string& device_id) { 136 const std::string& device_id) {
137 device_id_ = device_id; 137 device_id_ = device_id;
138 oauth2_token_service_.IssueRefreshToken(kOAuth2RefreshToken); 138 oauth2_token_service_.UpdateCredentials("account_id", kOAuth2RefreshToken);
139 token_fetcher_ = SupervisedUserRefreshTokenFetcher::Create( 139 token_fetcher_ = SupervisedUserRefreshTokenFetcher::Create(
140 &oauth2_token_service_, 140 &oauth2_token_service_,
141 kAccountId, 141 kAccountId,
142 device_id_, 142 device_id_,
143 profile_.GetRequestContext()).Pass(); 143 profile_.GetRequestContext()).Pass();
144 token_fetcher_->Start( 144 token_fetcher_->Start(
145 kSupervisedUserId, 145 kSupervisedUserId,
146 kDeviceName, 146 kDeviceName,
147 base::Bind( 147 base::Bind(
148 &SupervisedUserRefreshTokenFetcherTest::OnTokenFetched, 148 &SupervisedUserRefreshTokenFetcherTest::OnTokenFetched,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 TEST_F(SupervisedUserRefreshTokenFetcherTest, CancelWhileFetchingRefreshToken) { 371 TEST_F(SupervisedUserRefreshTokenFetcherTest, CancelWhileFetchingRefreshToken) {
372 StartFetching(); 372 StartFetching();
373 MakeOAuth2TokenServiceRequestSucceed(); 373 MakeOAuth2TokenServiceRequestSucceed();
374 MakeIssueTokenRequestSucceed(); 374 MakeIssueTokenRequestSucceed();
375 Reset(); 375 Reset();
376 376
377 EXPECT_EQ(GoogleServiceAuthError::NONE, error().state()); 377 EXPECT_EQ(GoogleServiceAuthError::NONE, error().state());
378 EXPECT_EQ(std::string(), token()); 378 EXPECT_EQ(std::string(), token());
379 } 379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698