diff options
-rw-r--r-- | chrome/test/install_test/install_test.py | 12 | ||||
-rwxr-xr-x | chrome/test/install_test/run_install_tests.py | 13 |
2 files changed, 16 insertions, 9 deletions
diff --git a/chrome/test/install_test/install_test.py b/chrome/test/install_test/install_test.py index 6c3ef3e..50432a3 100644 --- a/chrome/test/install_test/install_test.py +++ b/chrome/test/install_test/install_test.py @@ -99,6 +99,7 @@ class InstallTest(unittest.TestCase): _installer_paths = {} _chrome_driver = '' _installer_options = [] + _install_type = chrome_installer_win.InstallationType.USER def __init__(self, methodName='runTest'): unittest.TestCase.__init__(self, methodName) @@ -130,8 +131,13 @@ class InstallTest(unittest.TestCase): """ self._driver = webdriver.Remote(self._service.service_url, caps) - def Install(self, build): - """Helper method that installs the specified Chrome build.""" + def Install(self, build, master_pref=None): + """Helper method that installs the specified Chrome build. + + Args: + build: Chrome version number that will be used for installation. + master_pref: Location of the master preferences file. + """ if self._driver: try: self._driver.quit() @@ -141,6 +147,8 @@ class InstallTest(unittest.TestCase): options.extend(self._installer_options) if self._install_type == chrome_installer_win.InstallationType.SYSTEM: options.append('--system-level') + if master_pref: + options.append('--installerdata="%s"' % master_pref) self._installation = chrome_installer_win.Install( self._installer_paths[build], self._install_type, diff --git a/chrome/test/install_test/run_install_tests.py b/chrome/test/install_test/run_install_tests.py index 8a30d1c..7fe4c25 100755 --- a/chrome/test/install_test/run_install_tests.py +++ b/chrome/test/install_test/run_install_tests.py @@ -66,13 +66,8 @@ class Main(object): help='Filter that specifies the test or testsuite to run.') self._opts, self._args = parser.parse_args() self._ValidateArgs() - if(self._opts.install_type == 'system' or - self._opts.install_type == 'user'): - install_type = ({ - 'system' : chrome_installer_win.InstallationType.SYSTEM, - 'user' : chrome_installer_win.InstallationType.USER}).get( - self._opts.install_type) - InstallTest.SetInstallType(install_type) + if self._opts.install_type == 'system': + InstallTest.SetInstallType(chrome_installer_win.InstallationType.SYSTEM) update_builds = (self._opts.update_builds.split(',') if self._opts.update_builds else []) options = self._opts.options.split(',') if self._opts.options else [] @@ -189,6 +184,10 @@ class Main(object): all_tests = unittest.defaultTestLoader.loadTestsFromModule(sample_updater) tests = self._FilterTestSuite(all_tests, self._opts.filter) result = pyauto_utils.GTestTextTestRunner(verbosity=1).run(tests) + # Run tests again if installation type is 'both'(i.e., user and system). + if self._opts.install_type == 'both': + InstallTest.SetInstallType(chrome_installer_win.InstallationType.SYSTEM) + result = pyauto_utils.GTestTextTestRunner(verbosity=1).run(tests) del(tests) if not result.wasSuccessful(): print >>sys.stderr, ('Not all tests were successful.') |