| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """PyAuto: Python Interface to Chromium's Automation Proxy. | 7 """PyAuto: Python Interface to Chromium's Automation Proxy. |
| 8 | 8 |
| 9 PyAuto uses swig to expose Automation Proxy interfaces to Python. | 9 PyAuto uses swig to expose Automation Proxy interfaces to Python. |
| 10 For complete documentation on the functionality available, | 10 For complete documentation on the functionality available, |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 } | 640 } |
| 641 ret_dict = json.loads(self._SendJSONRequest(window_index, | 641 ret_dict = json.loads(self._SendJSONRequest(window_index, |
| 642 json.dumps(cmd_dict))) | 642 json.dumps(cmd_dict))) |
| 643 if ret_dict.has_key('error'): | 643 if ret_dict.has_key('error'): |
| 644 raise JSONInterfaceError(ret_dict['error']) | 644 raise JSONInterfaceError(ret_dict['error']) |
| 645 try: | 645 try: |
| 646 f = open(filename) | 646 f = open(filename) |
| 647 all_data = f.read() | 647 all_data = f.read() |
| 648 f.close() | 648 f.close() |
| 649 return all_data | 649 return all_data |
| 650 except IOError: | |
| 651 raise | |
| 652 finally: | 650 finally: |
| 653 shutil.rmtree(tempdir) | 651 shutil.rmtree(tempdir) |
| 654 | 652 |
| 655 | 653 |
| 656 class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite): | 654 class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite): |
| 657 """Base TestSuite for PyAuto UI tests.""" | 655 """Base TestSuite for PyAuto UI tests.""" |
| 658 | 656 |
| 659 def __init__(self, args): | 657 def __init__(self, args): |
| 660 pyautolib.PyUITestSuiteBase.__init__(self, args) | 658 pyautolib.PyUITestSuiteBase.__init__(self, args) |
| 661 | 659 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 if self._options.verbose: | 886 if self._options.verbose: |
| 889 verbosity = 2 | 887 verbosity = 2 |
| 890 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) | 888 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) |
| 891 del loaded_tests # Need to destroy test cases before the suite | 889 del loaded_tests # Need to destroy test cases before the suite |
| 892 del pyauto_suite | 890 del pyauto_suite |
| 893 sys.exit(not result.wasSuccessful()) | 891 sys.exit(not result.wasSuccessful()) |
| 894 | 892 |
| 895 | 893 |
| 896 if __name__ == '__main__': | 894 if __name__ == '__main__': |
| 897 Main() | 895 Main() |
| OLD | NEW |