diff options
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) |