1 // Copyright 2015 The Chromium 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.
5 #include "ui/ozone/common/display_util.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
9 typedef testing::Test DisplayUtilTest
;
15 const unsigned char kTestEDID
[] =
16 "\x00\xff\xff\xff\xff\xff\xff\x00\x22\xf0\x6c\x28\x01\x01\x01\x01"
17 "\x02\x16\x01\x04\xb5\x40\x28\x78\xe2\x8d\x85\xad\x4f\x35\xb1\x25"
18 "\x0e\x50\x54\x00\x00\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
19 "\x01\x01\x01\x01\x01\x01\xe2\x68\x00\xa0\xa0\x40\x2e\x60\x30\x20"
20 "\x36\x00\x81\x90\x21\x00\x00\x1a\xbc\x1b\x00\xa0\x50\x20\x17\x30"
21 "\x30\x20\x36\x00\x81\x90\x21\x00\x00\x1a\x00\x00\x00\xfc\x00\x48"
22 "\x50\x20\x5a\x52\x33\x30\x77\x0a\x20\x20\x20\x20\x00\x00\x00\xff"
23 "\x00\x43\x4e\x34\x32\x30\x32\x31\x33\x37\x51\x0a\x20\x20\x00\x71";
27 TEST_F(DisplayUtilTest
, BasicEDID
) {
28 DisplaySnapshot_Params params
;
29 // -1 to skip NULL byte.
30 std::vector
<uint8_t> edid(kTestEDID
, kTestEDID
+ arraysize(kTestEDID
) - 1);
33 EXPECT_TRUE(CreateSnapshotFromEDID(true, edid
, ¶ms
));
34 EXPECT_EQ("HP ZR30w", params
.display_name
);
35 EXPECT_EQ(1u, params
.modes
.size());
36 EXPECT_TRUE(params
.has_current_mode
);
37 EXPECT_EQ("2560x1600", params
.current_mode
.size
.ToString());
38 EXPECT_EQ("641x400", params
.physical_size
.ToString());
39 EXPECT_EQ(DISPLAY_CONNECTION_TYPE_INTERNAL
, params
.type
);
42 params
= DisplaySnapshot_Params();
45 EXPECT_TRUE(CreateSnapshotFromEDID(false, edid
, ¶ms
));
46 EXPECT_EQ("HP ZR30w", params
.display_name
);
47 EXPECT_EQ(1u, params
.modes
.size());
48 EXPECT_TRUE(params
.has_current_mode
);
49 EXPECT_EQ("2560x1600", params
.current_mode
.size
.ToString());
50 EXPECT_EQ("641x400", params
.physical_size
.ToString());
51 EXPECT_EQ(DISPLAY_CONNECTION_TYPE_VGA
, params
.type
);
54 TEST_F(DisplayUtilTest
, EmptyEDID
) {
55 DisplaySnapshot_Params params
;
56 std::vector
<uint8_t> edid
;
58 EXPECT_FALSE(CreateSnapshotFromEDID(true, std::vector
<uint8_t>(), ¶ms
));