diff options
author | rohitbm@google.com <rohitbm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-16 02:15:47 +0000 |
---|---|---|
committer | rohitbm@google.com <rohitbm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-16 02:15:47 +0000 |
commit | 46c2abdf9e8e04d8cd51df24f7b1bcb4fe28bfbe (patch) | |
tree | 3d554c07c925d7d0dfa9e4989d96f9d445651cc0 /chrome/test/chromeos/autotest | |
parent | 0e1fbd2c6e0dcfdcde749a210b0ef3e9cf78acd8 (diff) | |
download | chromium_src-46c2abdf9e8e04d8cd51df24f7b1bcb4fe28bfbe.zip chromium_src-46c2abdf9e8e04d8cd51df24f7b1bcb4fe28bfbe.tar.gz chromium_src-46c2abdf9e8e04d8cd51df24f7b1bcb4fe28bfbe.tar.bz2 |
Autotest for ChromeOS volume tests
Review URL: http://codereview.chromium.org/7925003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chromeos/autotest')
2 files changed, 84 insertions, 0 deletions
diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoVolumeTests/control b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoVolumeTests/control new file mode 100644 index 0000000..7d9143a --- /dev/null +++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoVolumeTests/control @@ -0,0 +1,19 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +AUTHOR = "Chrome OS Team" +NAME = "desktopui_PyAutoVolumeTests" +PURPOSE = "PyAuto based chromeos volume tests." +CRITERIA = "This test will fail if volume settings are not preserved." +TIME = "LONG" +TEST_CATEGORY = "Functional" +TEST_CLASS = "desktopui" +TEST_TYPE = "client" + +DOC = """ +This is a wrapper test for Chrome pyauto-based volume tests. +http://dev.chromium.org/developers/testing/pyauto +""" + +job.run_test('desktopui_PyAutoVolumeTests') diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoVolumeTests/desktopui_PyAutoVolumeTests.py b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoVolumeTests/desktopui_PyAutoVolumeTests.py new file mode 100644 index 0000000..a69099c --- /dev/null +++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoVolumeTests/desktopui_PyAutoVolumeTests.py @@ -0,0 +1,65 @@ +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import pwd +import shutil +import subprocess + +from autotest_lib.client.bin import utils +from autotest_lib.client.cros import constants, chrome_test, cros_ui, login + + +class desktopui_PyAutoVolumeTests(chrome_test.ChromeTestBase): + """Wrapper for running Chrome's PyAuto-based volume tests. + + Performs all setup and fires off the volume tests. + """ + version = 1 + + def initialize(self): + chrome_test.ChromeTestBase.initialize(self, + nuke_browser_norestart=False) + 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 suid python binary which can enable chrome testing interface. + suid_python = os.path.join(self.test_binary_dir, 'suid-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) + + # chronos should own the current dir. + chronos_id = pwd.getpwnam('chronos') + os.chown(os.getcwd(), chronos_id.pw_uid, chronos_id.pw_gid) + + # Allow browser restart by its babysitter (session_manager) + if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE): + os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE) + assert not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE) + + # Make sure Chrome minidumps are written locally. + minidumps_file = '/mnt/stateful_partition/etc/enable_chromium_minidumps' + if not os.path.exists(minidumps_file): + open(minidumps_file, 'w').close() + login.nuke_login_manager() + assert os.path.exists(minidumps_file) + + def run_once(self): + # Run the CHROMEOS_VOLUME pyauto tests. + deps_dir = os.path.join(self.autodir, 'deps') + functional_cmd = cros_ui.xcommand( + '%s/chrome_test/test_src/chrome/test/functional/' + 'pyauto_functional.py --suite=CHROMEOS_VOLUME --no-http-server -v' % + deps_dir) + utils.system(functional_cmd) |