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

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

Issue 10408072: Rewrite of the EnrollEnterpriseDevice PyAuto automation hook for WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: std::string -> const std::string& and style fixes Created 8 years, 7 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/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 e67bf51e7dc113ee9fee888337788d9387e00678..403d8596569c41559a7d1908a28e1b09d6b57f78 100644
--- a/chrome/browser/automation/testing_automation_provider_chromeos.cc
+++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc
@@ -924,20 +924,13 @@ void TestingAutomationProvider::IsEnterpriseDevice(
reply.SendSuccess(return_value.get());
}
-void TestingAutomationProvider::EnrollEnterpriseDevice(
+void TestingAutomationProvider::ShowEnterpriseWizard(
DictionaryValue* args, IPC::Message* reply_message) {
- std::string user, password;
- if (!args->GetString("user", &user) ||
- !args->GetString("password", &password)) {
- AutomationJSONReply(this, reply_message)
- .SendError("Invalid or missing args.");
- return;
- }
+ AutomationJSONReply reply(this, reply_message);
chromeos::ExistingUserController* user_controller =
chromeos::ExistingUserController::current_controller();
if (!user_controller) {
- AutomationJSONReply(this, reply_message).SendError(
- "Unable to access ExistingUserController");
+ reply.SendError("Unable to access ExistingUserController");
return;
}
user_controller->login_display_host()->StartWizard(
@@ -946,6 +939,25 @@ void TestingAutomationProvider::EnrollEnterpriseDevice(
chromeos::WizardController* wizard_controller =
chromeos::WizardController::default_controller();
if (!wizard_controller) {
+ reply.SendError("Unable to access WizardController");
+ return;
+ }
+ chromeos::EnterpriseEnrollmentScreen* enroll_screen =
+ wizard_controller->GetEnterpriseEnrollmentScreen();
+ if (!enroll_screen) {
+ reply.SendError("Unable to access EnterpriseEnrollmentScreen");
+ return;
+ }
Mattias Nissler (ping if slow) 2012/05/25 13:17:22 The steps for getting the enrollment screen are no
craigdh 2012/05/25 23:24:47 Done.
+ enroll_screen->GetActor()->Show();
+ reply.SendSuccess(NULL);
+}
+
+void TestingAutomationProvider::AddEnrollmentObserver(
+ DictionaryValue* args, IPC::Message* reply_message) {
+ AutomationJSONReply reply(this, reply_message);
+ chromeos::WizardController* wizard_controller =
+ chromeos::WizardController::default_controller();
+ if (!wizard_controller) {
AutomationJSONReply(this, reply_message).SendError(
"Unable to access WizardController");
return;
@@ -957,10 +969,17 @@ void TestingAutomationProvider::EnrollEnterpriseDevice(
"Unable to access EnterpriseEnrollmentScreen");
return;
}
- // Set up an observer (it will delete itself).
- new EnrollmentObserver(this, reply_message, enroll_screen->GetActor(),
- enroll_screen);
- enroll_screen->GetActor()->SubmitTestCredentials(user, password);
+ if (!automation_event_queue_.get())
+ automation_event_queue_.reset(new AutomationEventQueue);
+
+ int observer_id = automation_event_queue_->AddObserver(
+ new EnrollmentEventObserver(automation_event_queue_.get(),
+ enroll_screen->GetActor()));
+
+ // Return the observer's id.
+ DictionaryValue return_value;
+ return_value.SetInteger("observer_id", observer_id);
+ reply.SendSuccess(&return_value);
}
void TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI(

Powered by Google App Engine
This is Rietveld 408576698