Chromium Code Reviews| 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 import os | 5 import os |
| 6 | 6 |
| 7 | 7 |
| 8 class ChromotingMixIn(object): | 8 class ChromotingMixIn(object): |
| 9 """MixIn for PyUITest that adds Chromoting-specific methods. | 9 """MixIn for PyUITest that adds Chromoting-specific methods. |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 self.assertTrue( | 93 self.assertTrue( |
| 94 self._WaitForJavascriptCondition( | 94 self._WaitForJavascriptCondition( |
| 95 'document.getElementById("smsVerifyPin")', | 95 'document.getElementById("smsVerifyPin")', |
| 96 tab_index, windex), | 96 tab_index, windex), |
| 97 msg='Invalid username or password.') | 97 msg='Invalid username or password.') |
| 98 self._ExecuteJavascript('document.getElementById("smsUserPin").value = ' | 98 self._ExecuteJavascript('document.getElementById("smsUserPin").value = ' |
| 99 '"%s";' | 99 '"%s";' |
| 100 'document.getElementById("smsVerifyPin").click();' | 100 'document.getElementById("smsVerifyPin").click();' |
| 101 % otp, tab_index, windex) | 101 % otp, tab_index, windex) |
| 102 | 102 |
| 103 # If the account adder screen appears, then skip it. | |
| 104 self.assertTrue( | |
| 105 self._WaitForJavascriptCondition( | |
| 106 'document.getElementById("skip") || ' | |
| 107 'document.getElementById("submit_approve_access")', | |
| 108 tab_index, windex), | |
| 109 msg="Didn't see a 'skip adding account' or 'approve access' link.") | |
|
dtu
2012/05/01 01:07:11
nit: Swap the " and ' in this line.
simonmorris
2012/05/01 16:58:25
Done.
| |
| 110 self._ExecuteJavascript( | |
| 111 'if (document.getElementById("skip")) ' | |
| 112 '{ document.getElementById("skip").click(); }', | |
| 113 tab_index, windex) | |
| 114 | |
| 103 # Approve access. | 115 # Approve access. |
| 104 self.assertTrue( | 116 self.assertTrue( |
| 105 self._WaitForJavascriptCondition( | 117 self._WaitForJavascriptCondition( |
| 106 'document.getElementById("submit_approve_access")', | 118 'document.getElementById("submit_approve_access")', |
| 107 tab_index, windex), | 119 tab_index, windex), |
| 108 msg='Authentication failed. The username, password, or otp is invalid.') | 120 msg='Authentication failed. The username, password, or otp is invalid.') |
| 109 self._ExecuteJavascript( | 121 self._ExecuteJavascript( |
| 110 'document.getElementById("submit_approve_access").click();', | 122 'document.getElementById("submit_approve_access").click();', |
| 111 tab_index, windex) | 123 tab_index, windex) |
| 112 | 124 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 | 171 |
| 160 def Disconnect(self, tab_index=1, windex=0): | 172 def Disconnect(self, tab_index=1, windex=0): |
| 161 """Disconnects from the Chromoting session on the client side. | 173 """Disconnects from the Chromoting session on the client side. |
| 162 | 174 |
| 163 Returns: | 175 Returns: |
| 164 True on success; False otherwise. | 176 True on success; False otherwise. |
| 165 """ | 177 """ |
| 166 return self._ExecuteAndWaitForMode( | 178 return self._ExecuteAndWaitForMode( |
| 167 'remoting.disconnect();', | 179 'remoting.disconnect();', |
| 168 'CLIENT_SESSION_FINISHED_IT2ME', tab_index, windex) | 180 'CLIENT_SESSION_FINISHED_IT2ME', tab_index, windex) |
| OLD | NEW |