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

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

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
6 6
7 #include "ash/system/chromeos/devicetype_utils.h" 7 #include "ash/system/chromeos/devicetype_utils.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 web_ui()->GetWebContents(), 758 web_ui()->GetWebContents(),
759 GURL(kAuthIframeParentOrigin), 759 GURL(kAuthIframeParentOrigin),
760 kAuthIframeParentName); 760 kAuthIframeParentName);
761 761
762 if (!StartupUtils::IsWebviewSigninEnabled()) { 762 if (!StartupUtils::IsWebviewSigninEnabled()) {
763 std::string code; 763 std::string code;
764 code += "document.getElementById('Email').value = '" + test_user_ + "';"; 764 code += "document.getElementById('Email').value = '" + test_user_ + "';";
765 code += "document.getElementById('Passwd').value = '" + test_pass_ + "';"; 765 code += "document.getElementById('Passwd').value = '" + test_pass_ + "';";
766 code += "document.getElementById('signIn').click();"; 766 code += "document.getElementById('signIn').click();";
767 767
768 frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); 768 frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code));
769 } else { 769 } else {
770 std::string code; 770 std::string code;
771 771
772 code = 772 code =
773 "document.getElementById('identifier').value = '" + test_user_ + "';"; 773 "document.getElementById('identifier').value = '" + test_user_ + "';";
774 code += "document.getElementById('nextButton').click();"; 774 code += "document.getElementById('nextButton').click();";
775 frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); 775 frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code));
776 776
777 if (!test_pass_.empty()) { 777 if (!test_pass_.empty()) {
778 code = 778 code =
779 "document.getElementById('password').value = '" + test_pass_ + "';"; 779 "document.getElementById('password').value = '" + test_pass_ + "';";
780 code += "document.getElementById('nextButton').click();"; 780 code += "document.getElementById('nextButton').click();";
781 frame->ExecuteJavaScript(base::ASCIIToUTF16(code)); 781 frame->ExecuteJavaScriptForTests(base::ASCIIToUTF16(code));
782 } 782 }
783 } 783 }
784 784
785 // Test properties are cleared in HandleCompleteLogin because the form 785 // Test properties are cleared in HandleCompleteLogin because the form
786 // submission might fail and login will not be attempted after reloading 786 // submission might fail and login will not be attempted after reloading
787 // if they are cleared here. 787 // if they are cleared here.
788 } 788 }
789 789
790 void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool api_used) { 790 void GaiaScreenHandler::SetSAMLPrincipalsAPIUsed(bool api_used) {
791 using_saml_api_ = api_used; 791 using_saml_api_ = api_used;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { 950 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() {
951 DCHECK(signin_screen_handler_); 951 DCHECK(signin_screen_handler_);
952 return signin_screen_handler_->delegate_; 952 return signin_screen_handler_->delegate_;
953 } 953 }
954 954
955 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { 955 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) {
956 signin_screen_handler_ = handler; 956 signin_screen_handler_ = handler;
957 } 957 }
958 958
959 } // namespace chromeos 959 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698