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

Side by Side Diff: chrome/browser/signin/account_service_flag_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 roger's comments Created 5 years, 6 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 token_service_.UpdateCredentials(kDifferentAccountId, "refresh_token"); 188 token_service_.UpdateCredentials(kDifferentAccountId, "refresh_token");
189 189
190 // Credentials for a different user should be ignored, i.e. not result in a 190 // Credentials for a different user should be ignored, i.e. not result in a
191 // request for an access token. 191 // request for an access token.
192 EXPECT_EQ(0U, token_service_.GetPendingRequests().size()); 192 EXPECT_EQ(0U, token_service_.GetPendingRequests().size());
193 193
194 // After all refresh tokens have been loaded, there is still no token for our 194 // After all refresh tokens have been loaded, there is still no token for our
195 // user, so we expect a token error. 195 // user, so we expect a token error.
196 EXPECT_CALL(*this, OnFlagsFetched(AccountServiceFlagFetcher::TOKEN_ERROR, 196 EXPECT_CALL(*this, OnFlagsFetched(AccountServiceFlagFetcher::TOKEN_ERROR,
197 std::vector<std::string>())); 197 std::vector<std::string>()));
198 token_service_.IssueAllRefreshTokensLoaded(); 198 token_service_.LoadCredentials("");
199 } 199 }
200 200
201 TEST_F(AccountServiceFlagFetcherTest, GetTokenFailure) { 201 TEST_F(AccountServiceFlagFetcherTest, GetTokenFailure) {
202 token_service_.UpdateCredentials(kAccountId, "refresh_token"); 202 token_service_.UpdateCredentials(kAccountId, "refresh_token");
203 203
204 AccountServiceFlagFetcher fetcher( 204 AccountServiceFlagFetcher fetcher(
205 kAccountId, 205 kAccountId,
206 &token_service_, 206 &token_service_,
207 request_context_.get(), 207 request_context_.get(),
208 base::Bind(&AccountServiceFlagFetcherTest::OnFlagsFetched, 208 base::Bind(&AccountServiceFlagFetcherTest::OnFlagsFetched,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 token_service_.IssueAllTokensForAccount( 300 token_service_.IssueAllTokensForAccount(
301 kAccountId, 301 kAccountId,
302 "access_token", 302 "access_token",
303 base::Time::Now() + base::TimeDelta::FromHours(1)); 303 base::Time::Now() + base::TimeDelta::FromHours(1));
304 304
305 SendValidLoginResponse(); 305 SendValidLoginResponse();
306 // Do not send a GetUserInfo response, but make sure the request is there. 306 // Do not send a GetUserInfo response, but make sure the request is there.
307 GetGetUserInfoURLFetcher(); 307 GetGetUserInfoURLFetcher();
308 } 308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698