1# Copyright (c) 2018 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
5from autotest_lib.client.bin import test
6from autotest_lib.client.common_lib import error
7from autotest_lib.client.common_lib.cros import chrome
8from autotest_lib.client.cros import constants as cros_constants
9from autotest_lib.client.cros.multimedia import local_facade_factory
10
11
12class display_DisplayContainEdid(test.test):
13    """
14    Verifies that display information returned from Chrome OS specific
15    chrome.system.display API contain EDID information.
16    """
17    version = 1
18
19    def run_once(self):
20        with chrome.Chrome(
21                extension_paths = [cros_constants.DISPLAY_TEST_EXTENSION],
22                autotest_ext=True) as cr:
23            display_facade = local_facade_factory.LocalFacadeFactory(
24                cr).create_display_facade()
25
26            displays = display_facade.get_display_info()
27
28            if len(displays) == 0:
29                raise error.TestError('No displays connected!')
30
31            edid = displays[0].edid
32
33            no_manufacturer = edid.manufacturer_id == None
34            no_year = edid.year_of_manufacture == None
35            no_product = edid.product_id == None
36
37            if no_manufacturer or no_year or no_product:
38                raise error.TestError(
39                    'Incorrect edid, manufacturer: {}, year: {}, product: {}'.format(
40                        edid.manufacturer_id,
41                        edid.year_of_manufacture,
42                        edid.product_id))
43