| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Test fixture for tests involving installing/updating Chrome. | 5 """Test fixture for tests involving installing/updating Chrome. |
| 6 | 6 |
| 7 Provides an interface to install or update chrome from within a testcase, and | 7 Provides an interface to install or update chrome from within a testcase, and |
| 8 allows users to run tests using installed version of Chrome. User and system | 8 allows users to run tests using installed version of Chrome. User and system |
| 9 level installations are supported, and either one can be used for running the | 9 level installations are supported, and either one can be used for running the |
| 10 tests. Currently the only platform it supports is Windows. | 10 tests. Currently the only platform it supports is Windows. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 import os | 13 import os |
| 14 import sys | 14 import sys |
| 15 import unittest | 15 import unittest |
| 16 import urllib | 16 import urllib |
| 17 | 17 |
| 18 import chrome_installer_win | 18 import chrome_installer_win |
| 19 | 19 |
| 20 _DIRECTORY = os.path.dirname(os.path.abspath(__file__)) | 20 _DIRECTORY = os.path.dirname(os.path.abspath(__file__)) |
| 21 sys.path.append(os.path.join(_DIRECTORY, os.path.pardir, os.path.pardir, | 21 sys.path.append(os.path.join(_DIRECTORY, os.path.pardir, os.path.pardir, |
| 22 os.path.pardir, 'third_party', 'webdriver', | 22 os.path.pardir, 'third_party', 'webdriver', |
| 23 'pylib')) | 23 'pylib')) |
| 24 sys.path.append(os.path.join(_DIRECTORY, os.path.pardir, 'pylib')) | 24 sys.path.append(os.path.join(_DIRECTORY, os.path.pardir, os.path.pardir, |
| 25 os.path.pardir, 'build', 'util', 'lib')) |
| 25 | 26 |
| 26 # This import should go after sys.path is set appropriately. | 27 # This import should go after sys.path is set appropriately. |
| 27 from chrome import Chrome | 28 from chrome import Chrome |
| 28 from selenium import webdriver | 29 from selenium import webdriver |
| 29 import selenium.webdriver.chrome.service as service | 30 import selenium.webdriver.chrome.service as service |
| 30 from selenium.webdriver.chrome.service import WebDriverException | 31 from selenium.webdriver.chrome.service import WebDriverException |
| 31 | 32 |
| 32 from common import util | 33 from common import util |
| 33 | 34 |
| 34 | 35 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 builds = list(frozenset(builds)) | 198 builds = list(frozenset(builds)) |
| 198 for build in builds: | 199 for build in builds: |
| 199 url = '%s%s/%s/mini_installer.exe' % (base_url, build, system) | 200 url = '%s%s/%s/mini_installer.exe' % (base_url, build, system) |
| 200 installer_path = os.path.join(tempdir, 'mini_installer_%s.exe' % build) | 201 installer_path = os.path.join(tempdir, 'mini_installer_%s.exe' % build) |
| 201 InstallTest._installer_paths[build] = installer_path | 202 InstallTest._installer_paths[build] = installer_path |
| 202 InstallTest._Download(url, installer_path) | 203 InstallTest._Download(url, installer_path) |
| 203 InstallTest._chrome_driver = os.path.join(tempdir, 'chromedriver.exe') | 204 InstallTest._chrome_driver = os.path.join(tempdir, 'chromedriver.exe') |
| 204 url = '%s%s/%s/%s/chromedriver.exe' % (base_url, build, system, | 205 url = '%s%s/%s/%s/chromedriver.exe' % (base_url, build, system, |
| 205 'chrome-win32.test') | 206 'chrome-win32.test') |
| 206 InstallTest._Download(url, InstallTest._chrome_driver) | 207 InstallTest._Download(url, InstallTest._chrome_driver) |
| OLD | NEW |