• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import logging
6import time
7
8from autotest_lib.client.common_lib.cros import chrome
9from autotest_lib.client.cros.a11y import a11y_test_base
10
11
12class accessibility_Sanity(a11y_test_base.a11y_test_base):
13    """Enables then disables all a11y features via accessibilityFeatures API."""
14    version = 1
15
16    # Features that do not have their own separate tests
17    _FEATURE_LIST = [
18        'largeCursor',
19        'stickyKeys',
20        'highContrast',
21        'screenMagnifier',
22        'autoclick',
23        'virtualKeyboard'
24    ]
25
26
27    def _check_chromevox(self):
28        """Run ChromeVox specific checks.
29
30        Check the reported state of ChromeVox before/after enable and disable.
31
32        """
33        # ChromeVox is initially off.
34        self._confirm_chromevox_state(False)
35
36        # Turn ChromeVox on and check that all the pieces work.
37        self._toggle_chromevox()
38        self._confirm_chromevox_state(True)
39
40        # Turn ChromeVox off.
41        self._toggle_chromevox()
42        self._confirm_chromevox_state(False)
43
44
45    def run_once(self):
46        """Entry point of this test."""
47        extension_path = self._get_extension_path()
48
49        with chrome.Chrome(extension_paths=[extension_path]) as cr:
50            self._extension = cr.get_extension(extension_path)
51
52            # Check specific features.
53            self._check_chromevox()
54
55            # Enable then disable all other accessibility features.
56            for value in [True, False]:
57                for feature in self._FEATURE_LIST:
58                    logging.info('Setting %s to %s.', feature, value)
59                    self._set_feature(feature, value)
60                    time.sleep(1)
61