OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/display/output_util.h" | 5 #include "chromeos/display/output_util.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 "\x15\x13\x14\x1f\x20\x23\x0d\x7f\x07\x83\x0f\x00\x00\x67\x03\x0c" | 68 "\x15\x13\x14\x1f\x20\x23\x0d\x7f\x07\x83\x0f\x00\x00\x67\x03\x0c" |
69 "\x00\x10\x00\x38\x2d\xe3\x05\x03\x01\x02\x3a\x80\x18\x71\x38\x2d" | 69 "\x00\x10\x00\x38\x2d\xe3\x05\x03\x01\x02\x3a\x80\x18\x71\x38\x2d" |
70 "\x40\x58\x2c\x45\x00\x81\x91\x21\x00\x00\x1e\x01\x1d\x80\x18\x71" | 70 "\x40\x58\x2c\x45\x00\x81\x91\x21\x00\x00\x1e\x01\x1d\x80\x18\x71" |
71 "\x1c\x16\x20\x58\x2c\x25\x00\x81\x91\x21\x00\x00\x9e\x01\x1d\x00" | 71 "\x1c\x16\x20\x58\x2c\x25\x00\x81\x91\x21\x00\x00\x9e\x01\x1d\x00" |
72 "\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\x81\x91\x21\x00\x00\x1e\x8c" | 72 "\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\x81\x91\x21\x00\x00\x1e\x8c" |
73 "\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\x81\x91\x21\x00\x00" | 73 "\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\x81\x91\x21\x00\x00" |
74 "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x94"; | 74 "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x94"; |
75 | 75 |
76 } | 76 } |
77 | 77 |
| 78 const unsigned char kLP2565A[] = |
| 79 "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\x22\xF0\x76\x26\x01\x01\x01\x01" |
| 80 "\x02\x12\x01\x03\x80\x34\x21\x78\xEE\xEF\x95\xA3\x54\x4C\x9B\x26" |
| 81 "\x0F\x50\x54\xA5\x6B\x80\x81\x40\x81\x80\x81\x99\x71\x00\xA9\x00" |
| 82 "\xA9\x40\xB3\x00\xD1\x00\x28\x3C\x80\xA0\x70\xB0\x23\x40\x30\x20" |
| 83 "\x36\x00\x07\x44\x21\x00\x00\x1A\x00\x00\x00\xFD\x00\x30\x55\x1E" |
| 84 "\x5E\x11\x00\x0A\x20\x20\x20\x20\x20\x20\x00\x00\x00\xFC\x00\x48" |
| 85 "\x50\x20\x4C\x50\x32\x34\x36\x35\x0A\x20\x20\x20\x00\x00\x00\xFF" |
| 86 "\x00\x43\x4E\x4B\x38\x30\x32\x30\x34\x48\x4D\x0A\x20\x20\x00\xA4"; |
| 87 |
| 88 const unsigned char kLP2565B[] = |
| 89 "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00\x22\xF0\x75\x26\x01\x01\x01\x01" |
| 90 "\x02\x12\x01\x03\x6E\x34\x21\x78\xEE\xEF\x95\xA3\x54\x4C\x9B\x26" |
| 91 "\x0F\x50\x54\xA5\x6B\x80\x81\x40\x71\x00\xA9\x00\xA9\x40\xA9\x4F" |
| 92 "\xB3\x00\xD1\xC0\xD1\x00\x28\x3C\x80\xA0\x70\xB0\x23\x40\x30\x20" |
| 93 "\x36\x00\x07\x44\x21\x00\x00\x1A\x00\x00\x00\xFD\x00\x30\x55\x1E" |
| 94 "\x5E\x15\x00\x0A\x20\x20\x20\x20\x20\x20\x00\x00\x00\xFC\x00\x48" |
| 95 "\x50\x20\x4C\x50\x32\x34\x36\x35\x0A\x20\x20\x20\x00\x00\x00\xFF" |
| 96 "\x00\x43\x4E\x4B\x38\x30\x32\x30\x34\x48\x4D\x0A\x20\x20\x00\x45"; |
| 97 |
78 TEST(OutputUtilTest, ParseEDID) { | 98 TEST(OutputUtilTest, ParseEDID) { |
79 uint16 manufacturer_id = 0; | 99 uint16 manufacturer_id = 0; |
80 uint16 product_code = 0; | 100 uint16 product_code = 0; |
81 std::string human_readable_name; | 101 std::string human_readable_name; |
82 EXPECT_TRUE(ParseOutputDeviceData( | 102 EXPECT_TRUE(ParseOutputDeviceData( |
83 kNormalDisplay, charsize(kNormalDisplay), | 103 kNormalDisplay, charsize(kNormalDisplay), |
84 &manufacturer_id, &product_code, &human_readable_name)); | 104 &manufacturer_id, &product_code, &human_readable_name)); |
85 EXPECT_EQ(0x22f0u, manufacturer_id); | 105 EXPECT_EQ(0x22f0u, manufacturer_id); |
86 EXPECT_EQ(0x286cu, product_code); | 106 EXPECT_EQ(0x286cu, product_code); |
87 EXPECT_EQ("HP ZR30w", human_readable_name); | 107 EXPECT_EQ("HP ZR30w", human_readable_name); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 EXPECT_TRUE(IsInternalOutputName("LVDSxx")); | 218 EXPECT_TRUE(IsInternalOutputName("LVDSxx")); |
199 EXPECT_TRUE(IsInternalOutputName("eDPzz")); | 219 EXPECT_TRUE(IsInternalOutputName("eDPzz")); |
200 | 220 |
201 EXPECT_FALSE(IsInternalOutputName("xyz")); | 221 EXPECT_FALSE(IsInternalOutputName("xyz")); |
202 EXPECT_FALSE(IsInternalOutputName("abcLVDS")); | 222 EXPECT_FALSE(IsInternalOutputName("abcLVDS")); |
203 EXPECT_FALSE(IsInternalOutputName("cdeeDP")); | 223 EXPECT_FALSE(IsInternalOutputName("cdeeDP")); |
204 EXPECT_FALSE(IsInternalOutputName("LVD")); | 224 EXPECT_FALSE(IsInternalOutputName("LVD")); |
205 EXPECT_FALSE(IsInternalOutputName("eD")); | 225 EXPECT_FALSE(IsInternalOutputName("eD")); |
206 } | 226 } |
207 | 227 |
| 228 TEST(OutputUtilTest, GetDisplayId) { |
| 229 // EDID of kLP2565A and B are slightly different but actually the same device. |
| 230 int64 id1 = -1; |
| 231 int64 id2 = -1; |
| 232 EXPECT_TRUE(GetDisplayIdFromEDID(kLP2565A, charsize(kLP2565A), 0, &id1)); |
| 233 EXPECT_TRUE(GetDisplayIdFromEDID(kLP2565B, charsize(kLP2565B), 0, &id2)); |
| 234 EXPECT_EQ(id1, id2); |
| 235 EXPECT_NE(-1, id1); |
| 236 } |
| 237 |
| 238 TEST(OutputUtilTest, GetDisplayIdFromInternal) { |
| 239 int64 id = -1; |
| 240 EXPECT_TRUE(GetDisplayIdFromEDID( |
| 241 kInternalDisplay, charsize(kInternalDisplay), 0, &id)); |
| 242 EXPECT_NE(-1, id); |
| 243 } |
| 244 |
| 245 TEST(OutputUtilTest, GetDisplayIdFailure) { |
| 246 int64 id = -1; |
| 247 EXPECT_FALSE(GetDisplayIdFromEDID(NULL, 0, 0, &id)); |
| 248 EXPECT_EQ(-1, id); |
| 249 } |
| 250 |
208 } // namespace chromeos | 251 } // namespace chromeos |
OLD | NEW |