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 <string> | 5 #include <string> |
6 | 6 |
7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 LoginTest() : LoginManagerTest(true) {} | 105 LoginTest() : LoginManagerTest(true) {} |
106 ~LoginTest() override {} | 106 ~LoginTest() override {} |
107 | 107 |
108 void StartGaiaAuthOffline() { | 108 void StartGaiaAuthOffline() { |
109 content::DOMMessageQueue message_queue; | 109 content::DOMMessageQueue message_queue; |
110 const std::string js = "(function() {" | 110 const std::string js = "(function() {" |
111 "var authenticator = $('gaia-signin').gaiaAuthHost_;" | 111 "var authenticator = $('gaia-signin').gaiaAuthHost_;" |
112 "authenticator.addEventListener('ready'," | 112 "authenticator.addEventListener('ready'," |
113 "function f() {" | 113 "function f() {" |
114 "authenticator.removeEventListener('ready', f);" | 114 "authenticator.removeEventListener('ready', f);" |
115 "window.domAutomationController.setAutomationId(0);" | |
116 "window.domAutomationController.send('offlineLoaded');" | 115 "window.domAutomationController.send('offlineLoaded');" |
117 "});" | 116 "});" |
118 "$('error-offline-login-link').onclick();" | 117 "$('error-offline-login-link').onclick();" |
119 "})();"; | 118 "})();"; |
120 ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); | 119 ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); |
121 | 120 |
122 std::string message; | 121 std::string message; |
123 do { | 122 do { |
124 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 123 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
125 } while (message != "\"offlineLoaded\""); | 124 } while (message != "\"offlineLoaded\""); |
(...skipping 16 matching lines...) Expand all Loading... |
142 "document.querySelector('#offline-gaia /deep/ #passwordSection" | 141 "document.querySelector('#offline-gaia /deep/ #passwordSection" |
143 " /deep/ #button')"; | 142 " /deep/ #button')"; |
144 | 143 |
145 content::DOMMessageQueue message_queue; | 144 content::DOMMessageQueue message_queue; |
146 JSExpect("!document.querySelector('#offline-gaia').hidden"); | 145 JSExpect("!document.querySelector('#offline-gaia').hidden"); |
147 JSExpect("document.querySelector('#signin-frame').hidden"); | 146 JSExpect("document.querySelector('#signin-frame').hidden"); |
148 const std::string js = | 147 const std::string js = |
149 animated_pages + | 148 animated_pages + |
150 ".addEventListener('neon-animation-finish'," | 149 ".addEventListener('neon-animation-finish'," |
151 "function() {" | 150 "function() {" |
152 "window.domAutomationController.setAutomationId(0);" | |
153 "window.domAutomationController.send('switchToPassword');" | 151 "window.domAutomationController.send('switchToPassword');" |
154 "})"; | 152 "})"; |
155 ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); | 153 ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); |
156 std::string set_email = email_input + ".value = '$Email'"; | 154 std::string set_email = email_input + ".value = '$Email'"; |
157 base::ReplaceSubstringsAfterOffset(&set_email, 0, "$Email", user_email); | 155 base::ReplaceSubstringsAfterOffset(&set_email, 0, "$Email", user_email); |
158 ASSERT_TRUE(content::ExecuteScript(web_contents(), set_email)); | 156 ASSERT_TRUE(content::ExecuteScript(web_contents(), set_email)); |
159 ASSERT_TRUE(content::ExecuteScript(web_contents(), | 157 ASSERT_TRUE(content::ExecuteScript(web_contents(), |
160 email_next_button + ".fire('tap')")); | 158 email_next_button + ".fire('tap')")); |
161 std::string message; | 159 std::string message; |
162 do { | 160 do { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 js_checker().ExecuteAsync(JSElement(kAdPasswordInput) + ".value='" + | 280 js_checker().ExecuteAsync(JSElement(kAdPasswordInput) + ".value='" + |
283 password + "'"); | 281 password + "'"); |
284 js_checker().Evaluate(JSElement(kAdButton) + ".fire('tap')"); | 282 js_checker().Evaluate(JSElement(kAdButton) + ".fire('tap')"); |
285 } | 283 } |
286 | 284 |
287 void SetupActiveDirectoryJSNotifications() { | 285 void SetupActiveDirectoryJSNotifications() { |
288 js_checker().Evaluate( | 286 js_checker().Evaluate( |
289 "var testInvalidateAd = login.GaiaSigninScreen.invalidateAd;" | 287 "var testInvalidateAd = login.GaiaSigninScreen.invalidateAd;" |
290 "login.GaiaSigninScreen.invalidateAd = function(user, errorState) {" | 288 "login.GaiaSigninScreen.invalidateAd = function(user, errorState) {" |
291 " testInvalidateAd(user, errorState);" | 289 " testInvalidateAd(user, errorState);" |
292 " window.domAutomationController.setAutomationId(0);" | |
293 " window.domAutomationController.send('ShowAuthError');" | 290 " window.domAutomationController.send('ShowAuthError');" |
294 "}"); | 291 "}"); |
295 } | 292 } |
296 | 293 |
297 void WaitForMessage(content::DOMMessageQueue* message_queue, | 294 void WaitForMessage(content::DOMMessageQueue* message_queue, |
298 const std::string& expected_message) { | 295 const std::string& expected_message) { |
299 std::string message; | 296 std::string message; |
300 do { | 297 do { |
301 ASSERT_TRUE(message_queue->WaitForMessage(&message)); | 298 ASSERT_TRUE(message_queue->WaitForMessage(&message)); |
302 } while (message != expected_message); | 299 } while (message != expected_message); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 TestDomainVisible(); | 477 TestDomainVisible(); |
481 | 478 |
482 fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_BAD_PASSWORD); | 479 fake_auth_policy_client()->set_auth_error(authpolicy::ERROR_BAD_PASSWORD); |
483 SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); | 480 SubmitActiveDirectoryCredentials(kTestActiveDirectoryUser, kPassword); |
484 WaitForMessage(&message_queue, "\"ShowAuthError\""); | 481 WaitForMessage(&message_queue, "\"ShowAuthError\""); |
485 TestPasswordError(); | 482 TestPasswordError(); |
486 TestDomainVisible(); | 483 TestDomainVisible(); |
487 } | 484 } |
488 | 485 |
489 } // namespace chromeos | 486 } // namespace chromeos |
OLD | NEW |