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

Side by Side Diff: chrome/browser/managed_mode/managed_user_refresh_token_fetcher_unittest.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 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 "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/managed_mode/managed_user_refresh_token_fetcher.h" 8 #include "chrome/browser/managed_mode/managed_user_refresh_token_fetcher.h"
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher_; 116 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher_;
117 117
118 GoogleServiceAuthError error_; 118 GoogleServiceAuthError error_;
119 std::string token_; 119 std::string token_;
120 base::WeakPtrFactory<ManagedUserRefreshTokenFetcherTest> weak_ptr_factory_; 120 base::WeakPtrFactory<ManagedUserRefreshTokenFetcherTest> weak_ptr_factory_;
121 }; 121 };
122 122
123 ManagedUserRefreshTokenFetcherTest::ManagedUserRefreshTokenFetcherTest() 123 ManagedUserRefreshTokenFetcherTest::ManagedUserRefreshTokenFetcherTest()
124 : token_fetcher_( 124 : token_fetcher_(
125 ManagedUserRefreshTokenFetcher::Create(&oauth2_token_service_, 125 ManagedUserRefreshTokenFetcher::Create(&oauth2_token_service_,
126 profile_.GetRequestContext())), 126 std::string(),
127 profile_.GetRequestContext())),
127 error_(GoogleServiceAuthError::NONE), 128 error_(GoogleServiceAuthError::NONE),
128 weak_ptr_factory_(this) {} 129 weak_ptr_factory_(this) {}
129 130
130 void ManagedUserRefreshTokenFetcherTest::StartFetching() { 131 void ManagedUserRefreshTokenFetcherTest::StartFetching() {
131 oauth2_token_service_.IssueRefreshToken(kOAuth2RefreshToken); 132 oauth2_token_service_.IssueRefreshToken(kOAuth2RefreshToken);
132 token_fetcher_->Start(kManagedUserId, kDeviceName, 133 token_fetcher_->Start(kManagedUserId, kDeviceName,
133 base::Bind( 134 base::Bind(
134 &ManagedUserRefreshTokenFetcherTest::OnTokenFetched, 135 &ManagedUserRefreshTokenFetcherTest::OnTokenFetched,
135 weak_ptr_factory_.GetWeakPtr())); 136 weak_ptr_factory_.GetWeakPtr()));
136 } 137 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 343
343 TEST_F(ManagedUserRefreshTokenFetcherTest, CancelWhileFetchingRefreshToken) { 344 TEST_F(ManagedUserRefreshTokenFetcherTest, CancelWhileFetchingRefreshToken) {
344 StartFetching(); 345 StartFetching();
345 MakeOAuth2TokenServiceRequestSucceed(); 346 MakeOAuth2TokenServiceRequestSucceed();
346 MakeIssueTokenRequestSucceed(); 347 MakeIssueTokenRequestSucceed();
347 Reset(); 348 Reset();
348 349
349 EXPECT_EQ(GoogleServiceAuthError::NONE, error().state()); 350 EXPECT_EQ(GoogleServiceAuthError::NONE, error().state());
350 EXPECT_EQ(std::string(), token()); 351 EXPECT_EQ(std::string(), token());
351 } 352 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698