| 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 """Runs all ChromeDriver end to end tests.""" | 6 """Runs all ChromeDriver end to end tests.""" |
| 7 | 7 |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 if code: | 89 if code: |
| 90 print '@@@STEP_FAILURE@@@' | 90 print '@@@STEP_FAILURE@@@' |
| 91 return code | 91 return code |
| 92 | 92 |
| 93 | 93 |
| 94 def main(): | 94 def main(): |
| 95 parser = optparse.OptionParser() | 95 parser = optparse.OptionParser() |
| 96 parser.add_option( | 96 parser.add_option( |
| 97 '', '--android-package', | 97 '', '--android-package', |
| 98 help='Application package name, if running tests on Android.') | 98 help='Application package name, if running tests on Android.') |
| 99 # Option 'chrome-version' is for desktop only. |
| 100 parser.add_option( |
| 101 '', '--chrome-version', |
| 102 help='Version of chrome, e.g., \'HEAD\', \'27\', or \'26\'.' |
| 103 'Default is to run tests against all of these versions.' |
| 104 'Notice: this option only applies to desktop.') |
| 99 options, _ = parser.parse_args() | 105 options, _ = parser.parse_args() |
| 100 | 106 |
| 101 chromedriver_map = { | 107 chromedriver_map = { |
| 102 'win': 'chromedriver2.dll', | 108 'win': 'chromedriver2.dll', |
| 103 'mac': 'chromedriver2.so', | 109 'mac': 'chromedriver2.so', |
| 104 'linux': 'libchromedriver2.so', | 110 'linux': 'libchromedriver2.so', |
| 105 } | 111 } |
| 106 chromedriver_name = chromedriver_map[util.GetPlatformName()] | 112 chromedriver_name = chromedriver_map[util.GetPlatformName()] |
| 107 | 113 |
| 108 chrome_map = { | 114 chrome_map = { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 android_package=options.android_package) | 148 android_package=options.android_package) |
| 143 code2 = RunJavaTests(chromedriver_server, | 149 code2 = RunJavaTests(chromedriver_server, |
| 144 android_package=options.android_package) | 150 android_package=options.android_package) |
| 145 return code1 or code2 | 151 return code1 or code2 |
| 146 else: | 152 else: |
| 147 chrome_tip_of_tree = os.path.join(build_dir, chrome_name) | 153 chrome_tip_of_tree = os.path.join(build_dir, chrome_name) |
| 148 cpp_tests = os.path.join(build_dir, cpp_tests_name) | 154 cpp_tests = os.path.join(build_dir, cpp_tests_name) |
| 149 | 155 |
| 150 chrome_26 = continuous_archive.DownloadChrome( | 156 chrome_26 = continuous_archive.DownloadChrome( |
| 151 continuous_archive.CHROME_26_REVISION, util.MakeTempDir()) | 157 continuous_archive.CHROME_26_REVISION, util.MakeTempDir()) |
| 158 chrome_27 = continuous_archive.DownloadChrome( |
| 159 continuous_archive.CHROME_27_REVISION, util.MakeTempDir()) |
| 152 chrome_path_versions = [ | 160 chrome_path_versions = [ |
| 153 {'path': chrome_tip_of_tree, 'version': 'HEAD'}, | 161 {'path': chrome_tip_of_tree, 'version': 'HEAD'}, |
| 162 {'path': chrome_27, 'version': '27'}, |
| 154 {'path': chrome_26, 'version': '26'}, | 163 {'path': chrome_26, 'version': '26'}, |
| 155 ] | 164 ] |
| 156 code = 0 | 165 code = 0 |
| 157 for chrome in chrome_path_versions: | 166 for chrome in chrome_path_versions: |
| 167 if options.chrome_version and chrome['version'] != options.chrome_version: |
| 168 continue |
| 169 |
| 158 code1 = RunPythonTests(chromedriver, chrome=chrome['path'], | 170 code1 = RunPythonTests(chromedriver, chrome=chrome['path'], |
| 159 chrome_version=chrome['version']) | 171 chrome_version=chrome['version']) |
| 160 code2 = RunJavaTests(chromedriver_server, chrome=chrome['path'], | 172 code2 = RunJavaTests(chromedriver_server, chrome=chrome['path'], |
| 161 chrome_version=chrome['version']) | 173 chrome_version=chrome['version']) |
| 162 code = code or code1 or code2 | 174 code = code or code1 or code2 |
| 163 return RunCppTests(cpp_tests) or code | 175 return RunCppTests(cpp_tests) or code |
| 164 | 176 |
| 165 | 177 |
| 166 if __name__ == '__main__': | 178 if __name__ == '__main__': |
| 167 sys.exit(main()) | 179 sys.exit(main()) |
| OLD | NEW |