| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 def _LocateBinDirs(): | 44 def _LocateBinDirs(): |
| 45 """Setup a few dirs where we expect to find dependency libraries.""" | 45 """Setup a few dirs where we expect to find dependency libraries.""" |
| 46 script_dir = os.path.dirname(__file__) | 46 script_dir = os.path.dirname(__file__) |
| 47 chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) | 47 chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) |
| 48 | 48 |
| 49 bin_dirs = { | 49 bin_dirs = { |
| 50 'linux2': [ os.path.join(chrome_src, 'out', 'Debug'), | 50 'linux2': [ os.path.join(chrome_src, 'out', 'Debug'), |
| 51 os.path.join(chrome_src, 'sconsbuild', 'Debug'), | 51 os.path.join(chrome_src, 'sconsbuild', 'Debug'), |
| 52 os.path.join(chrome_src, 'out', 'Release'), | 52 os.path.join(chrome_src, 'out', 'Release'), |
| 53 os.path.join(chrome_src, 'sconsbuild', 'Release')], | 53 os.path.join(chrome_src, 'sconsbuild', 'Release')], |
| 54 'linux3': [ os.path.join(chrome_src, 'out', 'Debug'), |
| 55 os.path.join(chrome_src, 'sconsbuild', 'Debug'), |
| 56 os.path.join(chrome_src, 'out', 'Release'), |
| 57 os.path.join(chrome_src, 'sconsbuild', 'Release')], |
| 54 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), | 58 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), |
| 55 os.path.join(chrome_src, 'xcodebuild', 'Release')], | 59 os.path.join(chrome_src, 'xcodebuild', 'Release')], |
| 56 'win32': [ os.path.join(chrome_src, 'chrome', 'Debug'), | 60 'win32': [ os.path.join(chrome_src, 'chrome', 'Debug'), |
| 57 os.path.join(chrome_src, 'build', 'Debug'), | 61 os.path.join(chrome_src, 'build', 'Debug'), |
| 58 os.path.join(chrome_src, 'chrome', 'Release'), | 62 os.path.join(chrome_src, 'chrome', 'Release'), |
| 59 os.path.join(chrome_src, 'build', 'Release')], | 63 os.path.join(chrome_src, 'build', 'Release')], |
| 60 'cygwin': [ os.path.join(chrome_src, 'chrome', 'Debug'), | 64 'cygwin': [ os.path.join(chrome_src, 'chrome', 'Debug'), |
| 61 os.path.join(chrome_src, 'chrome', 'Release')], | 65 os.path.join(chrome_src, 'chrome', 'Release')], |
| 62 } | 66 } |
| 63 deps_dirs = [ os.path.join(script_dir, os.pardir, | 67 deps_dirs = [ os.path.join(script_dir, os.pardir, |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 return _HTTP_SERVER.GetURL(os.path.join('files', *relative_path)).spec() | 408 return _HTTP_SERVER.GetURL(os.path.join('files', *relative_path)).spec() |
| 405 | 409 |
| 406 @staticmethod | 410 @staticmethod |
| 407 def IsMac(): | 411 def IsMac(): |
| 408 """Are we on Mac?""" | 412 """Are we on Mac?""" |
| 409 return 'darwin' == sys.platform | 413 return 'darwin' == sys.platform |
| 410 | 414 |
| 411 @staticmethod | 415 @staticmethod |
| 412 def IsLinux(): | 416 def IsLinux(): |
| 413 """Are we on Linux? ChromeOS is linux too.""" | 417 """Are we on Linux? ChromeOS is linux too.""" |
| 414 return 'linux2' == sys.platform | 418 return sys.platform.startswith('linux') |
| 415 | 419 |
| 416 @staticmethod | 420 @staticmethod |
| 417 def IsWin(): | 421 def IsWin(): |
| 418 """Are we on Win?""" | 422 """Are we on Win?""" |
| 419 return 'win32' == sys.platform | 423 return 'win32' == sys.platform |
| 420 | 424 |
| 421 @staticmethod | 425 @staticmethod |
| 422 def IsChromeOS(): | 426 def IsChromeOS(): |
| 423 """Are we on ChromeOS (or Chromium OS)? | 427 """Are we on ChromeOS (or Chromium OS)? |
| 424 | 428 |
| (...skipping 3015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3440 # Implementation inspired from unittest.main() | 3444 # Implementation inspired from unittest.main() |
| 3441 class Main(object): | 3445 class Main(object): |
| 3442 """Main program for running PyAuto tests.""" | 3446 """Main program for running PyAuto tests.""" |
| 3443 | 3447 |
| 3444 _options, _args = None, None | 3448 _options, _args = None, None |
| 3445 _tests_filename = 'PYAUTO_TESTS' | 3449 _tests_filename = 'PYAUTO_TESTS' |
| 3446 _platform_map = { | 3450 _platform_map = { |
| 3447 'win32': 'win', | 3451 'win32': 'win', |
| 3448 'darwin': 'mac', | 3452 'darwin': 'mac', |
| 3449 'linux2': 'linux', | 3453 'linux2': 'linux', |
| 3454 'linux3': 'linux', |
| 3450 'chromeos': 'chromeos', | 3455 'chromeos': 'chromeos', |
| 3451 } | 3456 } |
| 3452 | 3457 |
| 3453 def __init__(self): | 3458 def __init__(self): |
| 3454 self._ParseArgs() | 3459 self._ParseArgs() |
| 3455 self._Run() | 3460 self._Run() |
| 3456 | 3461 |
| 3457 def _ParseArgs(self): | 3462 def _ParseArgs(self): |
| 3458 """Parse command line args.""" | 3463 """Parse command line args.""" |
| 3459 parser = optparse.OptionParser() | 3464 parser = optparse.OptionParser() |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3718 if self._options.verbose: | 3723 if self._options.verbose: |
| 3719 verbosity = 2 | 3724 verbosity = 2 |
| 3720 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) | 3725 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) |
| 3721 del loaded_tests # Need to destroy test cases before the suite | 3726 del loaded_tests # Need to destroy test cases before the suite |
| 3722 del pyauto_suite | 3727 del pyauto_suite |
| 3723 sys.exit(not result.wasSuccessful()) | 3728 sys.exit(not result.wasSuccessful()) |
| 3724 | 3729 |
| 3725 | 3730 |
| 3726 if __name__ == '__main__': | 3731 if __name__ == '__main__': |
| 3727 Main() | 3732 Main() |
| OLD | NEW |