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

Unified Diff: components/signin/core/browser/account_tracker_service_unittest.cc

Issue 473153002: Inline sign in extracts gaia id from HTTP header and seeds account tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/signin/core/browser/account_tracker_service_unittest.cc
diff --git a/components/signin/core/browser/account_tracker_service_unittest.cc b/components/signin/core/browser/account_tracker_service_unittest.cc
index 64b83b0dcebcac5437623511826a349fc5709c0d..7a4d3277ca0aa5593dd5817e9f867883b866c312 100644
--- a/components/signin/core/browser/account_tracker_service_unittest.cc
+++ b/components/signin/core/browser/account_tracker_service_unittest.cc
@@ -10,6 +10,7 @@
#include "base/prefs/testing_pref_service.h"
#include "base/strings/stringprintf.h"
#include "components/signin/core/browser/account_tracker_service.h"
+#include "components/signin/core/common/signin_pref_names.h"
#include "google_apis/gaia/fake_oauth2_token_service.h"
#include "google_apis/gaia/gaia_oauth_client.h"
#include "net/http/http_status_code.h"
@@ -198,6 +199,9 @@ class AccountTrackerServiceTest : public testing::Test {
pref_service_.registry()->RegisterListPref(
AccountTrackerService::kAccountInfoPref);
+ pref_service_.registry()->RegisterIntegerPref(
+ prefs::kAccountIdMigrationState,
+ AccountTrackerService::MIGRATION_NOT_STARTED);
account_tracker_.reset(new AccountTrackerService());
account_tracker_->Initialize(fake_oauth2_token_service_.get(),
@@ -505,3 +509,21 @@ TEST_F(AccountTrackerServiceTest, Persistence) {
tracker.Shutdown();
}
}
+
+TEST_F(AccountTrackerServiceTest, SeedAccountInfo) {
+ std::vector<AccountTrackerService::AccountInfo> infos =
+ account_tracker()->GetAccounts();
+ EXPECT_EQ(0u, infos.size());
+
+ const std::string gaia_id = AccountIdToGaiaId("alpha");
+ const std::string email = AccountIdToEmail("alpha");
+ const std::string account_id =
+ account_tracker()->PickAccountIdForAccount(gaia_id, email);
+ account_tracker()->SeedAccountInfo(gaia_id, email);
+
+ infos = account_tracker()->GetAccounts();
+ EXPECT_EQ(1u, infos.size());
+ EXPECT_EQ(account_id, infos[0].account_id);
+ EXPECT_EQ(gaia_id, infos[0].gaia);
+ EXPECT_EQ(email, infos[0].email);
+}

Powered by Google App Engine
This is Rietveld 408576698