Index: chrome/browser/signin/signin_tracker_unittest.cc |
diff --git a/chrome/browser/signin/signin_tracker_unittest.cc b/chrome/browser/signin/signin_tracker_unittest.cc |
index e982549ab226a720d435c09c6c97c433bbfb8bb6..76df9f731c96a93e151c521cd128658308dc41d7 100644 |
--- a/chrome/browser/signin/signin_tracker_unittest.cc |
+++ b/chrome/browser/signin/signin_tracker_unittest.cc |
@@ -9,6 +9,7 @@ |
#include "base/compiler_specific.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/signin/account_tracker_service_factory.h" |
#include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
#include "chrome/browser/signin/fake_signin_manager.h" |
@@ -18,6 +19,7 @@ |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/sync/profile_sync_service_mock.h" |
#include "chrome/test/base/testing_profile.h" |
+#include "components/signin/core/browser/account_tracker_service.h" |
#include "components/signin/core/browser/fake_auth_status_provider.h" |
#include "components/signin/core/browser/profile_oauth2_token_service.h" |
#include "components/signin/core/browser/signin_manager.h" |
@@ -69,11 +71,23 @@ class SigninTrackerTest : public testing::Test { |
tracker_ = |
SigninTrackerFactory::CreateForProfile(profile_.get(), &observer_); |
} |
+ |
void TearDown() override { |
tracker_.reset(); |
profile_.reset(); |
} |
+ // Seed the account tracker with information from logged in user. Normally |
+ // this is done by UI code before calling SigninManager. Returns the string |
+ // to use as the account_id. |
+ std::string AddToAccountTracker(const std::string& gaia_id, |
+ const std::string& email) { |
+ AccountTrackerService* service = |
+ AccountTrackerServiceFactory::GetForProfile(profile_.get()); |
+ service->SeedAccountInfo(gaia_id, email); |
Mike Lerman
2015/04/08 14:45:26
You can just return the result of SeedAccountInfo
Roger Tawa OOO till Jul 10th
2015/04/08 20:24:20
Removed function, not needed.
|
+ return service->PickAccountIdForAccount(gaia_id, email); |
+ } |
+ |
content::TestBrowserThreadBundle thread_bundle_; |
scoped_ptr<SigninTracker> tracker_; |
scoped_ptr<TestingProfile> profile_; |
@@ -99,7 +113,9 @@ TEST_F(SigninTrackerTest, SignInSucceeds) { |
EXPECT_CALL(observer_, SigninSuccess()); |
EXPECT_CALL(observer_, SigninFailed(_)).Times(0); |
- mock_signin_manager_->SetAuthenticatedUsername("user@gmail.com"); |
- fake_oauth2_token_service_->IssueRefreshTokenForUser( |
- "user@gmail.com", "refresh_token"); |
+ std::string account_id = AddToAccountTracker("gaia_id", "user@gmail.com"); |
+ mock_signin_manager_->SetAuthenticatedAccountInfo("gaia_id", |
+ "user@gmail.com"); |
+ fake_oauth2_token_service_->IssueRefreshTokenForUser(account_id, |
+ "refresh_token"); |
} |