| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/test/oobe_base_test.h" | 5 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 11 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 13 #include "chrome/browser/chromeos/login/session/user_session_manager_test_api.h" | 13 #include "chrome/browser/chromeos/login/session/user_session_manager_test_api.h" |
| 14 #include "chrome/browser/chromeos/login/test/https_forwarder.h" | 14 #include "chrome/browser/chromeos/login/test/https_forwarder.h" |
| 15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 16 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 16 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 17 #include "chrome/browser/lifetime/application_lifetime.h" | 17 #include "chrome/browser/lifetime/application_lifetime.h" |
| 18 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 18 #include "chrome/browser/ui/webui/signin/get_auth_frame.h" |
| 19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 22 #include "chromeos/dbus/fake_shill_manager_client.h" | 22 #include "chromeos/dbus/fake_shill_manager_client.h" |
| 23 #include "components/policy/core/common/policy_switches.h" | 23 #include "components/policy/core/common/policy_switches.h" |
| 24 #include "components/user_manager/fake_user_manager.h" | 24 #include "components/user_manager/fake_user_manager.h" |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 WizardController* wizard_controller = WizardController::default_controller(); | 240 WizardController* wizard_controller = WizardController::default_controller(); |
| 241 if (wizard_controller) | 241 if (wizard_controller) |
| 242 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 242 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 243 | 243 |
| 244 WizardController::SkipPostLoginScreensForTesting(); | 244 WizardController::SkipPostLoginScreensForTesting(); |
| 245 | 245 |
| 246 login_screen_load_observer_->Wait(); | 246 login_screen_load_observer_->Wait(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void OobeBaseTest::ExecuteJsInSigninFrame(const std::string& js) { | 249 void OobeBaseTest::ExecuteJsInSigninFrame(const std::string& js) { |
| 250 content::RenderFrameHost* frame = InlineLoginUI::GetAuthFrame( | 250 content::RenderFrameHost* frame = |
| 251 GetLoginUI()->GetWebContents(), GURL(), gaia_frame_parent_); | 251 signin::GetAuthFrame(GetLoginUI()->GetWebContents(), gaia_frame_parent_); |
| 252 ASSERT_TRUE(content::ExecuteScript(frame, js)); | 252 ASSERT_TRUE(content::ExecuteScript(frame, js)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void OobeBaseTest::SetSignFormField(const std::string& field_id, | 255 void OobeBaseTest::SetSignFormField(const std::string& field_id, |
| 256 const std::string& field_value) { | 256 const std::string& field_value) { |
| 257 std::string js = | 257 std::string js = |
| 258 "(function(){" | 258 "(function(){" |
| 259 "document.getElementById('$FieldId').value = '$FieldValue';" | 259 "document.getElementById('$FieldId').value = '$FieldValue';" |
| 260 "var e = new Event('input');" | 260 "var e = new Event('input');" |
| 261 "document.getElementById('$FieldId').dispatchEvent(e);" | 261 "document.getElementById('$FieldId').dispatchEvent(e);" |
| 262 "})();"; | 262 "})();"; |
| 263 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); | 263 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); |
| 264 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); | 264 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); |
| 265 ExecuteJsInSigninFrame(js); | 265 ExecuteJsInSigninFrame(js); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace chromeos | 268 } // namespace chromeos |
| OLD | NEW |