• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 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
5"""This is a client-side test to check the Chameleon connection."""
6
7import logging
8
9from autotest_lib.client.bin import test
10from autotest_lib.client.common_lib import error
11from autotest_lib.client.common_lib.cros import chrome
12from autotest_lib.client.cros import constants
13from autotest_lib.client.cros.chameleon import chameleon
14from autotest_lib.client.cros.chameleon import chameleon_port_finder
15from autotest_lib.client.cros.multimedia import local_facade_factory
16
17
18class display_ClientChameleonConnection(test.test):
19    """Chameleon connection client test.
20
21    This test talks to a Chameleon board from DUT. Try to plug the Chameleon
22    ports and see if DUT detects them.
23    """
24    version = 1
25
26    def run_once(self, host, args):
27        ext_paths = [constants.MULTIMEDIA_TEST_EXTENSION]
28        with chrome.Chrome(extension_paths=ext_paths, autotest_ext=True) as cr:
29            factory = local_facade_factory.LocalFacadeFactory(cr)
30            display_facade = factory.create_display_facade()
31
32            chameleon_board = chameleon.create_chameleon_board(host.hostname,
33                                                               args)
34            chameleon_board.setup_and_reset(self.outputdir)
35            finder = chameleon_port_finder.ChameleonVideoInputFinder(
36                    chameleon_board, display_facade)
37            ports = finder.find_all_ports()
38
39            connected_ports = ports.connected
40            dut_failed_ports = ports.failed
41
42            msg = str(finder)
43            logging.debug(msg)
44
45            if dut_failed_ports or not connected_ports:
46                raise error.TestFail(msg)
47