Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: ui/display/util/edid_parser_unittest.cc

Issue 1151583002: Generate display product id with EDID manufacturer product code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/display/util/edid_parser_unittest.cc
diff --git a/ui/display/util/edid_parser_unittest.cc b/ui/display/util/edid_parser_unittest.cc
index 8b6033f5b898dda31f56c83c01cc06b7110288df..2e77cacf678d16d0e45ab6f182d5dc3b56f54983 100644
--- a/ui/display/util/edid_parser_unittest.cc
+++ b/ui/display/util/edid_parser_unittest.cc
@@ -152,42 +152,48 @@ TEST(EDIDParserTest, ParseBrokenOverscanData) {
TEST(EDIDParserTest, ParseEDID) {
uint16_t manufacturer_id = 0;
+ uint16_t product_code = 0;
std::string human_readable_name;
std::vector<uint8_t> edid(
kNormalDisplay, kNormalDisplay + charsize(kNormalDisplay));
gfx::Size pixel;
gfx::Size size;
- EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id,
+ EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
&human_readable_name, &pixel, &size));
EXPECT_EQ(0x22f0u, manufacturer_id);
+ EXPECT_EQ(0x286cu, product_code);
EXPECT_EQ("HP ZR30w", human_readable_name);
EXPECT_EQ("2560x1600", pixel.ToString());
EXPECT_EQ("641x400", size.ToString());
manufacturer_id = 0;
+ product_code = 0;
human_readable_name.clear();
Reset(&pixel, &size);
edid.assign(kInternalDisplay, kInternalDisplay + charsize(kInternalDisplay));
- EXPECT_TRUE(
- ParseOutputDeviceData(edid, &manufacturer_id, nullptr, &pixel, &size));
+ EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
+ nullptr, &pixel, &size));
EXPECT_EQ(0x4ca3u, manufacturer_id);
+ EXPECT_EQ(0x3142u, product_code);
EXPECT_EQ("", human_readable_name);
EXPECT_EQ("1280x800", pixel.ToString());
EXPECT_EQ("261x163", size.ToString());
// Internal display doesn't have name.
- EXPECT_TRUE(ParseOutputDeviceData(edid, nullptr, &human_readable_name, &pixel,
- &size));
+ EXPECT_TRUE(ParseOutputDeviceData(edid, nullptr, nullptr,
+ &human_readable_name, &pixel, &size));
EXPECT_TRUE(human_readable_name.empty());
manufacturer_id = 0;
+ product_code = 0;
human_readable_name.clear();
Reset(&pixel, &size);
edid.assign(kOverscanDisplay, kOverscanDisplay + charsize(kOverscanDisplay));
- EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id,
+ EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
&human_readable_name, &pixel, &size));
EXPECT_EQ(0x4c2du, manufacturer_id);
+ EXPECT_EQ(0x08feu, product_code);
EXPECT_EQ("SAMSUNG", human_readable_name);
EXPECT_EQ("1920x1080", pixel.ToString());
EXPECT_EQ("160x90", size.ToString());
@@ -195,13 +201,14 @@ TEST(EDIDParserTest, ParseEDID) {
TEST(EDIDParserTest, ParseBrokenEDID) {
uint16_t manufacturer_id = 0;
+ uint16_t product_code = 0;
std::string human_readable_name;
std::vector<uint8_t> edid;
gfx::Size dummy;
// length == 0
- EXPECT_FALSE(ParseOutputDeviceData(edid, &manufacturer_id,
+ EXPECT_FALSE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
&human_readable_name, &dummy, &dummy));
// name is broken. Copying kNormalDisplay and substitute its name data by
@@ -211,14 +218,16 @@ TEST(EDIDParserTest, ParseBrokenEDID) {
// display's name data is embedded in byte 95-107 in this specific example.
// Fix here too when the contents of kNormalDisplay is altered.
edid[97] = '\x1b';
- EXPECT_FALSE(ParseOutputDeviceData(edid, &manufacturer_id,
+ EXPECT_FALSE(ParseOutputDeviceData(edid, &manufacturer_id, nullptr,
&human_readable_name, &dummy, &dummy));
// If |human_readable_name| isn't specified, it skips parsing the name.
manufacturer_id = 0;
- EXPECT_TRUE(
- ParseOutputDeviceData(edid, &manufacturer_id, nullptr, &dummy, &dummy));
+ product_code = 0;
+ EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
+ nullptr, &dummy, &dummy));
EXPECT_EQ(0x22f0u, manufacturer_id);
+ EXPECT_EQ(0x286cu, product_code);
}
TEST(EDIDParserTest, GetDisplayId) {
@@ -232,7 +241,10 @@ TEST(EDIDParserTest, GetDisplayId) {
edid.assign(kLP2565B, kLP2565B + charsize(kLP2565B));
EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id2, &product_id2));
EXPECT_EQ(id1, id2);
- EXPECT_EQ(product_id1, product_id2);
+ // The product code in the two EDIDs varies.
+ EXPECT_NE(product_id1, product_id2);
+ EXPECT_EQ(0x22f02676, product_id1);
+ EXPECT_EQ(0x22f02675, product_id2);
EXPECT_NE(-1, id1);
EXPECT_NE(-1, product_id1);
}

Powered by Google App Engine
This is Rietveld 408576698