OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 | 9 |
10 import pyauto_functional # Must be imported before pyauto | 10 import pyauto_functional # Must be imported before pyauto |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 def _ValidCredentials(self, account_type='test_google_account'): | 297 def _ValidCredentials(self, account_type='test_google_account'): |
298 """Obtains a valid username and password from a data file. | 298 """Obtains a valid username and password from a data file. |
299 | 299 |
300 Returns: | 300 Returns: |
301 A dictionary with the keys 'username' and 'password' | 301 A dictionary with the keys 'username' and 'password' |
302 """ | 302 """ |
303 return self.GetPrivateInfo()[account_type] | 303 return self.GetPrivateInfo()[account_type] |
304 | 304 |
305 def testCachedCredentialsAddUser(self): | 305 def testCachedCredentialsAddUser(self): |
306 proxy_dict = { | 306 self.SetSharedProxies(True) |
307 'url_path': 'singlehttp', | 307 proxy_config = { |
308 'proxy_url': '127.0.0.1', | 308 'mode': 'fixed_servers', |
| 309 'server': '127.0.0.1' |
309 } | 310 } |
310 self.SetProxySettingOnChromeOS(proxy_dict) | 311 self.SetProxySettingOnChromeOS(proxy_config); |
311 | 312 |
312 """Test that login fails.""" | 313 """Test that login fails.""" |
313 credentials = self._ValidCredentials() | 314 credentials = self._ValidCredentials() |
314 self.assertRaises( | 315 self.assertRaises( |
315 pyauto_errors.JSONInterfaceError, | 316 pyauto_errors.JSONInterfaceError, |
316 lambda: self.Login(credentials['username'], | 317 lambda: self.Login(credentials['username'], |
317 credentials['password']) | 318 credentials['password']) |
318 ) | 319 ) |
319 | 320 |
320 class ChromeosLoginCachedCredentialsUserPod(pyauto.PyUITest): | 321 class ChromeosLoginCachedCredentialsUserPod(ChromeosLogin): |
321 """TestCase for Logging into ChromeOS with cached credentials and | 322 """TestCase for Logging into ChromeOS with cached credentials and |
322 invalid proxy settings. | 323 invalid proxy settings. |
323 """ | 324 """ |
324 assert os.geteuid() == 0, 'Need to run this test as root' | 325 assert os.geteuid() == 0, 'Need to run this test as root' |
325 | 326 |
326 def ShouldAutoLogin(self): | 327 def ShouldAutoLogin(self): |
327 return False | 328 return False |
328 | 329 |
329 def setUp(self): | 330 def setUp(self): |
330 # We want a clean session_manager instance for every run, | 331 # We want a clean session_manager instance for every run, |
(...skipping 18 matching lines...) Expand all Loading... |
349 def testCachedCredentialsUserPod(self): | 350 def testCachedCredentialsUserPod(self): |
350 """Test that we can login without connectivity if we have so before. | 351 """Test that we can login without connectivity if we have so before. |
351 | 352 |
352 This test is currently disabled because testGoodLogin tries to | 353 This test is currently disabled because testGoodLogin tries to |
353 add a user after setting proxies, which is supposed to fail. To | 354 add a user after setting proxies, which is supposed to fail. To |
354 make it pass we need a hook that simply calls Login on the delegate | 355 make it pass we need a hook that simply calls Login on the delegate |
355 in webui_login_display.cc ::ShowSigninScreenForCreds. | 356 in webui_login_display.cc ::ShowSigninScreenForCreds. |
356 """ | 357 """ |
357 self.testGoodLogin() | 358 self.testGoodLogin() |
358 self.Logout() | 359 self.Logout() |
359 self.SetProxySettingOnChromeOS('singlehttp', '127.0.0.1') | 360 self.SetSharedProxies(True) |
| 361 proxy_config = { |
| 362 'mode': 'fixed_servers', |
| 363 'server': '127.0.0.1' |
| 364 } |
| 365 self.SetProxySettingOnChromeOS(proxy_config); |
360 self.testGoodLogin() | 366 self.testGoodLogin() |
361 self.ResetProxySettingsOnChromeOS() | 367 self.ResetProxySettingsOnChromeOS() |
362 | 368 |
363 | 369 |
364 if __name__ == '__main__': | 370 if __name__ == '__main__': |
365 pyauto_functional.Main() | 371 pyauto_functional.Main() |
OLD | NEW |