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

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

Issue 1448983002: Actually mark list accounts as stale while they're being fetched. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
diff --git a/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc b/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
index 78b5c289d8102b27bae30cc05c315cc206ae88a7..e2fa05d877b15fd66fb05e9cc13b33b2f146b68a 100644
--- a/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
+++ b/components/signin/core/browser/gaia_cookie_manager_service_unittest.cc
@@ -556,6 +556,35 @@ TEST_F(GaiaCookieManagerServiceTest, ListAccountsFindsOneAccount) {
"[\"f\", [[\"b\", 0, \"n\", \"a@b.com\", \"p\", 0, 0, 0, 0, 1, \"8\"]]]");
}
+TEST_F(GaiaCookieManagerServiceTest, ListAccountsAfterOnCookieChanged) {
+ InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
+ MockObserver observer(&helper);
+
+ std::vector<gaia::ListedAccount> list_accounts;
+ std::vector<gaia::ListedAccount> empty_list_accounts;
+
+ EXPECT_CALL(helper, StartFetchingListAccounts());
+ EXPECT_CALL(observer,
+ OnGaiaAccountsInCookieUpdated(empty_list_accounts, no_error()));
+ ASSERT_FALSE(helper.ListAccounts(&list_accounts));
+ ASSERT_TRUE(list_accounts.empty());
+ SimulateListAccountsSuccess(&helper, "[\"f\",[]]");
+
+ // ListAccounts returns cached data.
+ ASSERT_TRUE(helper.ListAccounts(&list_accounts));
+ ASSERT_TRUE(list_accounts.empty());
+
+ EXPECT_CALL(helper, StartFetchingListAccounts());
+ EXPECT_CALL(observer,
+ OnGaiaAccountsInCookieUpdated(empty_list_accounts, no_error()));
+ helper.ForceOnCookieChangedProcessing();
+
+ // OnCookieChanged should invalidate cached data.
+ ASSERT_FALSE(helper.ListAccounts(&list_accounts));
+ ASSERT_TRUE(list_accounts.empty());
+ SimulateListAccountsSuccess(&helper, "[\"f\",[]]");
+}
+
TEST_F(GaiaCookieManagerServiceTest, ExternalCcResultFetcher) {
InstrumentedGaiaCookieManagerService helper(token_service(), signin_client());
GaiaCookieManagerService::ExternalCcResultFetcher result_fetcher(&helper);
« no previous file with comments | « components/signin/core/browser/gaia_cookie_manager_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698