Update V8 to version 4.7.16.
[chromium-blink-merge.git] / ui / display / util / display_util_unittest.cc
blobddb4a1cd078b4f57fd2722b425e48c92a28a9ecd
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
3 // found in the LICENSE file.
5 #include "ui/display/util/display_util.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace ui {
11 TEST(DisplayUtilTest, TestBlackListedDisplay) {
12 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(10, 10)));
13 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(40, 30)));
14 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(50, 40)));
15 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(160, 90)));
16 EXPECT_TRUE(IsDisplaySizeBlackListed(gfx::Size(160, 100)));
18 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(50, 60)));
19 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(100, 70)));
20 EXPECT_FALSE(IsDisplaySizeBlackListed(gfx::Size(272, 181)));
23 TEST(DisplayUtilTest, GetScaleFactor) {
24 // Normal chromebook spec. DPI ~= 130
25 EXPECT_EQ(1.0f, GetScaleFactor(
26 gfx::Size(256, 144), gfx::Size(1366, 768)));
28 // HiDPI like Pixel. DPI ~= 240
29 EXPECT_EQ(2.0f, GetScaleFactor(
30 gfx::Size(272, 181), gfx::Size(2560, 1700)));
32 // A large external display but normal pixel density. DPI ~= 100
33 EXPECT_EQ(1.0f, GetScaleFactor(
34 gfx::Size(641, 400), gfx::Size(2560, 1600)));
36 // A large external display with high pixel density. DPI ~= 157
37 EXPECT_EQ(2.0f, GetScaleFactor(
38 gfx::Size(621, 341), gfx::Size(3840, 2160)));
40 // 4K resolution but the display is physically even larger. DPI ~= 114
41 EXPECT_EQ(1.0f, GetScaleFactor(
42 gfx::Size(854, 481), gfx::Size(3840, 2160)));
44 // 21.5 inch, 1080p. DPI ~= 102
45 EXPECT_EQ(1.0f, GetScaleFactor(
46 gfx::Size(476, 267), gfx::Size(1920, 1080)));
48 // Corner case; slightly higher density but smaller screens. DPI ~= 165
49 EXPECT_EQ(1.0f, GetScaleFactor(
50 gfx::Size(293, 165), gfx::Size(1920, 1080)));
53 } // namespace ui