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

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

Issue 1079083002: [cros New-GAIA] Webview login and new GAIA endpoint enabled by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 years, 8 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 48bdb7b6edf34d9362615f1210ab0c57eafce2cd..f8d5a9621704bff86a40ee0f243ec1d467b2d0bc 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,10 @@ class OAuth2LoginManagerStateWaiter : public OAuth2LoginManager::Observer {
} // namespace
-class OAuth2Test : public OobeBaseTest {
+class OAuth2Test : public OobeBaseTest,
+ public testing::WithParamInterface<bool> {
protected:
- OAuth2Test() {}
+ OAuth2Test() { use_webview_ = GetParam(); }
void SetUpCommandLine(base::CommandLine* command_line) override {
OobeBaseTest::SetUpCommandLine(command_line);
@@ -327,23 +329,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 +410,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 +420,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 +430,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 +444,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 +460,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 +530,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 +692,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 +735,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 +789,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

Powered by Google App Engine
This is Rietveld 408576698