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

Unified Diff: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc

Issue 1054403002: Basic tests for new webview based signin flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-upload 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/ui/webui/chromeos/login/gaia_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index c4f654b5155dfa33f401abb938b767257ae7e564..f6ddc3a8809a247a793edba5ca49adb65412fbca 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -535,7 +535,7 @@ void GaiaScreenHandler::HandleGaiaUIReady() {
focus_stolen_ = false;
const char code[] =
"if (typeof gWindowOnLoad != 'undefined') gWindowOnLoad();";
- content::RenderFrameHost* frame = InlineLoginUI::GetAuthIframe(
+ content::RenderFrameHost* frame = InlineLoginUI::GetAuthFrame(
web_ui()->GetWebContents(),
GURL(kAuthIframeParentOrigin),
kAuthIframeParentName);
@@ -549,7 +549,7 @@ void GaiaScreenHandler::HandleGaiaUIReady() {
const char code[] =
"var gWindowOnLoad = window.onload; "
"window.onload=function() {};";
- content::RenderFrameHost* frame = InlineLoginUI::GetAuthIframe(
+ content::RenderFrameHost* frame = InlineLoginUI::GetAuthFrame(
web_ui()->GetWebContents(),
GURL(kAuthIframeParentOrigin),
kAuthIframeParentName);
@@ -687,16 +687,33 @@ void GaiaScreenHandler::ShowSigninScreenForCreds(const std::string& username,
void GaiaScreenHandler::SubmitLoginFormForTest() {
VLOG(2) << "Submit login form for test, user=" << test_user_;
- std::string code;
- code += "document.getElementById('Email').value = '" + test_user_ + "';";
- code += "document.getElementById('Passwd').value = '" + test_pass_ + "';";
- code += "document.getElementById('signIn').click();";
-
- content::RenderFrameHost* frame = InlineLoginUI::GetAuthIframe(
+ content::RenderFrameHost* frame = InlineLoginUI::GetAuthFrame(
web_ui()->GetWebContents(),
GURL(kAuthIframeParentOrigin),
kAuthIframeParentName);
- frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
+
+ if (!StartupUtils::IsWebviewSigninEnabled()) {
+ std::string code;
+ code += "document.getElementById('Email').value = '" + test_user_ + "';";
+ code += "document.getElementById('Passwd').value = '" + test_pass_ + "';";
+ code += "document.getElementById('signIn').click();";
+
+ frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
+ } else {
+ std::string code;
+
+ code =
+ "document.getElementById('identifier').value = '" + test_user_ + "';";
+ code += "document.getElementById('nextButton').click();";
+ frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
+
+ if (!test_pass_.empty()) {
+ code =
+ "document.getElementById('password').value = '" + test_pass_ + "';";
+ code += "document.getElementById('nextButton').click();";
+ frame->ExecuteJavaScript(base::ASCIIToUTF16(code));
+ }
+ }
// Test properties are cleared in HandleCompleteLogin because the form
// submission might fail and login will not be attempted after reloading

Powered by Google App Engine
This is Rietveld 408576698