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

Unified Diff: chrome/browser/automation/testing_automation_provider_chromeos.cc

Issue 10257015: Added a new automation hook ExecuteJavascriptInOOBEWebUI() to execute javascript prior to login on… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed hook and updated doc strings. Created 8 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
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/functional/chromeos_login.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/testing_automation_provider_chromeos.cc
diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc
index 8a6eaab7afc4d535241394c006faa07d2df54b2d..81d5be9c0880648c6e9935ddd6846a45ca3f84e7 100644
--- a/chrome/browser/automation/testing_automation_provider_chromeos.cc
+++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc
@@ -40,6 +40,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/dbus/update_engine_client.h"
+#include "content/public/browser/web_contents.h"
#include "net/base/network_change_notifier.h"
#include "policy/policy_constants.h"
#include "ui/views/widget/widget.h"
@@ -289,6 +290,11 @@ void TestingAutomationProvider::Login(DictionaryValue* args,
chromeos::ExistingUserController* controller =
chromeos::ExistingUserController::current_controller();
+ if (!controller) {
+ AutomationJSONReply(this, reply_message).SendError(
+ "Unable to access ExistingUserController");
+ return;
+ }
// Set up an observer (it will delete itself).
new LoginObserver(controller, this, reply_message);
@@ -954,6 +960,50 @@ void TestingAutomationProvider::EnrollEnterpriseDevice(
enroll_screen->GetActor()->SubmitTestCredentials(user, password);
}
+void TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI(
+ DictionaryValue* args, IPC::Message* reply_message) {
+ std::string javascript, frame_xpath;
+ if (!args->GetString("javascript", &javascript)) {
+ AutomationJSONReply(this, reply_message)
+ .SendError("'javascript' missing or invalid");
+ return;
+ }
+ if (!args->GetString("frame_xpath", &frame_xpath)) {
+ AutomationJSONReply(this, reply_message)
+ .SendError("'frame_xpath' missing or invalid");
+ return;
+ }
+ const UserManager* user_manager = UserManager::Get();
+ if (!user_manager) {
+ AutomationJSONReply(this, reply_message).SendError(
+ "No user manager!");
+ return;
+ }
+ if (user_manager->IsUserLoggedIn()) {
+ AutomationJSONReply(this, reply_message).SendError(
+ "User is already logged in.");
+ return;
+ }
+ chromeos::ExistingUserController* controller =
+ chromeos::ExistingUserController::current_controller();
+ if (!controller) {
+ AutomationJSONReply(this, reply_message).SendError(
+ "Unable to access ExistingUserController");
+ return;
+ }
+ chromeos::WebUILoginDisplayHost* webui_login_display_host =
+ static_cast<chromeos::WebUILoginDisplayHost*>(
+ controller->login_display_host());
+ content::WebContents* web_contents =
+ webui_login_display_host->GetOobeUI()->web_ui()->GetWebContents();
+
+ new DomOperationMessageSender(this, reply_message, true);
+ ExecuteJavascriptInRenderViewFrame(ASCIIToUTF16(frame_xpath),
+ ASCIIToUTF16(javascript),
+ reply_message,
+ web_contents->GetRenderViewHost());
+}
+
void TestingAutomationProvider::GetEnterprisePolicyInfo(
DictionaryValue* args, IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/functional/chromeos_login.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698