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 server side test to check no EDID on external display.""" 6 7 import logging 8 9 from autotest_lib.client.bin import utils 10 from autotest_lib.client.common_lib import error 11 from autotest_lib.client.cros.chameleon import chameleon_port_finder 12 from autotest_lib.client.cros.chameleon import chameleon_screen_test 13 from autotest_lib.client.cros.chameleon import edid 14 from autotest_lib.server import test 15 from autotest_lib.server.cros.multimedia import remote_facade_factory 16 17 18 class display_NoEdid(test.test): 19 """Server side test to check no EDID on external display. 20 21 This test talks to a Chameleon board and a DUT to set up, run, and verify 22 the case that no EDID on the external display. 23 """ 24 version = 1 25 26 STANDARD_MODE_RESOLUTIONS = [(1024, 768), (1024, 720), (800, 600)] 27 28 def run_once(self, host, test_mirrored=False): 29 factory = remote_facade_factory.RemoteFacadeFactory(host) 30 display_facade = factory.create_display_facade() 31 chameleon_board = host.chameleon 32 33 chameleon_board.reset() 34 finder = chameleon_port_finder.ChameleonVideoInputFinder( 35 chameleon_board, display_facade) 36 37 errors = [] 38 for chameleon_port in finder.iterate_all_ports(): 39 screen_test = chameleon_screen_test.ChameleonScreenTest( 40 chameleon_port, display_facade, self.outputdir) 41 42 with chameleon_port.use_edid(edid.NO_EDID): 43 connector_name = utils.wait_for_value_changed( 44 display_facade.get_external_connector_name, 45 old_value=False) 46 if not connector_name: 47 error_message = 'Failed to detect display without an EDID' 48 logging.error(error_message) 49 errors.append(error_message) 50 continue 51 52 logging.info('Set mirrored: %s', test_mirrored) 53 display_facade.set_mirrored(test_mirrored) 54 55 resolution = display_facade.get_external_resolution() 56 if resolution not in self.STANDARD_MODE_RESOLUTIONS: 57 error_message = ('Switched to a non-standard mode: %r' % 58 resolution) 59 logging.error(error_message) 60 errors.append(error_message) 61 continue 62 63 screen_test.test_screen_with_image( 64 resolution, test_mirrored, errors) 65 66 if errors: 67 raise error.TestFail('; '.join(set(errors))) 68