| Index: base/x11/edid_parser_x11_unittest.cc
|
| diff --git a/chromeos/display/output_util_unittest.cc b/base/x11/edid_parser_x11_unittest.cc
|
| similarity index 63%
|
| copy from chromeos/display/output_util_unittest.cc
|
| copy to base/x11/edid_parser_x11_unittest.cc
|
| index 9c72d7b6b3df7c61ec6b9de101bb1c92e5a896da..97e3ce10340593ea3033759b5438de30e702d54c 100644
|
| --- a/chromeos/display/output_util_unittest.cc
|
| +++ b/base/x11/edid_parser_x11_unittest.cc
|
| @@ -2,14 +2,14 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chromeos/display/output_util.h"
|
| +#include "base/x11/edid_parser_x11.h"
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| #include <X11/extensions/Xrandr.h>
|
|
|
| -namespace chromeos {
|
| +namespace base {
|
|
|
| namespace {
|
|
|
| @@ -56,27 +56,6 @@ const unsigned char kOverscanDisplay[] =
|
| "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
| "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc6";
|
|
|
| -// The EDID info misdetecting overscan once. see crbug.com/226318
|
| -const unsigned char kMisdetecedDisplay[] =
|
| - "\x00\xff\xff\xff\xff\xff\xff\x00\x10\xac\x64\x40\x4c\x30\x30\x32"
|
| - "\x0c\x15\x01\x03\x80\x40\x28\x78\xea\x8d\x85\xad\x4f\x35\xb1\x25"
|
| - "\x0e\x50\x54\xa5\x4b\x00\x71\x4f\x81\x00\x81\x80\xd1\x00\xa9\x40"
|
| - "\x01\x01\x01\x01\x01\x01\x28\x3c\x80\xa0\x70\xb0\x23\x40\x30\x20"
|
| - "\x36\x00\x81\x91\x21\x00\x00\x1a\x00\x00\x00\xff\x00\x50\x48\x35"
|
| - "\x4e\x59\x31\x33\x4e\x32\x30\x30\x4c\x0a\x00\x00\x00\xfc\x00\x44"
|
| - "\x45\x4c\x4c\x20\x55\x33\x30\x31\x31\x0a\x20\x20\x00\x00\x00\xfd"
|
| - "\x00\x31\x56\x1d\x5e\x12\x00\x0a\x20\x20\x20\x20\x20\x20\x01\x38"
|
| - "\x02\x03\x29\xf1\x50\x90\x05\x04\x03\x02\x07\x16\x01\x06\x11\x12"
|
| - "\x15\x13\x14\x1f\x20\x23\x0d\x7f\x07\x83\x0f\x00\x00\x67\x03\x0c"
|
| - "\x00\x10\x00\x38\x2d\xe3\x05\x03\x01\x02\x3a\x80\x18\x71\x38\x2d"
|
| - "\x40\x58\x2c\x45\x00\x81\x91\x21\x00\x00\x1e\x01\x1d\x80\x18\x71"
|
| - "\x1c\x16\x20\x58\x2c\x25\x00\x81\x91\x21\x00\x00\x9e\x01\x1d\x00"
|
| - "\x72\x51\xd0\x1e\x20\x6e\x28\x55\x00\x81\x91\x21\x00\x00\x1e\x8c"
|
| - "\x0a\xd0\x8a\x20\xe0\x2d\x10\x10\x3e\x96\x00\x81\x91\x21\x00\x00"
|
| - "\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x94";
|
| -
|
| -}
|
| -
|
| 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"
|
| @@ -97,7 +76,9 @@ const unsigned char kLP2565B[] =
|
| "\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) {
|
| +} // namespace
|
| +
|
| +TEST(EdidParserX11Test, ParseEDID) {
|
| uint16 manufacturer_id = 0;
|
| std::string human_readable_name;
|
| EXPECT_TRUE(ParseOutputDeviceData(
|
| @@ -129,7 +110,7 @@ TEST(OutputUtilTest, ParseEDID) {
|
| EXPECT_EQ("SAMSUNG", human_readable_name);
|
| }
|
|
|
| -TEST(OutputUtilTest, ParseBrokenEDID) {
|
| +TEST(EdidParserX11Test, ParseBrokenEDID) {
|
| uint16 manufacturer_id = 0;
|
| std::string human_readable_name;
|
|
|
| @@ -160,70 +141,7 @@ TEST(OutputUtilTest, ParseBrokenEDID) {
|
| EXPECT_EQ(0x22f0u, manufacturer_id);
|
| }
|
|
|
| -TEST(OutputUtilTest, ParseOverscanFlag) {
|
| - bool flag = false;
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(
|
| - kNormalDisplay, charsize(kNormalDisplay), &flag));
|
| -
|
| - flag = false;
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(
|
| - kInternalDisplay, charsize(kInternalDisplay), &flag));
|
| -
|
| - flag = false;
|
| - EXPECT_TRUE(ParseOutputOverscanFlag(
|
| - kOverscanDisplay, charsize(kOverscanDisplay), &flag));
|
| - EXPECT_TRUE(flag);
|
| -
|
| - flag = false;
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(
|
| - kMisdetecedDisplay, charsize(kMisdetecedDisplay), &flag));
|
| -
|
| - flag = false;
|
| - // Copy |kOverscanDisplay| and set flags to false in it. The overscan flags
|
| - // are embedded at byte 150 in this specific example. Fix here too when the
|
| - // contents of kOverscanDisplay is altered.
|
| - std::string display_data(reinterpret_cast<const char*>(kOverscanDisplay),
|
| - charsize(kOverscanDisplay));
|
| - display_data[150] = '\0';
|
| - EXPECT_TRUE(ParseOutputOverscanFlag(
|
| - reinterpret_cast<const unsigned char*>(display_data.data()),
|
| - display_data.size(), &flag));
|
| - EXPECT_FALSE(flag);
|
| -}
|
| -
|
| -TEST(OutputUtilTest, ParseBrokenOverscanData) {
|
| - // Do not fill valid data here because it anyway fails to parse the data.
|
| - scoped_ptr<unsigned char[]> data(new unsigned char[126]);
|
| - bool flag = false;
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 0, &flag));
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 126, &flag));
|
| -
|
| - // extending data because ParseOutputOverscanFlag() will access the data.
|
| - data.reset(new unsigned char[150]);
|
| - // The number of CEA extensions is stored at byte 126.
|
| - data[126] = '\x01';
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 128, &flag));
|
| - EXPECT_FALSE(ParseOutputOverscanFlag(data.get(), 150, &flag));
|
| -}
|
| -
|
| -TEST(OutputUtilTest, IsInternalOutputName) {
|
| - EXPECT_TRUE(IsInternalOutputName("LVDS"));
|
| - EXPECT_TRUE(IsInternalOutputName("eDP"));
|
| - EXPECT_TRUE(IsInternalOutputName("DSI"));
|
| - EXPECT_TRUE(IsInternalOutputName("LVDSxx"));
|
| - EXPECT_TRUE(IsInternalOutputName("eDPzz"));
|
| - EXPECT_TRUE(IsInternalOutputName("DSIyy"));
|
| -
|
| - EXPECT_FALSE(IsInternalOutputName("xyz"));
|
| - EXPECT_FALSE(IsInternalOutputName("abcLVDS"));
|
| - EXPECT_FALSE(IsInternalOutputName("cdeeDP"));
|
| - EXPECT_FALSE(IsInternalOutputName("abcDSI"));
|
| - EXPECT_FALSE(IsInternalOutputName("LVD"));
|
| - EXPECT_FALSE(IsInternalOutputName("eD"));
|
| - EXPECT_FALSE(IsInternalOutputName("DS"));
|
| -}
|
| -
|
| -TEST(OutputUtilTest, GetDisplayId) {
|
| +TEST(EdidParserX11Test, GetDisplayId) {
|
| // EDID of kLP2565A and B are slightly different but actually the same device.
|
| int64 id1 = -1;
|
| int64 id2 = -1;
|
| @@ -233,17 +151,17 @@ TEST(OutputUtilTest, GetDisplayId) {
|
| EXPECT_NE(-1, id1);
|
| }
|
|
|
| -TEST(OutputUtilTest, GetDisplayIdFromInternal) {
|
| +TEST(EdidParserX11Test, GetDisplayIdFromInternal) {
|
| int64 id = -1;
|
| EXPECT_TRUE(GetDisplayIdFromEDID(
|
| kInternalDisplay, charsize(kInternalDisplay), 0, &id));
|
| EXPECT_NE(-1, id);
|
| }
|
|
|
| -TEST(OutputUtilTest, GetDisplayIdFailure) {
|
| +TEST(EdidParserX11Test, GetDisplayIdFailure) {
|
| int64 id = -1;
|
| EXPECT_FALSE(GetDisplayIdFromEDID(NULL, 0, 0, &id));
|
| EXPECT_EQ(-1, id);
|
| }
|
|
|
| -} // namespace chromeos
|
| +} // namespace base
|
|
|