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 """PyAuto: Python Interface to Chromium's Automation Proxy. | 6 """PyAuto: Python Interface to Chromium's Automation Proxy. |
7 | 7 |
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. | 8 PyAuto uses swig to expose Automation Proxy interfaces to Python. |
9 For complete documentation on the functionality available, | 9 For complete documentation on the functionality available, |
10 run pydoc on this file. | 10 run pydoc on this file. |
(...skipping 4697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4708 'command': 'SubmitLoginForm', | 4708 'command': 'SubmitLoginForm', |
4709 'username': username, | 4709 'username': username, |
4710 'password': password, | 4710 'password': password, |
4711 } | 4711 } |
4712 self._GetResultFromJSONRequest(cmd_dict, windex=None) | 4712 self._GetResultFromJSONRequest(cmd_dict, windex=None) |
4713 try: | 4713 try: |
4714 # TODO(craigdh): Add login failure events once PyAuto switches to mocked | 4714 # TODO(craigdh): Add login failure events once PyAuto switches to mocked |
4715 # GAIA authentication. | 4715 # GAIA authentication. |
4716 self.GetNextEvent() | 4716 self.GetNextEvent() |
4717 except JSONInterfaceError as e: | 4717 except JSONInterfaceError as e: |
4718 raise JSONInterfaceError('%s\nLogin failed. Perhaps Chrome crashed, ' | 4718 raise JSONInterfaceError('Login failed. Perhaps Chrome crashed, ' |
4719 'failed to start, or the login flow is ' | 4719 'failed to start, or the login flow is ' |
4720 'broken?' % str(e)) | 4720 'broken? Error message: %s' % str(e)) |
4721 | 4721 |
4722 def Logout(self): | 4722 def Logout(self): |
4723 """Log out from ChromeOS and wait for session_manager to come up. | 4723 """Log out from ChromeOS and wait for session_manager to come up. |
4724 | 4724 |
4725 This is equivalent to pressing the 'Sign out' button from the | 4725 This is equivalent to pressing the 'Sign out' button from the |
4726 aura shell tray when logged in. | 4726 aura shell tray when logged in. |
4727 | 4727 |
4728 Should be logged in to work. Re-initializes the automation channel | 4728 Should be logged in to work. Re-initializes the automation channel |
4729 after logout. | 4729 after logout. |
4730 """ | 4730 """ |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6458 successful = result.wasSuccessful() | 6458 successful = result.wasSuccessful() |
6459 if not successful: | 6459 if not successful: |
6460 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6460 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
6461 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6461 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
6462 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6462 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
6463 sys.exit(not successful) | 6463 sys.exit(not successful) |
6464 | 6464 |
6465 | 6465 |
6466 if __name__ == '__main__': | 6466 if __name__ == '__main__': |
6467 Main() | 6467 Main() |
OLD | NEW |