OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 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 3493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 | 3504 |
3505 def _Run(self): | 3505 def _Run(self): |
3506 """Run the tests.""" | 3506 """Run the tests.""" |
3507 if self._options.wait_for_debugger: | 3507 if self._options.wait_for_debugger: |
3508 raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid()) | 3508 raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid()) |
3509 | 3509 |
3510 suite_args = [sys.argv[0]] | 3510 suite_args = [sys.argv[0]] |
3511 chrome_flags = self._options.chrome_flags | 3511 chrome_flags = self._options.chrome_flags |
3512 # Set CHROME_HEADLESS. It enables crash reporter on posix. | 3512 # Set CHROME_HEADLESS. It enables crash reporter on posix. |
3513 os.putenv('CHROME_HEADLESS', '1') | 3513 os.putenv('CHROME_HEADLESS', '1') |
3514 # --dom-automation added in PyUITestBase::PyUITestBase() | 3514 os.putenv('EXTRA_CHROME_FLAGS', chrome_flags) |
3515 | |
3516 suite_args.append('--extra-chrome-flags=%s' % chrome_flags) | |
3517 # Note: The suite_args passed here are ignored on windows since it | |
3518 # overrides to obtain the command line for the current process directly. | |
3519 # Refer CommandLine::Init(). | |
3520 pyauto_suite = PyUITestSuite(suite_args) | 3515 pyauto_suite = PyUITestSuite(suite_args) |
3521 test_names = self._ExpandTestNames(self._args) | 3516 test_names = self._ExpandTestNames(self._args) |
3522 test_names *= self._options.repeat | 3517 test_names *= self._options.repeat |
3523 logging.debug("Loading %d tests from %s", len(test_names), test_names) | 3518 logging.debug("Loading %d tests from %s", len(test_names), test_names) |
3524 if self._options.list_tests: # List tests and exit | 3519 if self._options.list_tests: # List tests and exit |
3525 for name in test_names: | 3520 for name in test_names: |
3526 print name | 3521 print name |
3527 sys.exit(0) | 3522 sys.exit(0) |
3528 loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) | 3523 loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) |
3529 pyauto_suite.addTests(loaded_tests) | 3524 pyauto_suite.addTests(loaded_tests) |
3530 verbosity = 1 | 3525 verbosity = 1 |
3531 if self._options.verbose: | 3526 if self._options.verbose: |
3532 verbosity = 2 | 3527 verbosity = 2 |
3533 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) | 3528 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) |
3534 del loaded_tests # Need to destroy test cases before the suite | 3529 del loaded_tests # Need to destroy test cases before the suite |
3535 del pyauto_suite | 3530 del pyauto_suite |
3536 sys.exit(not result.wasSuccessful()) | 3531 sys.exit(not result.wasSuccessful()) |
3537 | 3532 |
3538 | 3533 |
3539 if __name__ == '__main__': | 3534 if __name__ == '__main__': |
3540 Main() | 3535 Main() |
OLD | NEW |