| Index: chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
|
| diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
|
| index 8c495e0979b4eb24e682d693b7fd8ea49192e155..d5f4ad8bfd668dacd36fe447d9097b9f95c8e8f0 100644
|
| --- a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
|
| +++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
|
| @@ -3,15 +3,58 @@
|
| # found in the LICENSE file.
|
|
|
| import os
|
| -from autotest_lib.client.cros import chrome_test
|
| +import shutil
|
| +import subprocess
|
| +
|
| +from autotest_lib.client.bin import utils
|
| +from autotest_lib.client.cros import constants, chrome_test, cros_ui
|
| +
|
|
|
| class desktopui_PyAutoFunctionalTests(chrome_test.ChromeTestBase):
|
| - """Wrapper for running Chrome's PyAuto-based functional tests."""
|
| + """Wrapper for running Chrome's PyAuto-based functional tests.
|
| +
|
| + Performs all setup and fires of PRIMARY_CHROME suite.
|
| + """
|
| version = 1
|
|
|
| + def initialize(self):
|
| + chrome_test.ChromeTestBase.initialize(self)
|
| + assert os.geteuid() == 0, 'Need superuser privileges'
|
| +
|
| + deps_dir = os.path.join(self.autodir, 'deps')
|
| + subprocess.check_call(['chown', '-R', 'chronos', self.cr_source_dir])
|
| +
|
| + # Setup /tmp/disable_chrome_restart
|
| + if not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
|
| + open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
|
| +
|
| + # Setup suid python binary which can enable chrome testing interface
|
| + suid_python = os.path.join(self.test_binary_dir, 'python')
|
| + py_path = subprocess.Popen(['which', 'python'],
|
| + stdout=subprocess.PIPE).communicate()[0]
|
| + py_path = py_path.strip()
|
| + assert os.path.exists(py_path), 'Could not find python'
|
| + if os.path.islink(py_path):
|
| + linkto = os.readlink(py_path)
|
| + py_path = os.path.join(os.path.dirname(py_path), linkto)
|
| + shutil.copy(py_path, suid_python)
|
| + os.chown(suid_python, 0, 0)
|
| + os.chmod(suid_python, 04755)
|
| +
|
| def run_once(self):
|
| + # Enable chrome testing interface and Login
|
| deps_dir = os.path.join(self.autodir, 'deps')
|
| - self.test_binary_dir = ''
|
| - pyauto_script = '%s/chrome_test/test_src/chrome/test/functional/' \
|
| - 'pyauto_functional.py' % deps_dir
|
| - self.run_chrome_test(pyauto_script)
|
| + pyautolib_dir = os.path.join(self.cr_source_dir,
|
| + 'chrome', 'test', 'pyautolib')
|
| + login_cmd = cros_ui.xcommand_as(
|
| + 'python %s chromeos_utils.ChromeosUtils.LoginToDefaultAccount '
|
| + '-v --no-http-server' %
|
| + os.path.join(pyautolib_dir, 'chromeos', 'chromeos_utils.py'))
|
| + utils.system(login_cmd)
|
| +
|
| + # Run pyauto tests in "PRIMARY_CHROME" suite
|
| + functional_cmd = cros_ui.xcommand_as(
|
| + '%s/chrome_test/test_src/chrome/test/functional/' \
|
| + 'pyauto_functional.py --suite=PRIMARY_CHROME ' \
|
| + '-v --no-http-server' % deps_dir)
|
| + utils.system(functional_cmd)
|
|
|