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

Side by Side Diff: components/signin/core/browser/account_tracker_service_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: works for all platforms commit e75a498951318d4deb65d40ce8b2def44cd5abc0 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 account_tracker_->EnableNetworkFetches(); 267 account_tracker_->EnableNetworkFetches();
268 account_tracker_->AddObserver(&observer_); 268 account_tracker_->AddObserver(&observer_);
269 } 269 }
270 270
271 void TearDown() override { 271 void TearDown() override {
272 account_tracker_->RemoveObserver(&observer_); 272 account_tracker_->RemoveObserver(&observer_);
273 account_tracker_->Shutdown(); 273 account_tracker_->Shutdown();
274 } 274 }
275 275
276 void SimulateTokenAvailable(const std::string& account_id) { 276 void SimulateTokenAvailable(const std::string& account_id) {
277 fake_oauth2_token_service_->AddAccount(account_id); 277 fake_oauth2_token_service_->GetDelegate()->UpdateCredentials(
278 account_id, "refresh_token");
278 } 279 }
279 280
280 void SimulateTokenRevoked(const std::string& account_id) { 281 void SimulateTokenRevoked(const std::string& account_id) {
281 fake_oauth2_token_service_->RemoveAccount(account_id); 282 fake_oauth2_token_service_->GetDelegate()->RevokeCredentials(account_id);
282 } 283 }
283 284
284 // Helpers to fake access token and user info fetching 285 // Helpers to fake access token and user info fetching
285 void IssueAccessToken(const std::string& account_id) { 286 void IssueAccessToken(const std::string& account_id) {
286 fake_oauth2_token_service_->IssueAllTokensForAccount( 287 fake_oauth2_token_service_->IssueAllTokensForAccount(
287 account_id, "access_token-" + account_id, base::Time::Max()); 288 account_id, "access_token-" + account_id, base::Time::Max());
288 } 289 }
289 290
290 std::string GenerateValidTokenInfoResponse(const std::string& account_id) { 291 std::string GenerateValidTokenInfoResponse(const std::string& account_id) {
291 return base::StringPrintf( 292 return base::StringPrintf(
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 tracker.Initialize(token_service(), signin_client()); 780 tracker.Initialize(token_service(), signin_client());
780 781
781 ASSERT_TRUE(tracker.IsAllUserInfoFetched()); 782 ASSERT_TRUE(tracker.IsAllUserInfoFetched());
782 std::vector<AccountTrackerService::AccountInfo> infos = 783 std::vector<AccountTrackerService::AccountInfo> infos =
783 tracker.GetAccounts(); 784 tracker.GetAccounts();
784 ASSERT_EQ(1u, infos.size()); 785 ASSERT_EQ(1u, infos.size());
785 ASSERT_STREQ("foobar@gmail.com", infos[0].account_id.c_str()); 786 ASSERT_STREQ("foobar@gmail.com", infos[0].account_id.c_str());
786 tracker.Shutdown(); 787 tracker.Shutdown();
787 } 788 }
788 } 789 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698