| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return ret | 252 return ret |
| 253 | 253 |
| 254 @staticmethod | 254 @staticmethod |
| 255 def Kill(pid): | 255 def Kill(pid): |
| 256 """Terminate the given pid.""" | 256 """Terminate the given pid.""" |
| 257 if PyUITest.IsWin(): | 257 if PyUITest.IsWin(): |
| 258 subprocess.call(['taskkill.exe', '/T', '/F', '/PID', str(pid)]) | 258 subprocess.call(['taskkill.exe', '/T', '/F', '/PID', str(pid)]) |
| 259 else: | 259 else: |
| 260 os.kill(pid, signal.SIGTERM) | 260 os.kill(pid, signal.SIGTERM) |
| 261 | 261 |
| 262 def GetPrivateInfo(self): |
| 263 """Fetch info from private_tests_info.txt in private dir. |
| 264 |
| 265 Returns: |
| 266 a dictionary of items from private_tests_info.txt |
| 267 """ |
| 268 private_file = os.path.join( |
| 269 self.DataDir(), 'private', 'private_tests_info.txt') |
| 270 assert os.path.exists(private_file), '%s missing' % private_file |
| 271 return self.EvalDataFrom(private_file) |
| 272 |
| 262 def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[], | 273 def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[], |
| 263 expect_retval=None): | 274 expect_retval=None): |
| 264 """Poll on a condition until timeout. | 275 """Poll on a condition until timeout. |
| 265 | 276 |
| 266 Waits until the |function| evalues to |expect_retval| or until |timeout| | 277 Waits until the |function| evalues to |expect_retval| or until |timeout| |
| 267 secs, whichever occurs earlier. | 278 secs, whichever occurs earlier. |
| 268 | 279 |
| 269 This is better than using a sleep, since it waits (almost) only as much | 280 This is better than using a sleep, since it waits (almost) only as much |
| 270 as needed. | 281 as needed. |
| 271 | 282 |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2050 if self._options.verbose: | 2061 if self._options.verbose: |
| 2051 verbosity = 2 | 2062 verbosity = 2 |
| 2052 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) | 2063 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) |
| 2053 del loaded_tests # Need to destroy test cases before the suite | 2064 del loaded_tests # Need to destroy test cases before the suite |
| 2054 del pyauto_suite | 2065 del pyauto_suite |
| 2055 sys.exit(not result.wasSuccessful()) | 2066 sys.exit(not result.wasSuccessful()) |
| 2056 | 2067 |
| 2057 | 2068 |
| 2058 if __name__ == '__main__': | 2069 if __name__ == '__main__': |
| 2059 Main() | 2070 Main() |
| OLD | NEW |