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

Unified Diff: chrome/browser/chromeos/login/test/oobe_base_test.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/test/oobe_base_test.cc
diff --git a/chrome/browser/chromeos/login/test/oobe_base_test.cc b/chrome/browser/chromeos/login/test/oobe_base_test.cc
index 5dcc6357bdb58546b105858b9f247df534ddb924..2323e4857e80d9e7afeec6c7fbc95848217ec09d 100644
--- a/chrome/browser/chromeos/login/test/oobe_base_test.cc
+++ b/chrome/browser/chromeos/login/test/oobe_base_test.cc
@@ -20,6 +20,7 @@
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/dbus/fake_shill_manager_client.h"
+#include "components/policy/core/common/policy_switches.h"
#include "components/user_manager/fake_user_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -50,6 +51,8 @@ void OobeBaseTest::SetUp() {
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
+ RegisterAdditionalRequestHandlers();
+
embedded_test_server()->RegisterRequestHandler(
base::Bind(&FakeGaia::HandleRequest, base::Unretained(fake_gaia_.get())));
@@ -67,25 +70,19 @@ void OobeBaseTest::SetUp() {
}
bool OobeBaseTest::SetUpUserDataDirectory() {
- if (use_webview_) {
- // Fake Dev channel to enable webview signin.
- scoped_channel_.reset(
- new extensions::ScopedCurrentChannel(chrome::VersionInfo::CHANNEL_DEV));
-
- base::FilePath user_data_dir;
- CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
- base::FilePath local_state_path =
- user_data_dir.Append(chrome::kLocalStateFilename);
+ base::FilePath user_data_dir;
+ CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
+ base::FilePath local_state_path =
+ user_data_dir.Append(chrome::kLocalStateFilename);
- // Set webview enabled flag only when local state file does not exist.
+ if (!use_webview_) {
+ // Set webview disabled flag only when local state file does not exist.
// Otherwise, we break PRE tests that leave state in it.
if (!base::PathExists(local_state_path)) {
base::DictionaryValue local_state_dict;
- local_state_dict.SetBoolean(prefs::kWebviewSigninEnabled, true);
- // OobeCompleted to skip controller-pairing-screen which still uses
- // iframe and ends up in a JS error in oobe page init.
- // See http://crbug.com/467147
- local_state_dict.SetBoolean(prefs::kOobeComplete, true);
+
+ // TODO(nkostylev): Fix tests that fail with webview signin.
+ local_state_dict.SetBoolean(prefs::kWebviewSigninDisabled, true);
CHECK(JSONFileValueSerializer(local_state_path)
.Serialize(local_state_dict));
@@ -123,6 +120,7 @@ void OobeBaseTest::TearDownOnMainThread() {
base::Bind(&chrome::AttemptExit));
content::RunMessageLoop();
}
+ EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
ExtensionApiTest::TearDownOnMainThread();
}
@@ -136,11 +134,14 @@ void OobeBaseTest::SetUpCommandLine(base::CommandLine* command_line) {
command_line->AppendSwitch(::switches::kDisableBackgroundNetworking);
command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
- GURL gaia_url = gaia_https_forwarder_->GetURL("");
+ GURL gaia_url = gaia_https_forwarder_->GetURL(std::string());
command_line->AppendSwitchASCII(::switches::kGaiaUrl, gaia_url.spec());
command_line->AppendSwitchASCII(::switches::kLsoUrl, gaia_url.spec());
command_line->AppendSwitchASCII(::switches::kGoogleApisUrl,
gaia_url.spec());
+ command_line->AppendSwitchASCII(
+ policy::switches::kDeviceManagementUrl,
+ embedded_test_server()->GetURL("/device_management").spec());
fake_gaia_->Initialize();
fake_gaia_->set_issue_oauth_code_cookie(use_webview_);
@@ -152,6 +153,9 @@ void OobeBaseTest::InitHttpsForwarders() {
ASSERT_TRUE(gaia_https_forwarder_->Start());
}
+void OobeBaseTest::RegisterAdditionalRequestHandlers() {
+}
+
void OobeBaseTest::SimulateNetworkOffline() {
NetworkPortalDetector::CaptivePortalState offline_state;
offline_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE;
@@ -217,11 +221,31 @@ WebUILoginDisplay* OobeBaseTest::GetLoginDisplay() {
controller->login_display());
}
+void OobeBaseTest::WaitForGaiaPageLoad() {
+ WaitForSigninScreen();
+
+ if (!use_webview_)
+ return;
+
+ ASSERT_TRUE(content::ExecuteScript(
+ GetLoginUI()->GetWebContents(),
+ "$('gaia-signin').gaiaAuthHost_.addEventListener('ready',"
+ "function() {"
+ "window.domAutomationController.setAutomationId(0);"
+ "window.domAutomationController.send('GaiaReady');"
+ "});"));
+
+ content::DOMMessageQueue message_queue;
+ std::string message;
+ ASSERT_TRUE(message_queue.WaitForMessage(&message));
dzhioev (left Google) 2015/04/15 17:36:25 Please check message's value in loop, until you re
Nikita (slow) 2015/04/15 18:35:42 Done.
+ EXPECT_EQ("\"GaiaReady\"", message);
+}
+
void OobeBaseTest::WaitForSigninScreen() {
WizardController* wizard_controller = WizardController::default_controller();
- if (wizard_controller) {
+ if (wizard_controller)
wizard_controller->SkipToLoginForTesting(LoginScreenContext());
- }
+
WizardController::SkipPostLoginScreensForTesting();
login_screen_load_observer_->Wait();

Powered by Google App Engine
This is Rietveld 408576698