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

Unified Diff: chrome/browser/chromeos/login/signin/oauth2_browsertest.cc

Issue 2903123002: cros: Terminate if merge session fails for online sign-in (Closed)
Patch Set: add test Created 3 years, 7 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: chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
index 46b7816dd6c021a7dd670443cedc1b99cf859dc5..182a663c69028abdec7282f07390495131cf525b 100644
--- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
+++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
@@ -587,6 +587,34 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, DISABLED_OverlappingContinueSessionRestore) {
EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id));
}
+IN_PROC_BROWSER_TEST_F(OAuth2Test, TerminateOnBadMergeSessionAfterOnlineAuth) {
achuithb 2017/05/25 19:44:17 Let's add a comment and a link to the bug
xiyuan 2017/05/25 20:24:10 Done.
+ SimulateNetworkOnline();
+ WaitForGaiaPageLoad();
+
+ content::WindowedNotificationObserver termination_waiter(
+ chrome::NOTIFICATION_APP_TERMINATING,
+ content::NotificationService::AllSources());
+
+ // Configure FakeGaia so that online auth succeeds but merge session fails.
+ FakeGaia::MergeSessionParams params;
+ params.auth_sid_cookie = kTestAuthSIDCookie;
+ params.auth_lsid_cookie = kTestAuthLSIDCookie;
+ params.auth_code = kTestAuthCode;
+ params.refresh_token = kTestRefreshToken;
+ params.access_token = kTestAuthLoginAccessToken;
+ fake_gaia_->SetMergeSessionParams(params);
+
+ // Simulate an online sign-in.
+ GetLoginDisplay()->ShowSigninScreenForCreds(kTestEmail, kTestAccountPassword);
+
+ // User session should be terminated.
+ termination_waiter.Wait();
+
+ // Merge session should fail. Check after |termination_waiter| to ensure
+ // user profile is initialized and there is an OAuth2LoginManage.
+ WaitForMergeSessionCompletion(OAuth2LoginManager::SESSION_RESTORE_FAILED);
+}
+
const char kGooglePageContent[] =
"<html><title>Hello!</title><script>alert('hello');</script>"
"<body>Hello Google!</body></html>";

Powered by Google App Engine
This is Rietveld 408576698