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

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

Issue 11641005: Add cross-origin test with credentials. (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
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': 153 if browser == 'chrome' or browser == 'dartium':
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')
162 options = selenium.webdriver.chrome.options.Options() 157 options = selenium.webdriver.chrome.options.Options()
163 # enable ShadowDOM and style scoped for Dartium 158 if browser == 'dartium':
164 options.add_argument('--enable-shadow-dom') 159 script_dir = os.path.dirname(os.path.abspath(__file__))
165 options.add_argument('--enable-style-scoped') 160 dartium_dir = os.path.join(script_dir, '..', '..', 'client', 'tests',
166 if executable_path is not None: 161 'dartium')
167 options.binary_location = executable_path 162 # enable ShadowDOM and style scoped for Dartium
168 elif platform.system() == 'Windows': 163 options.add_argument('--enable-shadow-dom')
169 options.binary_location = os.path.join(dartium_dir, 'chrome.exe') 164 options.add_argument('--enable-style-scoped')
170 elif platform.system() == 'Darwin': 165 if executable_path is not None:
171 options.binary_location = os.path.join(dartium_dir, 'Chromium.app', 166 options.binary_location = executable_path
172 'Contents', 'MacOS', 'Chromium') 167 elif platform.system() == 'Windows':
173 else: 168 options.binary_location = os.path.join(dartium_dir, 'chrome.exe')
174 options.binary_location = os.path.join(dartium_dir, 'chrome') 169 elif platform.system() == 'Darwin':
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')
175 return selenium.webdriver.Chrome(chrome_options=options) 174 return selenium.webdriver.Chrome(chrome_options=options)
176 elif browser == 'ff': 175 elif browser == 'ff':
177 script_dir = os.path.dirname(os.path.abspath(__file__)) 176 script_dir = os.path.dirname(os.path.abspath(__file__))
178 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile() 177 profile = selenium.webdriver.firefox.firefox_profile.FirefoxProfile()
179 profile.set_preference('dom.max_script_run_time', 0) 178 profile.set_preference('dom.max_script_run_time', 0)
180 profile.set_preference('dom.max_chrome_script_run_time', 0) 179 profile.set_preference('dom.max_chrome_script_run_time', 0)
181 profile.set_preference('app.update.auto', True) 180 profile.set_preference('app.update.auto', True)
182 profile.set_preference('app.update.enabled', True) 181 profile.set_preference('app.update.enabled', True)
183 return selenium.webdriver.Firefox(firefox_profile=profile) 182 return selenium.webdriver.Firefox(firefox_profile=profile)
184 elif ((browser == 'ie9' or browser == 'ie10') and 183 elif ((browser == 'ie9' or browser == 'ie10') and
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 browser = start_browser(browser_name, executable_path, html_out) 357 browser = start_browser(browser_name, executable_path, html_out)
359 358
360 try: 359 try:
361 output = run_test_in_browser(browser, html_out, timeout, mode, refresh) 360 output = run_test_in_browser(browser, html_out, timeout, mode, refresh)
362 return report_results(mode, output, browser) 361 return report_results(mode, output, browser)
363 finally: 362 finally:
364 close_browser(browser) 363 close_browser(browser)
365 364
366 if __name__ == "__main__": 365 if __name__ == "__main__":
367 sys.exit(main(sys.argv)) 366 sys.exit(main(sys.argv))
OLDNEW
« tools/testing/dart/test_suite.dart ('K') | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698