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 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 Raises: | 1959 Raises: |
1960 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 1960 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
1961 """ | 1961 """ |
1962 if tab_index is None: | 1962 if tab_index is None: |
1963 tab_index = self.GetActiveTabIndex(windex) | 1963 tab_index = self.GetActiveTabIndex(windex) |
1964 cmd_dict = { | 1964 cmd_dict = { |
1965 'command': 'GetDownloadDirectory', | 1965 'command': 'GetDownloadDirectory', |
1966 'tab_index': tab_index, | 1966 'tab_index': tab_index, |
1967 'windex': windex, | 1967 'windex': windex, |
1968 } | 1968 } |
1969 return FilePath(self._GetResultFromJSONRequest(cmd_dict, | 1969 return FilePath(str(self._GetResultFromJSONRequest(cmd_dict, |
1970 windex=None)['path']) | 1970 windex=None)['path'])) |
1971 | 1971 |
1972 def WaitForAllDownloadsToComplete(self, pre_download_ids=[], windex=0, | 1972 def WaitForAllDownloadsToComplete(self, pre_download_ids=[], windex=0, |
1973 timeout=-1): | 1973 timeout=-1): |
1974 """Wait for all pending downloads to complete. | 1974 """Wait for all pending downloads to complete. |
1975 | 1975 |
1976 This function assumes that any downloads to wait for have already been | 1976 This function assumes that any downloads to wait for have already been |
1977 triggered and have started (it is ok if those downloads complete before this | 1977 triggered and have started (it is ok if those downloads complete before this |
1978 function is called). | 1978 function is called). |
1979 | 1979 |
1980 Args: | 1980 Args: |
(...skipping 4503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6484 successful = result.wasSuccessful() | 6484 successful = result.wasSuccessful() |
6485 if not successful: | 6485 if not successful: |
6486 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6486 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
6487 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6487 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
6488 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6488 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
6489 sys.exit(not successful) | 6489 sys.exit(not successful) |
6490 | 6490 |
6491 | 6491 |
6492 if __name__ == '__main__': | 6492 if __name__ == '__main__': |
6493 Main() | 6493 Main() |
OLD | NEW |