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

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

Issue 10826125: Properly update chromedriver. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/perf_testing/run_perf_tests.py ('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 # Run to install the necessary components to run webdriver on the buildbots or 7 # Run to install the necessary components to run webdriver on the buildbots or
8 # on your local machine. 8 # on your local machine.
9 # Note: The setup steps can be done fairly easily by hand. This script is 9 # Note: The setup steps can be done fairly easily by hand. This script is
10 # intended to simply and reduce the time for setup since there are a fair number 10 # intended to simply and reduce the time for setup since there are a fair number
11 # of steps. 11 # of steps.
12 12
13 # TODO(efortuna): Rewrite this script in Dart when the Process module has a 13 # TODO(efortuna): Rewrite this script in Dart when the Process module has a
14 # better high level API. 14 # better high level API.
15 import optparse 15 import optparse
16 import os 16 import os
17 import platform 17 import platform
18 import re 18 import re
19 import shutil
19 import subprocess 20 import subprocess
20 import sys 21 import sys
21 import urllib 22 import urllib
22 import urllib2 23 import urllib2
23 import zipfile 24 import zipfile
24 25
25 def run_cmd(cmd, stdin=None): 26 def run_cmd(cmd, stdin=None):
26 """Run the command on the command line in the shell. We print the output of 27 """Run the command on the command line in the shell. We print the output of
27 the command. 28 the command.
28 """ 29 """
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 # The Python zip utility does not preserve executable permissions, but 135 # The Python zip utility does not preserve executable permissions, but
135 # this does not seem to be a problem for Windows, which does not have a 136 # this does not seem to be a problem for Windows, which does not have a
136 # built in zip utility. :-/ 137 # built in zip utility. :-/
137 run_cmd('unzip -u %s -d %s' % (os.path.join(self.download_location, 138 run_cmd('unzip -u %s -d %s' % (os.path.join(self.download_location,
138 download_name), self.download_location), stdin='y') 139 download_name), self.download_location), stdin='y')
139 else: 140 else:
140 z = zipfile.ZipFile(os.path.join(self.download_location, download_name)) 141 z = zipfile.ZipFile(os.path.join(self.download_location, download_name))
141 z.extractall(self.download_location) 142 z.extractall(self.download_location)
142 z.close() 143 z.close()
143 os.remove(os.path.join(self.download_location, download_name)) 144 os.remove(os.path.join(self.download_location, download_name))
145 chrome_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
146 'orig-chromedriver')
147 if self.project_name == 'chromedriver' and os.path.exists(chrome_path):
148 # We have one additional location to make sure chromedriver is updated.
149 # TODO(efortuna): Remove this. See move_chrome_driver_if_needed in
150 # perf_testing/run_perf_tests.py
151 driver = 'chromedriver'
152 if platform.system() == 'Windows':
153 driver += '.exe'
154 shutil.copy(os.path.join(self.download_location, driver),
155 os.path.join(chrome_path, driver))
144 156
145 @property 157 @property
146 def get_os_str(self): 158 def get_os_str(self):
147 """The strings to indicate what OS a download is for as used on Google Code. 159 """The strings to indicate what OS a download is for as used on Google Code.
148 """ 160 """
149 os_str = 'win' 161 os_str = 'win'
150 if 'darwin' in sys.platform: 162 if 'darwin' in sys.platform:
151 os_str = 'mac' 163 os_str = 'mac'
152 elif 'linux' in sys.platform: 164 elif 'linux' in sys.platform:
153 os_str = 'linux32' 165 os_str = 'linux32'
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run() 258 lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run()
247 if 'win32' not in sys.platform and 'cygwin' not in sys.platform: 259 if 'win32' not in sys.platform and 'cygwin' not in sys.platform:
248 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)), 260 GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)),
249 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run() 261 lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run()
250 262
251 if args.firefox: 263 if args.firefox:
252 FirefoxInstaller().run() 264 FirefoxInstaller().run()
253 265
254 if __name__ == '__main__': 266 if __name__ == '__main__':
255 main() 267 main()
OLDNEW
« no previous file with comments | « tools/testing/perf_testing/run_perf_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698