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 ->DisableRestrictiveProxyCheckForTest(); | |
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 |
218 JS().Evaluate( | 229 void OobeBaseTest::WaitForGaiaPageReload() { |
219 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready'," | 230 JS() |
jdufault
2015/10/09 19:15:40
Can these be on the same line?
achuithb
2015/10/13 19:20:22
git cl format likes it this way and I don't want t
| |
220 "function() {" | 231 .Evaluate( |
221 "window.domAutomationController.setAutomationId(0);" | 232 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready'," |
222 "window.domAutomationController.send('GaiaReady');" | 233 "function f() {" |
223 "});"); | 234 "$(\'gaia-signin\').gaiaAuthHost_.removeEventListener(\'ready\', f);" |
235 "window.domAutomationController.setAutomationId(0);" | |
236 "window.domAutomationController.send('GaiaReady');" | |
237 "});"); | |
224 | 238 |
225 content::DOMMessageQueue message_queue; | 239 content::DOMMessageQueue message_queue; |
226 std::string message; | 240 std::string message; |
227 do { | 241 do { |
228 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 242 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
229 } while (message != "\"GaiaReady\""); | 243 } while (message != "\"GaiaReady\""); |
230 } | 244 } |
231 | 245 |
232 void OobeBaseTest::WaitForSigninScreen() { | 246 void OobeBaseTest::WaitForSigninScreen() { |
233 WizardController* wizard_controller = WizardController::default_controller(); | 247 WizardController* wizard_controller = WizardController::default_controller(); |
(...skipping 18 matching lines...) Expand all Loading... | |
252 "document.getElementById('$FieldId').value = '$FieldValue';" | 266 "document.getElementById('$FieldId').value = '$FieldValue';" |
253 "var e = new Event('input');" | 267 "var e = new Event('input');" |
254 "document.getElementById('$FieldId').dispatchEvent(e);" | 268 "document.getElementById('$FieldId').dispatchEvent(e);" |
255 "})();"; | 269 "})();"; |
256 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); | 270 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); |
257 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); | 271 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); |
258 ExecuteJsInSigninFrame(js); | 272 ExecuteJsInSigninFrame(js); |
259 } | 273 } |
260 | 274 |
261 } // namespace chromeos | 275 } // namespace chromeos |
OLD | NEW |