| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/display/util/edid_parser.h" | 5 #include "ui/display/util/edid_parser.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 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 manufacturer_id = 0; | 218 manufacturer_id = 0; |
| 219 EXPECT_TRUE( | 219 EXPECT_TRUE( |
| 220 ParseOutputDeviceData(edid, &manufacturer_id, nullptr, &dummy, &dummy)); | 220 ParseOutputDeviceData(edid, &manufacturer_id, nullptr, &dummy, &dummy)); |
| 221 EXPECT_EQ(0x22f0u, manufacturer_id); | 221 EXPECT_EQ(0x22f0u, manufacturer_id); |
| 222 } | 222 } |
| 223 | 223 |
| 224 TEST(EDIDParserTest, GetDisplayId) { | 224 TEST(EDIDParserTest, GetDisplayId) { |
| 225 // EDID of kLP2565A and B are slightly different but actually the same device. | 225 // EDID of kLP2565A and B are slightly different but actually the same device. |
| 226 int64_t id1 = -1; | 226 int64_t id1 = -1; |
| 227 int64_t id2 = -1; | 227 int64_t id2 = -1; |
| 228 int64_t product_id1 = -1; |
| 229 int64_t product_id2 = -1; |
| 228 std::vector<uint8_t> edid(kLP2565A, kLP2565A + charsize(kLP2565A)); | 230 std::vector<uint8_t> edid(kLP2565A, kLP2565A + charsize(kLP2565A)); |
| 229 EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id1)); | 231 EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id1, &product_id1)); |
| 230 edid.assign(kLP2565B, kLP2565B + charsize(kLP2565B)); | 232 edid.assign(kLP2565B, kLP2565B + charsize(kLP2565B)); |
| 231 EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id2)); | 233 EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id2, &product_id2)); |
| 232 EXPECT_EQ(id1, id2); | 234 EXPECT_EQ(id1, id2); |
| 235 EXPECT_EQ(product_id1, product_id2); |
| 233 EXPECT_NE(-1, id1); | 236 EXPECT_NE(-1, id1); |
| 237 EXPECT_NE(-1, product_id1); |
| 234 } | 238 } |
| 235 | 239 |
| 236 TEST(EDIDParserTest, GetDisplayIdFromInternal) { | 240 TEST(EDIDParserTest, GetDisplayIdFromInternal) { |
| 237 int64_t id = -1; | 241 int64_t id = -1; |
| 242 int64_t product_id = -1; |
| 238 std::vector<uint8_t> edid( | 243 std::vector<uint8_t> edid( |
| 239 kInternalDisplay, kInternalDisplay + charsize(kInternalDisplay)); | 244 kInternalDisplay, kInternalDisplay + charsize(kInternalDisplay)); |
| 240 EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id)); | 245 EXPECT_TRUE(GetDisplayIdFromEDID(edid, 0, &id, &product_id)); |
| 241 EXPECT_NE(-1, id); | 246 EXPECT_NE(-1, id); |
| 247 EXPECT_NE(-1, product_id); |
| 242 } | 248 } |
| 243 | 249 |
| 244 TEST(EDIDParserTest, GetDisplayIdFailure) { | 250 TEST(EDIDParserTest, GetDisplayIdFailure) { |
| 245 int64_t id = -1; | 251 int64_t id = -1; |
| 252 int64_t product_id = -1; |
| 246 std::vector<uint8_t> edid; | 253 std::vector<uint8_t> edid; |
| 247 EXPECT_FALSE(GetDisplayIdFromEDID(edid, 0, &id)); | 254 EXPECT_FALSE(GetDisplayIdFromEDID(edid, 0, &id, &product_id)); |
| 248 EXPECT_EQ(-1, id); | 255 EXPECT_EQ(-1, id); |
| 256 EXPECT_EQ(-1, product_id); |
| 249 } | 257 } |
| 250 | 258 |
| 251 } // namespace ui | 259 } // namespace ui |
| OLD | NEW |