| 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/chromeos/login/gaia_screen_handler.h" |
| 18 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 19 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" |
| 19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 21 #include "chromeos/chromeos_switches.h" | 22 #include "chromeos/chromeos_switches.h" |
| 22 #include "chromeos/dbus/fake_shill_manager_client.h" | 23 #include "chromeos/dbus/fake_shill_manager_client.h" |
| 23 #include "components/policy/core/common/policy_switches.h" | 24 #include "components/policy/core/common/policy_switches.h" |
| 24 #include "components/user_manager/fake_user_manager.h" | 25 #include "components/user_manager/fake_user_manager.h" |
| 25 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| 27 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 FakeShillManagerClient::kFakeEthernetNetworkGuid, | 189 FakeShillManagerClient::kFakeEthernetNetworkGuid, |
| 189 portal_state); | 190 portal_state); |
| 190 network_portal_detector_->NotifyObserversForTesting(); | 191 network_portal_detector_->NotifyObserversForTesting(); |
| 191 } | 192 } |
| 192 | 193 |
| 193 base::Closure OobeBaseTest::SimulateNetworkPortalClosure() { | 194 base::Closure OobeBaseTest::SimulateNetworkPortalClosure() { |
| 194 return base::Bind(&OobeBaseTest::SimulateNetworkPortal, | 195 return base::Bind(&OobeBaseTest::SimulateNetworkPortal, |
| 195 base::Unretained(this)); | 196 base::Unretained(this)); |
| 196 } | 197 } |
| 197 | 198 |
| 199 void OobeBaseTest::DisableRestrictiveProxyCheck() { |
| 200 static_cast<chromeos::LoginDisplayHostImpl*>( |
| 201 chromeos::LoginDisplayHostImpl::default_host()) |
| 202 ->GetOobeUI() |
| 203 ->GetGaiaScreenActor() |
| 204 ->DisableRestrictiveProxyCheck(); |
| 205 } |
| 206 |
| 198 void OobeBaseTest::JsExpect(const std::string& expression) { | 207 void OobeBaseTest::JsExpect(const std::string& expression) { |
| 199 JS().ExpectTrue(expression); | 208 JS().ExpectTrue(expression); |
| 200 } | 209 } |
| 201 | 210 |
| 202 content::WebUI* OobeBaseTest::GetLoginUI() { | 211 content::WebUI* OobeBaseTest::GetLoginUI() { |
| 203 return static_cast<chromeos::LoginDisplayHostImpl*>( | 212 return static_cast<chromeos::LoginDisplayHostImpl*>( |
| 204 chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()->web_ui(); | 213 chromeos::LoginDisplayHostImpl::default_host())->GetOobeUI()->web_ui(); |
| 205 } | 214 } |
| 206 | 215 |
| 207 WebUILoginDisplay* OobeBaseTest::GetLoginDisplay() { | 216 WebUILoginDisplay* OobeBaseTest::GetLoginDisplay() { |
| 208 ExistingUserController* controller = | 217 ExistingUserController* controller = |
| 209 ExistingUserController::current_controller(); | 218 ExistingUserController::current_controller(); |
| 210 CHECK(controller); | 219 CHECK(controller); |
| 211 return static_cast<WebUILoginDisplay*>( | 220 return static_cast<WebUILoginDisplay*>( |
| 212 controller->login_display()); | 221 controller->login_display()); |
| 213 } | 222 } |
| 214 | 223 |
| 215 void OobeBaseTest::WaitForGaiaPageLoad() { | 224 void OobeBaseTest::WaitForGaiaPageLoad() { |
| 216 WaitForSigninScreen(); | 225 WaitForSigninScreen(); |
| 226 WaitForGaiaPageReload(); |
| 227 } |
| 217 | 228 |
| 229 void OobeBaseTest::WaitForGaiaPageReload() { |
| 218 JS().Evaluate( | 230 JS().Evaluate( |
| 219 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready'," | 231 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready'," |
| 220 "function() {" | 232 "function() {" |
| 221 "window.domAutomationController.setAutomationId(0);" | 233 "window.domAutomationController.setAutomationId(0);" |
| 222 "window.domAutomationController.send('GaiaReady');" | 234 "window.domAutomationController.send('GaiaReady');" |
| 223 "});"); | 235 "});"); |
| 224 | 236 |
| 225 content::DOMMessageQueue message_queue; | 237 content::DOMMessageQueue message_queue; |
| 226 std::string message; | 238 std::string message; |
| 227 do { | 239 do { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 252 "document.getElementById('$FieldId').value = '$FieldValue';" | 264 "document.getElementById('$FieldId').value = '$FieldValue';" |
| 253 "var e = new Event('input');" | 265 "var e = new Event('input');" |
| 254 "document.getElementById('$FieldId').dispatchEvent(e);" | 266 "document.getElementById('$FieldId').dispatchEvent(e);" |
| 255 "})();"; | 267 "})();"; |
| 256 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); | 268 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); |
| 257 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); | 269 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); |
| 258 ExecuteJsInSigninFrame(js); | 270 ExecuteJsInSigninFrame(js); |
| 259 } | 271 } |
| 260 | 272 |
| 261 } // namespace chromeos | 273 } // namespace chromeos |
| OLD | NEW |