| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 EXAMPLES:- | 231 EXAMPLES:- |
| 232 Wait for "file.txt" to get created: | 232 Wait for "file.txt" to get created: |
| 233 WaitUntil(os.path.exists, args=["file.txt"]) | 233 WaitUntil(os.path.exists, args=["file.txt"]) |
| 234 | 234 |
| 235 Same as above, but using lambda: | 235 Same as above, but using lambda: |
| 236 WaitUntil(lambda: os.path.exists("file.txt")) | 236 WaitUntil(lambda: os.path.exists("file.txt")) |
| 237 | 237 |
| 238 Args: | 238 Args: |
| 239 function: the function whose truth value is to be evaluated | 239 function: the function whose truth value is to be evaluated |
| 240 timeout: the max timeout (in secs) for which to wait. The default | 240 timeout: the max timeout (in secs) for which to wait. The default |
| 241 action is to wait for 60secs, and can be changed by | 241 action is to wait for kWaitForActionMaxMsec, as set in |
| 242 changing kWaitForActionMaxMsec in ui_test.cc. | 242 ui_test.cc |
| 243 Use None to wait indefinitely. | 243 Use None to wait indefinitely. |
| 244 retry_sleep: the sleep interval (in secs) before retrying |function|. | 244 retry_sleep: the sleep interval (in secs) before retrying |function|. |
| 245 Deaults to 0.25 secs. | 245 Defaults to 0.25 secs. |
| 246 args: the args to pass to |function| | 246 args: the args to pass to |function| |
| 247 | 247 |
| 248 Returns: | 248 Returns: |
| 249 True, if returning when |function| evaluated to True | 249 True, if returning when |function| evaluated to True |
| 250 False, when returning due to timeout | 250 False, when returning due to timeout |
| 251 """ | 251 """ |
| 252 if timeout == -1: # Default | 252 if timeout == -1: # Default |
| 253 timeout = self.action_max_timeout_ms()/1000.0 | 253 timeout = self.action_max_timeout_ms()/1000.0 |
| 254 assert callable(function), "function should be a callable" | 254 assert callable(function), "function should be a callable" |
| 255 begin = time.time() | 255 begin = time.time() |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 if self._options.verbose: | 1135 if self._options.verbose: |
| 1136 verbosity = 2 | 1136 verbosity = 2 |
| 1137 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) | 1137 result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) |
| 1138 del loaded_tests # Need to destroy test cases before the suite | 1138 del loaded_tests # Need to destroy test cases before the suite |
| 1139 del pyauto_suite | 1139 del pyauto_suite |
| 1140 sys.exit(not result.wasSuccessful()) | 1140 sys.exit(not result.wasSuccessful()) |
| 1141 | 1141 |
| 1142 | 1142 |
| 1143 if __name__ == '__main__': | 1143 if __name__ == '__main__': |
| 1144 Main() | 1144 Main() |
| OLD | NEW |