Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: tools/testing/run_selenium.py

Issue 11800002: "Reverting 16675-16676, 71-73" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 """Script to actually open a browser and perform the test, and reports back with 8 """Script to actually open a browser and perform the test, and reports back with
9 the result. It uses Selenium WebDriver when possible for running the tests. It 9 the result. It uses Selenium WebDriver when possible for running the tests. It
10 uses Selenium RC for Safari. 10 uses Selenium RC for Safari.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 def print_server_error(): 143 def print_server_error():
144 """Provide the user an informative error message if we attempt to connect to 144 """Provide the user an informative error message if we attempt to connect to
145 the Selenium remote control server, but cannot access it. Then exit the 145 the Selenium remote control server, but cannot access it. Then exit the
146 program.""" 146 program."""
147 print ('ERROR: Could not connect to Selenium RC server. Are you running' 147 print ('ERROR: Could not connect to Selenium RC server. Are you running'
148 ' java -jar tools/testing/selenium-server-standalone-*.jar? If not, ' 148 ' java -jar tools/testing/selenium-server-standalone-*.jar? If not, '
149 'start it before running this test.') 149 'start it before running this test.')
150 sys.exit(1) 150 sys.exit(1)
151 151
152 def start_browser(browser, executable_path, html_out): 152 def start_browser(browser, executable_path, html_out):
153 if browser == 'chrome' or browser == 'dartium': 153 if browser == 'chrome':
154 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to 154 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to
155 # installing Chrome. Also note that the build bot runs have a different path 155 # installing Chrome. Also note that the build bot runs have a different path
156 # from a normal user -- check the build logs. 156 # from a normal user -- check the build logs.
157 return selenium.webdriver.Chrome()
158 elif browser == 'dartium':
159 script_dir = os.path.dirname(os.path.abspath(__file__))
160 dartium_dir = os.path.join(script_dir, '..', '..', 'client', 'tests',
161 'dartium')
157 options = selenium.webdriver.chrome.options.Options() 162 options = selenium.webdriver.chrome.options.Options()
158 if browser == 'dartium': 163 # enable ShadowDOM and style scoped for Dartium
159 script_dir = os.path.dirname(os.path.abspath(__file__)) 164 options.add_argument('--enable-shadow-dom')
160 dartium_dir = os.path.join(script_dir, '..', '..', 'client', 'tests', 165 options.add_argument('--enable-style-scoped')
161 'dartium') 166 if executable_path is not None:
162 # enable ShadowDOM and style scoped for Dartium 167 options.binary_location = executable_path
163 options.add_argument('--enable-shadow-dom') 168 elif platform.system() == 'Windows':
164 options.add_argument('--enable-style-scoped') 169 options.binary_location = os.path.join(dartium_dir, 'chrome.exe')
165 if executable_path is not None: 170 elif platform.system() == 'Darwin':
166 options.binary_location = executable_path 171 options.binary_location = os.path.join(dartium_dir, 'Chromium.app',
167 elif platform.system() == 'Windows': 172 'Contents', 'MacOS', 'Chromium')
168 options.binary_location = os.path.join(dartium_dir, 'chrome.exe') 173 else:
169 elif platform.system() == 'Darwin': 174 options.binary_location = os.path.join(dartium_dir, 'chrome')
170 options.binary_location = os.path.join(dartium_dir, 'Chromium.app',
171 'Contents', 'MacOS', 'Chromium')
172 else:
173 options.binary_location = os.path.join(dartium_dir, 'chrome')
174 return selenium.webdriver.Chrome(chrome_options=options) 175 return selenium.webdriver.Chrome(chrome_options=options)
175 elif browser == 'ff': 176 elif browser == 'ff':
176 script_dir = os.path.dirname(os.path.abspath(__file__)) 177 script_dir = os.path.dirname(os.path.abspath(__file__))
177 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() 178 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile()
178 profile.set_preference('dom.max_script_run_time', 0) 179 profile.set_preference('dom.max_script_run_time', 0)
179 profile.set_preference('dom.max_chrome_script_run_time', 0) 180 profile.set_preference('dom.max_chrome_script_run_time', 0)
180 profile.set_preference('app.update.auto', True) 181 profile.set_preference('app.update.auto', True)
181 profile.set_preference('app.update.enabled', True) 182 profile.set_preference('app.update.enabled', True)
182 return selenium.webdriver.Firefox(firefox_profile=profile) 183 return selenium.webdriver.Firefox(firefox_profile=profile)
183 elif ((browser == 'ie9' or browser == 'ie10') and 184 elif ((browser == 'ie9' or browser == 'ie10') and
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 browser = start_browser(browser_name, executable_path, html_out) 358 browser = start_browser(browser_name, executable_path, html_out)
358 359
359 try: 360 try:
360 output = run_test_in_browser(browser, html_out, timeout, mode, refresh) 361 output = run_test_in_browser(browser, html_out, timeout, mode, refresh)
361 return report_results(mode, output, browser) 362 return report_results(mode, output, browser)
362 finally: 363 finally:
363 close_browser(browser) 364 close_browser(browser)
364 365
365 if __name__ == "__main__": 366 if __name__ == "__main__":
366 sys.exit(main(sys.argv)) 367 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698