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

Unified Diff: tools/testing/webdriver_test_setup.py

Issue 33003002: Updated webdriver setup script to use new location for downloads. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Whoops. Jumped the gun on deleting things. Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/webdriver_test_setup.py
diff --git a/tools/testing/webdriver_test_setup.py b/tools/testing/webdriver_test_setup.py
index 7988bab5a591124c75b8777d0f7bb54fd9d2cd3b..51d3b0414d1922b94ef31459092a3cbe741501fa 100755
--- a/tools/testing/webdriver_test_setup.py
+++ b/tools/testing/webdriver_test_setup.py
@@ -81,6 +81,78 @@ def find_depot_tools_location(is_buildbot):
raise Exception("Could not find depot_tools in your path.")
+class ChromeDriverInstaller(object):
Emily Fortuna 2013/10/21 20:29:46 can this be refactored? can in it extend GoogleCod
Andrei Mouravski 2013/10/22 00:11:51 Aye, I'll do that.
+ """Install ChromeDriver from Google Storage."""
+
+ def __init__(self, download_location):
+ """ Create an object that will install ChromeDriver from Google Storage.
+ Arguments:
+ download_location - Where to download the desired file on our filesystem.
+ """
+ self.download_location = download_location
+ self.project_name = 'chromedriver'
+ self.google_storage_downloads_page = 'http://chromedriver.storage.googleapis.com'
Emily Fortuna 2013/10/21 20:29:46 80 char
+
+
+ def find_latest_version(self):
+ """Find the latest version number of ChromeDriver."""
+ f = urllib2.urlopen(self.google_storage_downloads_page)
+ latest = ''
+ l = f.read()
+ r = re.compile('(?:<Key>)(\d+\.\d+)')
+ v = max(r.findall(l))
+ return v
+
+ def run(self):
+ """Download and install the Google Code."""
+ print 'Installing from %s' % self.project_name
+ os_str = self.get_os_str
+ version = self.find_latest_version()
+ download_name = 'chromedriver_%s.zip' % os_str
+
+ urllib.urlretrieve(self.google_storage_downloads_page + '/' + version +
+ '/chromedriver_' + os_str + '.zip',
+ os.path.join(self.download_location, download_name))
+
+ if platform.system() != 'Windows':
+ # The Python zip utility does not preserve executable permissions, but
+ # this does not seem to be a problem for Windows, which does not have a
+ # built in zip utility. :-/
+ run_cmd('unzip -u %s -d %s' % (os.path.join(self.download_location,
+ download_name), self.download_location), stdin='y')
+ else:
+ z = zipfile.ZipFile(os.path.join(self.download_location, download_name))
+ z.extractall(self.download_location)
+ z.close()
+ os.remove(os.path.join(self.download_location, download_name))
+
+ chrome_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'orig-chromedriver')
+ if self.project_name == 'chromedriver' and os.path.exists(chrome_path):
+ # We have one additional location to make sure chromedriver is updated.
+ # TODO(efortuna): Remove this. See move_chrome_driver_if_needed in
+ # perf_testing/run_perf_tests.py
+ driver = 'chromedriver'
+ if platform.system() == 'Windows':
+ driver += '.exe'
+ shutil.copy(os.path.join(self.download_location, driver),
+ os.path.join(chrome_path, driver))
+
+ @property
+ def get_os_str(self):
+ """The strings to indicate what OS a download is for.
+ """
+ os_str = 'win'
+ if 'darwin' in sys.platform:
+ os_str = 'mac'
+ elif 'linux' in sys.platform:
+ os_str = 'linux32'
+ if '64bit' in platform.architecture()[0]:
+ os_str = 'linux64'
+ if self.project_name == 'chromedriver' and (
+ os_str == 'mac' or os_str == 'win'):
+ os_str = os_str + '32'
+ return os_str
class GoogleCodeInstaller(object):
"""Install code that is being hosted on Google Code."""
@@ -393,9 +465,7 @@ def main():
if not args.python:
SeleniumBindingsInstaller(args.buildbot).run()
if not args.chromedriver:
- GoogleCodeInstaller('chromedriver',
- find_depot_tools_location(args.buildbot),
- lambda x: 'chromedriver_%(os)s_%(version)s.zip' % x).run()
+ ChromeDriverInstaller(find_depot_tools_location(args.buildbot)).run()
if not args.seleniumrc:
GoogleCodeInstaller('selenium', os.path.dirname(os.path.abspath(__file__)),
lambda x: 'selenium-server-standalone-%(version)s.jar' % x).run()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698