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

Side by Side Diff: google_apis/gaia/account_tracker_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 "google_apis/gaia/account_tracker.h" 5 #include "google_apis/gaia/account_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 // Helpers to pass fake events to the tracker. 295 // Helpers to pass fake events to the tracker.
296 296
297 void NotifyLogin(const std::string account_key) { 297 void NotifyLogin(const std::string account_key) {
298 identity_provider()->LogIn(account_key); 298 identity_provider()->LogIn(account_key);
299 } 299 }
300 300
301 void NotifyLogout() { identity_provider()->LogOut(); } 301 void NotifyLogout() { identity_provider()->LogOut(); }
302 302
303 void NotifyTokenAvailable(const std::string& username) { 303 void NotifyTokenAvailable(const std::string& username) {
304 fake_oauth2_token_service_->AddAccount(username); 304 fake_oauth2_token_service_->GetDelegate()->UpdateCredentials(
305 username, "refresh_token");
305 } 306 }
306 307
307 void NotifyTokenRevoked(const std::string& username) { 308 void NotifyTokenRevoked(const std::string& username) {
308 fake_oauth2_token_service_->RemoveAccount(username); 309 fake_oauth2_token_service_->GetDelegate()->RevokeCredentials(username);
309 } 310 }
310 311
311 // Helpers to fake access token and user info fetching 312 // Helpers to fake access token and user info fetching
312 void IssueAccessToken(const std::string& username) { 313 void IssueAccessToken(const std::string& username) {
313 fake_oauth2_token_service_->IssueAllTokensForAccount( 314 fake_oauth2_token_service_->IssueAllTokensForAccount(
314 username, "access_token-" + username, base::Time::Max()); 315 username, "access_token-" + username, base::Time::Max());
315 } 316 }
316 317
317 std::string GetValidTokenInfoResponse(const std::string account_key) { 318 std::string GetValidTokenInfoResponse(const std::string account_key) {
318 return std::string("{ \"id\": \"") + AccountKeyToObfuscatedId(account_key) + 319 return std::string("{ \"id\": \"") + AccountKeyToObfuscatedId(account_key) +
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 EXPECT_TRUE(ids.email.empty()); 807 EXPECT_TRUE(ids.email.empty());
807 EXPECT_TRUE(ids.gaia.empty()); 808 EXPECT_TRUE(ids.gaia.empty());
808 809
809 ids = account_tracker()->FindAccountIdsByGaiaId("alpha@example.com"); 810 ids = account_tracker()->FindAccountIdsByGaiaId("alpha@example.com");
810 EXPECT_TRUE(ids.account_key.empty()); 811 EXPECT_TRUE(ids.account_key.empty());
811 EXPECT_TRUE(ids.email.empty()); 812 EXPECT_TRUE(ids.email.empty());
812 EXPECT_TRUE(ids.gaia.empty()); 813 EXPECT_TRUE(ids.gaia.empty());
813 } 814 }
814 815
815 } // namespace gaia 816 } // namespace gaia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698