Skip to content

Commit

Permalink
Use Omaha proxy to find the correct ChromeDriver (web-platform-tests#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexcles committed Apr 23, 2019
1 parent 0df6ae9 commit 7a7e16a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions tools/wpt/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,29 +464,31 @@ def find_webdriver(self, channel=None):
def _latest_chromedriver_url(self, browser_binary=None):
latest = None
chrome_version = self.version(browser_binary)
if chrome_version is not None:
parts = chrome_version.split(".")
if len(parts) == 4:
latest_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_%s.%s.%s" % (
parts[0], parts[1], parts[2])
assert chrome_version, "Cannot detect the version of Chrome"

# Remove channel suffixes (e.g. " dev").
chrome_version = chrome_version.split(' ')[0]
parts = chrome_version.split(".")
if len(parts) == 4:
latest_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_%s.%s.%s" % tuple(parts[:-1])
try:
latest = get(latest_url).text.strip()
except requests.RequestException:
latest_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_%s" % parts[0]
try:
latest = get(latest_url).text.strip()
except requests.RequestException:
latest_url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_%s" % parts[0]
try:
latest = get(latest_url).text.strip()
except requests.RequestException:
pass
pass
if latest is None:
# Fall back to the tip-of-tree *Chromium* build.
latest_url = "https://storage.googleapis.com/chromium-browser-snapshots/%s/LAST_CHANGE" % (
self.chromium_platform_string())
latest = get(latest_url).text.strip()
# Fall back to *Chromium* build archives.
omaha = get("https://omahaproxy.appspot.com/deps.json?version=" + chrome_version).json()
revision = omaha['chromium_base_position']
url = "https://storage.googleapis.com/chromium-browser-snapshots/%s/%s/chromedriver_%s.zip" % (
self.chromium_platform_string(), latest, self.platform_string())
self.chromium_platform_string(), revision, self.platform_string())
else:
url = "https://chromedriver.storage.googleapis.com/%s/chromedriver_%s.zip" % (
latest, self.platform_string())

return url

def install_webdriver(self, dest=None, channel=None, browser_binary=None):
Expand Down

0 comments on commit 7a7e16a

Please sign in to comment.