OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 chromeos::ExistingUserController::current_controller(); | 252 chromeos::ExistingUserController::current_controller(); |
253 // Return immediately, since we're going to die before the login is finished. | 253 // Return immediately, since we're going to die before the login is finished. |
254 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 254 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
255 controller->CreateAccount(); | 255 controller->CreateAccount(); |
256 } | 256 } |
257 | 257 |
258 // Logging in as guest will cause session_manager to restart Chrome with new | 258 // Logging in as guest will cause session_manager to restart Chrome with new |
259 // flags. If you used EnableChromeTesting, you will have to call it again. | 259 // flags. If you used EnableChromeTesting, you will have to call it again. |
260 void TestingAutomationProvider::LoginAsGuest(DictionaryValue* args, | 260 void TestingAutomationProvider::LoginAsGuest(DictionaryValue* args, |
261 IPC::Message* reply_message) { | 261 IPC::Message* reply_message) { |
| 262 LOG(ERROR) << "TestingAutomationProvider::LoginAsGuest"; |
| 263 |
262 chromeos::ExistingUserController* controller = | 264 chromeos::ExistingUserController* controller = |
263 chromeos::ExistingUserController::current_controller(); | 265 chromeos::ExistingUserController::current_controller(); |
264 // Return immediately, since we're going to die before the login is finished. | 266 // Return immediately, since we're going to die before the login is finished. |
265 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 267 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
266 controller->LoginAsGuest(); | 268 controller->LoginAsGuest(); |
267 } | 269 } |
268 | 270 |
269 void TestingAutomationProvider::Login(DictionaryValue* args, | 271 void TestingAutomationProvider::Login(DictionaryValue* args, |
270 IPC::Message* reply_message) { | 272 IPC::Message* reply_message) { |
| 273 LOG(ERROR) << "TestingAutomationProvider::Login"; |
| 274 |
271 std::string username, password; | 275 std::string username, password; |
272 if (!args->GetString("username", &username) || | 276 if (!args->GetString("username", &username) || |
273 !args->GetString("password", &password)) { | 277 !args->GetString("password", &password)) { |
274 AutomationJSONReply(this, reply_message).SendError( | 278 AutomationJSONReply(this, reply_message).SendError( |
275 "Invalid or missing args."); | 279 "Invalid or missing args."); |
276 return; | 280 return; |
277 } | 281 } |
278 | 282 |
279 chromeos::ExistingUserController* controller = | 283 chromeos::ExistingUserController* controller = |
280 chromeos::ExistingUserController::current_controller(); | 284 chromeos::ExistingUserController::current_controller(); |
281 | 285 |
282 // Set up an observer (it will delete itself). | 286 // Set up an observer (it will delete itself). |
283 new LoginObserver(controller, this, reply_message); | 287 new LoginObserver(controller, this, reply_message); |
284 | 288 |
285 // WebUI login. | 289 // WebUI login. |
286 chromeos::WebUILoginDisplay* webui_login_display = | 290 chromeos::WebUILoginDisplay* webui_login_display = |
287 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); | 291 static_cast<chromeos::WebUILoginDisplay*>(controller->login_display()); |
| 292 LOG(ERROR) << "TestingAutomationProvider::Login ShowSigninScreenForCreds(" |
| 293 << username << ", " << password << ")"; |
| 294 |
288 webui_login_display->ShowSigninScreenForCreds(username, password); | 295 webui_login_display->ShowSigninScreenForCreds(username, password); |
289 } | 296 } |
290 | 297 |
291 void TestingAutomationProvider::LockScreen(DictionaryValue* args, | 298 void TestingAutomationProvider::LockScreen(DictionaryValue* args, |
292 IPC::Message* reply_message) { | 299 IPC::Message* reply_message) { |
293 new ScreenLockUnlockObserver(this, reply_message, true); | 300 new ScreenLockUnlockObserver(this, reply_message, true); |
294 DBusThreadManager::Get()->GetPowerManagerClient()-> | 301 DBusThreadManager::Get()->GetPowerManagerClient()-> |
295 NotifyScreenLockRequested(); | 302 NotifyScreenLockRequested(); |
296 } | 303 } |
297 | 304 |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1190 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1184 AddObserver(power_manager_observer_); | 1191 AddObserver(power_manager_observer_); |
1185 } | 1192 } |
1186 | 1193 |
1187 void TestingAutomationProvider::RemoveChromeosObservers() { | 1194 void TestingAutomationProvider::RemoveChromeosObservers() { |
1188 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 1195 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
1189 RemoveObserver(power_manager_observer_); | 1196 RemoveObserver(power_manager_observer_); |
1190 delete power_manager_observer_; | 1197 delete power_manager_observer_; |
1191 power_manager_observer_ = NULL; | 1198 power_manager_observer_ = NULL; |
1192 } | 1199 } |
OLD | NEW |