| 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/chromeos/login/login_manager_test.h" | 9 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 10 #include "chrome/browser/chromeos/login/login_wizard.h" | 10 #include "chrome/browser/chromeos/login/login_wizard.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ASSERT_TRUE(frame); | 106 ASSERT_TRUE(frame); |
| 107 ASSERT_TRUE(content::ExecuteScript(frame, js)); | 107 ASSERT_TRUE(content::ExecuteScript(frame, js)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void StartGaiaAuthOffline() { | 110 void StartGaiaAuthOffline() { |
| 111 content::DOMMessageQueue message_queue; | 111 content::DOMMessageQueue message_queue; |
| 112 const std::string js = "(function() {" | 112 const std::string js = "(function() {" |
| 113 "var frame = $('signin-frame');" | 113 "var frame = $('signin-frame');" |
| 114 "var onload= function() {" | 114 "var onload= function() {" |
| 115 "frame.removeEventListener('load', onload);" | 115 "frame.removeEventListener('load', onload);" |
| 116 "console.error('#### onload frame.src=' + frame.src);" | |
| 117 "window.domAutomationController.setAutomationId(0);" | 116 "window.domAutomationController.setAutomationId(0);" |
| 118 "window.domAutomationController.send('frameLoaded');" | 117 "window.domAutomationController.send('frameLoaded');" |
| 119 "};" | 118 "};" |
| 120 "frame.addEventListener('load', onload);" | 119 "frame.addEventListener('load', onload);" |
| 121 "$('error-offline-login-link').onclick();" | 120 "$('error-offline-login-link').onclick();" |
| 122 "console.error('#### original frame.src=' + frame.src);" | |
| 123 "})();"; | 121 "})();"; |
| 124 ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); | 122 ASSERT_TRUE(content::ExecuteScript(web_contents(), js)); |
| 125 | 123 |
| 126 std::string message; | 124 std::string message; |
| 127 do { | 125 do { |
| 128 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 126 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 129 } while (message != "\"frameLoaded\""); | 127 } while (message != "\"frameLoaded\""); |
| 130 } | 128 } |
| 131 | 129 |
| 132 void SubmitGaiaAuthOfflineForm(const std::string& user_email, | 130 void SubmitGaiaAuthOfflineForm(const std::string& user_email, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 SetExpectedCredentials(user_context); | 215 SetExpectedCredentials(user_context); |
| 218 | 216 |
| 219 SubmitGaiaAuthOfflineForm(kTestUser, kPassword); | 217 SubmitGaiaAuthOfflineForm(kTestUser, kPassword); |
| 220 | 218 |
| 221 content::WindowedNotificationObserver( | 219 content::WindowedNotificationObserver( |
| 222 chrome::NOTIFICATION_SESSION_STARTED, | 220 chrome::NOTIFICATION_SESSION_STARTED, |
| 223 content::NotificationService::AllSources()).Wait(); | 221 content::NotificationService::AllSources()).Wait(); |
| 224 } | 222 } |
| 225 | 223 |
| 226 } // namespace | 224 } // namespace |
| OLD | NEW |