diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-23 21:51:20 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-23 21:51:20 +0000 |
commit | 80ee86c9d233ea5ae06615d71bbb0db3440d434c (patch) | |
tree | 53f99a088fa632528b9aa52301968dfc1c42bf38 /chrome/test/chromeos | |
parent | e6651eeb40b684a72ee104313cf00e39f3156d70 (diff) | |
download | chromium_src-80ee86c9d233ea5ae06615d71bbb0db3440d434c.zip chromium_src-80ee86c9d233ea5ae06615d71bbb0db3440d434c.tar.gz chromium_src-80ee86c9d233ea5ae06615d71bbb0db3440d434c.tar.bz2 |
Use named automation interface to control the primary chrome to run pyauto-based chrome tests on ChromeOS.
This CL includes:
- enable_testing.py -- sends dbus call to session_manager to enable testing interface
- pyauto.py -- integration of named automation interface with PyAuto
- desktopui_PyAutoFunctionalTests.py -- setup to use named automation interface. Uses a suid-root binary (as discussed with cmasone) to dbus mesg to session_manager
- PYAUTO_TESTS -- a new suite called "PRIMARY_CHROME" which currently consists of a basic hello world test that controls the primary chrome
- chromeos_basic.py -- a basic test
All plumbing necessary to integrate the named automation interface with autotest and pyauto is included.
It's designed such that it's easy to work directly on a chromeos device while adding/editing a pyauto test, without having to run via autotest every time. Also, the existing pyauto tests (about 200 of them) will begin controlling the primary chrome.
Can be run with run_remote_tests.sh as:
$ ./run_remote_tests.sh --remote <IP> desktopui_PyAutoFunctionalTests
BUG=
TEST=
Review URL: http://codereview.chromium.org/6410134
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75797 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chromeos')
-rw-r--r-- | chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py | 55 |
1 files changed, 49 insertions, 6 deletions
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 8c495e0..d5f4ad8 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) |