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

Unified Diff: chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py

Issue 6410134: Use named automation interface to control primary chrome on ChromeOS (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: nit Created 9 years, 10 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 | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698