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 4585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4596 will not be noticed here, because the browser has no knowledge of it. In | 4596 will not be noticed here, because the browser has no knowledge of it. In |
4597 this case the GetNextEvent automation command will always time out. | 4597 this case the GetNextEvent automation command will always time out. |
4598 | 4598 |
4599 Returns: | 4599 Returns: |
4600 An error string if an error occured. | 4600 An error string if an error occured. |
4601 None otherwise. | 4601 None otherwise. |
4602 | 4602 |
4603 Raises: | 4603 Raises: |
4604 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 4604 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
4605 """ | 4605 """ |
4606 # Go to the 'Add user' screen for login to work. | |
4607 self.ExecuteJavascriptInOOBEWebUI( | |
4608 'Oobe.showSigninUI();' | |
4609 'window.domAutomationController.send("ok");') | |
4610 self._GetResultFromJSONRequest({'command': 'AddLoginEventObserver'}, | 4606 self._GetResultFromJSONRequest({'command': 'AddLoginEventObserver'}, |
4611 windex=None) | 4607 windex=None) |
4612 cmd_dict = { | 4608 cmd_dict = { |
4613 'command': 'SubmitLoginForm', | 4609 'command': 'SubmitLoginForm', |
4614 'username': username, | 4610 'username': username, |
4615 'password': password, | 4611 'password': password, |
4616 } | 4612 } |
4617 self._GetResultFromJSONRequest(cmd_dict, windex=None) | 4613 self._GetResultFromJSONRequest(cmd_dict, windex=None) |
4618 try: | 4614 try: |
4619 # TODO(craigdh): Add login failure events once PyAuto switches to mocked | 4615 # TODO(craigdh): Add login failure events once PyAuto switches to mocked |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6363 successful = result.wasSuccessful() | 6359 successful = result.wasSuccessful() |
6364 if not successful: | 6360 if not successful: |
6365 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6361 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
6366 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6362 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
6367 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6363 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
6368 sys.exit(not successful) | 6364 sys.exit(not successful) |
6369 | 6365 |
6370 | 6366 |
6371 if __name__ == '__main__': | 6367 if __name__ == '__main__': |
6372 Main() | 6368 Main() |
OLD | NEW |