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

Unified Diff: chrome/browser/chromeos/login/oobe_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: fix saml test 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/oobe_browsertest.cc
diff --git a/chrome/browser/chromeos/login/oobe_browsertest.cc b/chrome/browser/chromeos/login/oobe_browsertest.cc
index da7e59675c29d921398277e7fc693866f518c852..2f13bd1750b19f317f419f5162cb5c453c66f803 100644
--- a/chrome/browser/chromeos/login/oobe_browsertest.cc
+++ b/chrome/browser/chromeos/login/oobe_browsertest.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
+#include "chrome/browser/chromeos/login/test/oobe_base_test.h"
#include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/ui/webui_login_display.h"
@@ -14,8 +15,8 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/chromeos_switches.h"
+#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
-#include "google_apis/gaia/fake_gaia.h"
#include "google_apis/gaia/gaia_switches.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_response.h"
@@ -27,28 +28,17 @@ using namespace net::test_server;
namespace chromeos {
-class OobeTest : public InProcessBrowserTest {
+// Boolean parameter is used to run this test for webview (true) and for
+// iframe (false) GAIA sign in.
+class OobeTest : public OobeBaseTest, public testing::WithParamInterface<bool> {
public:
- OobeTest() {}
+ OobeTest() { set_use_webview(GetParam()); }
~OobeTest() override {}
void SetUpCommandLine(base::CommandLine* command_line) override {
- command_line->AppendSwitch(chromeos::switches::kLoginManager);
- command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
- command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
- command_line->AppendSwitchASCII(
- ::switches::kAuthExtensionPath, "gaia_auth");
- fake_gaia_.Initialize();
- }
-
- void SetUpOnMainThread() override {
- CHECK(embedded_test_server()->InitializeAndWaitUntilReady());
- embedded_test_server()->RegisterRequestHandler(
- base::Bind(&FakeGaia::HandleRequest, base::Unretained(&fake_gaia_)));
- LOG(INFO) << "Set up http server at " << embedded_test_server()->base_url();
+ command_line->AppendSwitch(switches::kOobeSkipPostLogin);
- base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- ::switches::kGaiaUrl, embedded_test_server()->base_url().spec());
+ OobeBaseTest::SetUpCommandLine(command_line);
}
void TearDownOnMainThread() override {
@@ -58,6 +48,8 @@ class OobeTest : public InProcessBrowserTest {
base::Bind(&chrome::AttemptExit));
content::RunMessageLoop();
}
+
+ OobeBaseTest::TearDownOnMainThread();
}
chromeos::WebUILoginDisplay* GetLoginDisplay() {
@@ -75,40 +67,24 @@ class OobeTest : public InProcessBrowserTest {
}
private:
- FakeGaia fake_gaia_;
DISALLOW_COPY_AND_ASSIGN(OobeTest);
};
-IN_PROC_BROWSER_TEST_F(OobeTest, NewUser) {
- chromeos::WizardController::SkipPostLoginScreensForTesting();
- chromeos::WizardController* wizard_controller =
- chromeos::WizardController::default_controller();
- CHECK(wizard_controller);
- wizard_controller->SkipToLoginForTesting(LoginScreenContext());
+IN_PROC_BROWSER_TEST_P(OobeTest, NewUser) {
+ 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());
- // TODO(glotov): mock GAIA server (test_server()) should support
- // username/password configuration.
- GetLoginDisplay()->ShowSigninScreenForCreds("username", "password");
+ GetLoginDisplay()->ShowSigninScreenForCreds(OobeBaseTest::kFakeUserEmail,
+ OobeBaseTest::kFakeUserPassword);
- content::WindowedNotificationObserver(
- chrome::NOTIFICATION_SESSION_STARTED,
- content::NotificationService::AllSources()).Wait();
+ session_start_waiter.Wait();
}
-IN_PROC_BROWSER_TEST_F(OobeTest, Accelerator) {
- chromeos::WizardController::SkipPostLoginScreensForTesting();
- chromeos::WizardController* wizard_controller =
- chromeos::WizardController::default_controller();
- CHECK(wizard_controller);
- wizard_controller->SkipToLoginForTesting(LoginScreenContext());
-
- content::WindowedNotificationObserver(
- chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
- content::NotificationService::AllSources()).Wait();
+IN_PROC_BROWSER_TEST_P(OobeTest, Accelerator) {
+ WaitForGaiaPageLoad();
gfx::NativeWindow login_window = GetLoginWindowWidget()->GetNativeWindow();
@@ -121,4 +97,6 @@ IN_PROC_BROWSER_TEST_F(OobeTest, Accelerator) {
OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_ENROLLMENT).Wait();
}
+INSTANTIATE_TEST_CASE_P(OobeSuite, OobeTest, testing::Bool());
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/login_manager_test.cc ('k') | chrome/browser/chromeos/login/proxy_auth_dialog_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698