summaryrefslogtreecommitdiffstats
path: root/chrome/test/chromeos
diff options
context:
space:
mode:
authornirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 00:08:15 +0000
committernirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-23 00:08:15 +0000
commitbb9e97c4b46c99ac40163a3eeff357abc9679253 (patch)
treeb1feec4190c2d53eb746e39b1a129a8ce1085a3e /chrome/test/chromeos
parent06e780c4f6bead69d7a3e887e8796b7ffb701a2d (diff)
downloadchromium_src-bb9e97c4b46c99ac40163a3eeff357abc9679253.zip
chromium_src-bb9e97c4b46c99ac40163a3eeff357abc9679253.tar.gz
chromium_src-bb9e97c4b46c99ac40163a3eeff357abc9679253.tar.bz2
Integrate PyAuto tests with autotest to run them on chromeos.
This follows the pattern used by other chrome ui tests (desktopui_UITest, desktopui_BrowserTests). Tests are run as user chronos (not as root) and drive chrome with a clean profile dir per test. BUG=crosbug.com/4938, crosbug.com/1504 TEST=sh run_remote_tests.sh --remote=<remote> desktopui_PyAutoFunctionalTests Review URL: http://codereview.chromium.org/3412026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chromeos')
-rw-r--r--chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/control19
-rw-r--r--chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py47
2 files changed, 66 insertions, 0 deletions
diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/control b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/control
new file mode 100644
index 0000000..30eb89a
--- /dev/null
+++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/control
@@ -0,0 +1,19 @@
+# Copyright (c) 2010 The Chromium OS 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_PyAutoFunctionalTests"
+PURPOSE = "PyAuto based chrome functional tests."
+CRITERIA = "This test will fail if running Chrome returns a command error."
+TIME = "LONG"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "desktopui"
+TEST_TYPE = "client"
+
+DOC = """
+This is a wrapper test for Chrome pyauto-based functional tests.
+http://dev.chromium.org/developers/testing/pyauto
+"""
+
+job.run_test('desktopui_PyAutoFunctionalTests')
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
new file mode 100644
index 0000000..8cf66a8
--- /dev/null
+++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
@@ -0,0 +1,47 @@
+# Copyright (c) 2010 The Chromium OS 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 logging, os, shutil, tempfile, utils
+from autotest_lib.client.bin import test
+from autotest_lib.client.common_lib import error, site_ui
+
+
+class desktopui_PyAutoFunctionalTests(test.test):
+ """Wrapper for running Chrome's PyAuto-based functional tests."""
+ version = 1
+ home_dir = None
+
+ def setup(self):
+ self.job.setup_dep(['chrome_test']) # to package chrome/test/data
+
+ def run_once(self):
+ dep = 'chrome_test'
+ dep_dir = os.path.join(self.autodir, 'deps', dep)
+ self.job.install_pkg(dep, 'dep', dep_dir)
+
+ cr_source_dir = '%s/test_src' % dep_dir
+ test_binary_dir = '%s/test_src/out/Release' % dep_dir
+ pyauto_script = '%s/test_src/chrome/test/functional/' \
+ 'pyauto_functional.py' % dep_dir
+ self.home_dir = tempfile.mkdtemp()
+
+ try:
+ setup_cmd = '%s/%s' % (test_binary_dir,
+ 'setup_test_links.sh')
+ utils.system(setup_cmd)
+
+ cmd = 'python %s' % pyauto_script
+ cmd = 'HOME=%s CR_SOURCE_ROOT=%s %s' % (self.home_dir,
+ cr_source_dir,
+ site_ui.xcommand_as(cmd))
+ logging.info("Running %s" % cmd)
+ utils.system(cmd)
+ except error.CmdError, e:
+ logging.debug(e)
+ raise error.TestFail('%s failed!' % pyauto_script)
+
+ def cleanup(self):
+ if self.home_dir:
+ shutil.rmtree(self.home_dir, ignore_errors=True)
+ test.test.cleanup(self)