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 48bdb7b6edf34d9362615f1210ab0c57eafce2cd..c09e3a70b71426fc78acd3605469fac080caa1c7 100644 |
--- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc |
+++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc |
@@ -13,6 +13,7 @@ |
#include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
#include "chrome/browser/chromeos/login/signin/oauth2_login_manager_factory.h" |
#include "chrome/browser/chromeos/login/signin_specifics.h" |
+#include "chrome/browser/chromeos/login/startup_utils.h" |
#include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
#include "chrome/browser/chromeos/login/wizard_controller.h" |
#include "chrome/browser/profiles/profile_manager.h" |
@@ -130,9 +131,12 @@ class OAuth2LoginManagerStateWaiter : public OAuth2LoginManager::Observer { |
} // namespace |
-class OAuth2Test : public OobeBaseTest { |
+// Boolean parameter is used to run this test for webview (true) and for |
+// iframe (false) GAIA sign in. |
+class OAuth2Test : public OobeBaseTest, |
+ public testing::WithParamInterface<bool> { |
protected: |
- OAuth2Test() {} |
+ OAuth2Test() { set_use_webview(GetParam()); } |
void SetUpCommandLine(base::CommandLine* command_line) override { |
OobeBaseTest::SetUpCommandLine(command_line); |
@@ -327,23 +331,17 @@ class OAuth2Test : public OobeBaseTest { |
void StartNewUserSession(bool wait_for_merge) { |
SetupGaiaServerForNewAccount(); |
SimulateNetworkOnline(); |
- chromeos::WizardController::SkipPostLoginScreensForTesting(); |
- chromeos::WizardController* wizard_controller = |
- chromeos::WizardController::default_controller(); |
- wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
+ WaitForGaiaPageLoad(); |
- content::WindowedNotificationObserver( |
- chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
- content::NotificationService::AllSources()).Wait(); |
+ content::WindowedNotificationObserver session_start_waiter( |
+ chrome::NOTIFICATION_SESSION_STARTED, |
+ content::NotificationService::AllSources()); |
// Use capitalized and dotted user name on purpose to make sure |
// our email normalization kicks in. |
GetLoginDisplay()->ShowSigninScreenForCreds(kTestRawAccountId, |
kTestAccountPassword); |
- |
- content::WindowedNotificationObserver( |
- chrome::NOTIFICATION_SESSION_STARTED, |
- content::NotificationService::AllSources()).Wait(); |
+ session_start_waiter.Wait(); |
if (wait_for_merge) { |
// Wait for the session merge to finish. |
@@ -414,7 +412,7 @@ class CookieReader : public base::RefCountedThreadSafe<CookieReader> { |
}; |
// PRE_MergeSession is testing merge session for a new profile. |
-IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_PRE_MergeSession) { |
+IN_PROC_BROWSER_TEST_P(OAuth2Test, PRE_PRE_PRE_MergeSession) { |
StartNewUserSession(true); |
// Check for existance of refresh token. |
ProfileOAuth2TokenService* token_service = |
@@ -424,7 +422,6 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_PRE_MergeSession) { |
EXPECT_EQ(GetOAuthStatusFromLocalState(kTestAccountId), |
user_manager::User::OAUTH2_TOKEN_STATUS_VALID); |
- |
scoped_refptr<CookieReader> cookie_reader(new CookieReader()); |
cookie_reader->ReadCookies(profile()); |
EXPECT_EQ(cookie_reader->GetCookieValue("SID"), kTestSessionSIDCookie); |
@@ -435,7 +432,7 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_PRE_MergeSession) { |
// that was generated in PRE_PRE_PRE_MergeSession test. In this test, we |
// are not running /MergeSession process since the /ListAccounts call confirms |
// that the session is not stale. |
-IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_MergeSession) { |
+IN_PROC_BROWSER_TEST_P(OAuth2Test, PRE_PRE_MergeSession) { |
SetupGaiaServerForUnexpiredAccount(); |
SimulateNetworkOnline(); |
LoginAsExistingUser(); |
@@ -449,7 +446,7 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_PRE_MergeSession) { |
// MergeSession test is running merge session process for an existing profile |
// that was generated in PRE_PRE_MergeSession test. |
-IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_MergeSession) { |
+IN_PROC_BROWSER_TEST_P(OAuth2Test, PRE_MergeSession) { |
SetupGaiaServerForExpiredAccount(); |
SimulateNetworkOnline(); |
LoginAsExistingUser(); |
@@ -465,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(OAuth2Test, PRE_MergeSession) { |
// MergeSession test is attempting to merge session for an existing profile |
// that was generated in PRE_PRE_MergeSession test. This attempt should fail |
// since FakeGaia instance isn't configured to return relevant tokens/cookies. |
-IN_PROC_BROWSER_TEST_F(OAuth2Test, MergeSession) { |
+IN_PROC_BROWSER_TEST_P(OAuth2Test, MergeSession) { |
SimulateNetworkOnline(); |
content::WindowedNotificationObserver( |
@@ -535,9 +532,7 @@ class FakeGoogle { |
} |
// True if we have already served the test page. |
- bool IsPageRequested () { |
- return start_event_.IsSignaled(); |
- } |
+ bool IsPageRequested() { return start_event_.IsSignaled(); } |
// Waits until we receive a request to serve the test page. |
void WaitForPageRequest() { |
@@ -699,7 +694,7 @@ Browser* FindOrCreateVisibleBrowser(Profile* profile) { |
return browser; |
} |
-IN_PROC_BROWSER_TEST_F(MergeSessionTest, PageThrottle) { |
+IN_PROC_BROWSER_TEST_P(MergeSessionTest, PageThrottle) { |
StartNewUserSession(false); |
// Try to open a page from google.com. |
@@ -742,7 +737,7 @@ IN_PROC_BROWSER_TEST_F(MergeSessionTest, PageThrottle) { |
DVLOG(1) << "Loaded page at the end : " << title; |
} |
-IN_PROC_BROWSER_TEST_F(MergeSessionTest, XHRThrottle) { |
+IN_PROC_BROWSER_TEST_P(MergeSessionTest, XHRThrottle) { |
StartNewUserSession(false); |
// Wait until we get send merge session request. |
@@ -796,4 +791,7 @@ IN_PROC_BROWSER_TEST_F(MergeSessionTest, XHRThrottle) { |
EXPECT_TRUE(fake_google_.IsPageRequested()); |
} |
+INSTANTIATE_TEST_CASE_P(OAuth2Suite, OAuth2Test, testing::Bool()); |
+INSTANTIATE_TEST_CASE_P(MergeSessionSuite, MergeSessionTest, testing::Bool()); |
+ |
} // namespace chromeos |