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

Unified Diff: chromeos/display/output_util_unittest.cc

Issue 15368003: Changes how to compute the id of a display. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 7 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
« no previous file with comments | « chromeos/display/output_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/display/output_util_unittest.cc
diff --git a/chromeos/display/output_util_unittest.cc b/chromeos/display/output_util_unittest.cc
index cd724aee9f450d9a316ce68938d54d8c083d10f3..84a0685ab078bd5e06f49f7a4078dcc21a1f69f5 100644
--- a/chromeos/display/output_util_unittest.cc
+++ b/chromeos/display/output_util_unittest.cc
@@ -75,52 +75,65 @@ const unsigned char kMisdetecedDisplay[] =
}
+const unsigned char kLP2565A[] =
+ "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\x22\xF0\x76\x26\x01\x01\x01\x01"
+ "\x02\x12\x01\x03\x80\x34\x21\x78\xEE\xEF\x95\xA3\x54\x4C\x9B\x26"
+ "\x0F\x50\x54\xA5\x6B\x80\x81\x40\x81\x80\x81\x99\x71\x00\xA9\x00"
+ "\xA9\x40\xB3\x00\xD1\x00\x28\x3C\x80\xA0\x70\xB0\x23\x40\x30\x20"
+ "\x36\x00\x07\x44\x21\x00\x00\x1A\x00\x00\x00\xFD\x00\x30\x55\x1E"
+ "\x5E\x11\x00\x0A\x20\x20\x20\x20\x20\x20\x00\x00\x00\xFC\x00\x48"
+ "\x50\x20\x4C\x50\x32\x34\x36\x35\x0A\x20\x20\x20\x00\x00\x00\xFF"
+ "\x00\x43\x4E\x4B\x38\x30\x32\x30\x34\x48\x4D\x0A\x20\x20\x00\xA4";
+
+const unsigned char kLP2565B[] =
+ "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\x22\xF0\x75\x26\x01\x01\x01\x01"
+ "\x02\x12\x01\x03\x6E\x34\x21\x78\xEE\xEF\x95\xA3\x54\x4C\x9B\x26"
+ "\x0F\x50\x54\xA5\x6B\x80\x81\x40\x71\x00\xA9\x00\xA9\x40\xA9\x4F"
+ "\xB3\x00\xD1\xC0\xD1\x00\x28\x3C\x80\xA0\x70\xB0\x23\x40\x30\x20"
+ "\x36\x00\x07\x44\x21\x00\x00\x1A\x00\x00\x00\xFD\x00\x30\x55\x1E"
+ "\x5E\x15\x00\x0A\x20\x20\x20\x20\x20\x20\x00\x00\x00\xFC\x00\x48"
+ "\x50\x20\x4C\x50\x32\x34\x36\x35\x0A\x20\x20\x20\x00\x00\x00\xFF"
+ "\x00\x43\x4E\x4B\x38\x30\x32\x30\x34\x48\x4D\x0A\x20\x20\x00\x45";
+
TEST(OutputUtilTest, ParseEDID) {
uint16 manufacturer_id = 0;
- uint16 product_code = 0;
std::string human_readable_name;
EXPECT_TRUE(ParseOutputDeviceData(
kNormalDisplay, charsize(kNormalDisplay),
- &manufacturer_id, &product_code, &human_readable_name));
+ &manufacturer_id, &human_readable_name));
EXPECT_EQ(0x22f0u, manufacturer_id);
- EXPECT_EQ(0x286cu, product_code);
EXPECT_EQ("HP ZR30w", human_readable_name);
manufacturer_id = 0;
- product_code = 0;
human_readable_name.clear();
EXPECT_TRUE(ParseOutputDeviceData(
kInternalDisplay, charsize(kInternalDisplay),
- &manufacturer_id, &product_code, NULL));
+ &manufacturer_id, NULL));
EXPECT_EQ(0x4ca3u, manufacturer_id);
- EXPECT_EQ(0x3142u, product_code);
EXPECT_EQ("", human_readable_name);
// Internal display doesn't have name.
EXPECT_FALSE(ParseOutputDeviceData(
kInternalDisplay, charsize(kInternalDisplay),
- NULL, NULL, &human_readable_name));
+ NULL, &human_readable_name));
manufacturer_id = 0;
- product_code = 0;
human_readable_name.clear();
EXPECT_TRUE(ParseOutputDeviceData(
kOverscanDisplay, charsize(kOverscanDisplay),
- &manufacturer_id, &product_code, &human_readable_name));
+ &manufacturer_id, &human_readable_name));
EXPECT_EQ(0x4c2du, manufacturer_id);
- EXPECT_EQ(0x08feu, product_code);
EXPECT_EQ("SAMSUNG", human_readable_name);
}
TEST(OutputUtilTest, ParseBrokenEDID) {
uint16 manufacturer_id = 0;
- uint16 product_code = 0;
std::string human_readable_name;
// length == 0
EXPECT_FALSE(ParseOutputDeviceData(
kNormalDisplay, 0,
- &manufacturer_id, &product_code, &human_readable_name));
+ &manufacturer_id, &human_readable_name));
// name is broken. Copying kNormalDisplay and substitute its name data by
// some control code.
@@ -133,17 +146,15 @@ TEST(OutputUtilTest, ParseBrokenEDID) {
EXPECT_FALSE(ParseOutputDeviceData(
reinterpret_cast<const unsigned char*>(display_data.data()),
display_data.size(),
- &manufacturer_id, &product_code, &human_readable_name));
+ &manufacturer_id, &human_readable_name));
// If |human_readable_name| isn't specified, it skips parsing the name.
manufacturer_id = 0;
- product_code = 0;
EXPECT_TRUE(ParseOutputDeviceData(
reinterpret_cast<const unsigned char*>(display_data.data()),
display_data.size(),
- &manufacturer_id, &product_code, NULL));
+ &manufacturer_id, NULL));
EXPECT_EQ(0x22f0u, manufacturer_id);
- EXPECT_EQ(0x286cu, product_code);
}
TEST(OutputUtilTest, ParseOverscanFlag) {
@@ -205,4 +216,27 @@ TEST(OutputUtilTest, IsInternalOutputName) {
EXPECT_FALSE(IsInternalOutputName("eD"));
}
+TEST(OutputUtilTest, GetDisplayId) {
+ // EDID of kLP2565A and B are slightly different but actually the same device.
+ int64 id1 = -1;
+ int64 id2 = -1;
+ EXPECT_TRUE(GetDisplayIdFromEDID(kLP2565A, charsize(kLP2565A), 0, &id1));
+ EXPECT_TRUE(GetDisplayIdFromEDID(kLP2565B, charsize(kLP2565B), 0, &id2));
+ EXPECT_EQ(id1, id2);
+ EXPECT_NE(-1, id1);
+}
+
+TEST(OutputUtilTest, GetDisplayIdFromInternal) {
+ int64 id = -1;
+ EXPECT_TRUE(GetDisplayIdFromEDID(
+ kInternalDisplay, charsize(kInternalDisplay), 0, &id));
+ EXPECT_NE(-1, id);
+}
+
+TEST(OutputUtilTest, GetDisplayIdFailure) {
+ int64 id = -1;
+ EXPECT_FALSE(GetDisplayIdFromEDID(NULL, 0, 0, &id));
+ EXPECT_EQ(-1, id);
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/display/output_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698