Autotest: add new touch_HasInput test.
Recently, crbug.com/530292 broke some select rambi touchpads. We
have automated tests which caught the problem, but not on all
boards. Currently, gesture tests can only tell if a touchpad/
touchscreen is supposed to be present based on which devices are
supported.
Add a new test that will instead use pre-existing lab labels which
are automatically applied to new lab devices. This test can run on
all platforms, rather than just those that have gesture files.
BUG=chromium:532274
TEST=ran on several devices, including all touchpad/touchscreen
combinations
Change-Id: I382ad02e52d83d5c6c52c0fda80561ea6235644f
Reviewed-on: https://chromium-review.googlesource.com/299965
Commit-Ready: Katherine Threlkeld <[email protected]>
Tested-by: Katherine Threlkeld <[email protected]>
Reviewed-by: Kalin Stoyanov <[email protected]>
diff --git a/client/site_tests/touch_HasInput/control.touchpad b/client/site_tests/touch_HasInput/control.touchpad
new file mode 100644
index 0000000..0df0136
--- /dev/null
+++ b/client/site_tests/touch_HasInput/control.touchpad
@@ -0,0 +1,24 @@
+# Copyright 2015 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 = "kathrelkeld"
+NAME = "touch_HasInput.touchpad"
+PURPOSE = "Check whether a touchpad is present as an input source."
+CRITERIA = """
+This test will fail if the device does not have touchpad input.
+"""
+ATTRIBUTES = "suite:bvt-perbuild, suite:touch"
+SUITE = "bvt-perbuild,touch"
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "touch"
+TEST_TYPE = "client"
+DEPENDENCIES = "touchpad"
+
+DOC = """
+If there is no /dev/input/event* that is a touchpad, test will fail. Test
+should only be run on devices with a touchpad.
+"""
+
+job.run_test('touch_HasInput', input_type='touchpad')
diff --git a/client/site_tests/touch_HasInput/control.touchscreen b/client/site_tests/touch_HasInput/control.touchscreen
new file mode 100644
index 0000000..c4b7114
--- /dev/null
+++ b/client/site_tests/touch_HasInput/control.touchscreen
@@ -0,0 +1,24 @@
+# Copyright 2015 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 = "kathrelkeld"
+NAME = "touch_HasInput.touchscreen"
+PURPOSE = "Check whether a touchscreen is present as an input source."
+CRITERIA = """
+This test will fail if the device does not have touchpad input.
+"""
+ATTRIBUTES = "suite:bvt-perbuild, suite:touch"
+SUITE = "bvt-perbuild,touch"
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "touch"
+TEST_TYPE = "client"
+DEPENDENCIES = "touchscreen"
+
+DOC = """
+If there is no /dev/input/event* that is a touchscreen, test will fail. Test
+should only be run on devices with a touchscreen.
+"""
+
+job.run_test('touch_HasInput', input_type='touchscreen')
diff --git a/client/site_tests/touch_HasInput/touch_HasInput.py b/client/site_tests/touch_HasInput/touch_HasInput.py
new file mode 100644
index 0000000..daeb0b3
--- /dev/null
+++ b/client/site_tests/touch_HasInput/touch_HasInput.py
@@ -0,0 +1,24 @@
+# Copyright 2015 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.
+
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.cros import touch_playback_test_base
+
+
+class touch_HasInput(touch_playback_test_base.touch_playback_test_base):
+ """Check that device has the input type specified."""
+ version = 1
+
+ def run_once(self, input_type=''):
+ """Entry point of this test.
+
+ @param input_type: a string representing the required input type. See
+ the input_playback class for possible types.
+
+ """
+ if not input_type:
+ raise error.TestError('Please supply an input type!')
+
+ if not self.player.has(input_type):
+ raise error.TestFail('Device does not have a %s!' % input_type)