Chromium Code Reviews| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 return static_cast<WebUILoginDisplay*>( | 221 return static_cast<WebUILoginDisplay*>( |
| 222 controller->login_display()); | 222 controller->login_display()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void OobeBaseTest::WaitForGaiaPageLoad() { | 225 void OobeBaseTest::WaitForGaiaPageLoad() { |
| 226 WaitForSigninScreen(); | 226 WaitForSigninScreen(); |
| 227 WaitForGaiaPageReload(); | 227 WaitForGaiaPageReload(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void OobeBaseTest::WaitForGaiaPageReload() { | 230 void OobeBaseTest::WaitForGaiaPageReload() { |
| 231 JS() | 231 content::DOMMessageQueue message_queue; |
|
achuithb
2017/02/02 00:37:11
A comment might be useful in case someone decides
xiyuan
2017/02/02 18:43:59
Done.
| |
| 232 .Evaluate( | |
| 233 "$('gaia-signin').gaiaAuthHost_.addEventListener('ready'," | |
| 234 "function f() {" | |
| 235 "$(\'gaia-signin\').gaiaAuthHost_.removeEventListener(\'ready\', f);" | |
| 236 "window.domAutomationController.setAutomationId(0);" | |
| 237 "window.domAutomationController.send('GaiaReady');" | |
| 238 "});"); | |
| 239 | 232 |
| 240 content::DOMMessageQueue message_queue; | 233 JS().Evaluate( |
| 234 "(function() {" | |
| 235 " var authenticator = $('gaia-signin').gaiaAuthHost_;" | |
| 236 " var f = function() {" | |
|
achuithb
2017/02/02 00:37:11
This doesn't make a functional difference, right?
xiyuan
2017/02/02 18:43:59
No functional change in PS4. PS3 was too aggressiv
| |
| 237 " authenticator.removeEventListener('ready', f);" | |
| 238 " window.domAutomationController.setAutomationId(0);" | |
| 239 " window.domAutomationController.send('GaiaReady');" | |
| 240 " };" | |
| 241 " authenticator.addEventListener('ready', f);" | |
| 242 "})();"); | |
| 243 | |
| 241 std::string message; | 244 std::string message; |
| 242 do { | 245 do { |
| 243 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 246 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 244 } while (message != "\"GaiaReady\""); | 247 } while (message != "\"GaiaReady\""); |
| 245 } | 248 } |
| 246 | 249 |
| 247 void OobeBaseTest::WaitForSigninScreen() { | 250 void OobeBaseTest::WaitForSigninScreen() { |
| 248 WizardController* wizard_controller = WizardController::default_controller(); | 251 WizardController* wizard_controller = WizardController::default_controller(); |
| 249 if (wizard_controller) | 252 if (wizard_controller) |
| 250 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 253 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 267 "document.getElementById('$FieldId').value = '$FieldValue';" | 270 "document.getElementById('$FieldId').value = '$FieldValue';" |
| 268 "var e = new Event('input');" | 271 "var e = new Event('input');" |
| 269 "document.getElementById('$FieldId').dispatchEvent(e);" | 272 "document.getElementById('$FieldId').dispatchEvent(e);" |
| 270 "})();"; | 273 "})();"; |
| 271 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); | 274 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldId", field_id); |
| 272 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); | 275 base::ReplaceSubstringsAfterOffset(&js, 0, "$FieldValue", field_value); |
| 273 ExecuteJsInSigninFrame(js); | 276 ExecuteJsInSigninFrame(js); |
| 274 } | 277 } |
| 275 | 278 |
| 276 } // namespace chromeos | 279 } // namespace chromeos |
| OLD | NEW |