OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/display/display_change_observer_chromeos.h" | 5 #include "ash/display/display_change_observer_chromeos.h" |
6 | 6 |
7 #include "ash/display/display_info.h" | 7 #include "ash/display/display_info.h" |
8 #include "chromeos/display/output_configurator.h" | 8 #include "chromeos/display/output_configurator.h" |
9 #include "chromeos/display/output_util.h" | 9 #include "chromeos/display/output_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 using chromeos::OutputConfigurator; | 12 using chromeos::OutputConfigurator; |
13 | 13 |
14 typedef testing::Test DisplayChangeObserverTest; | 14 typedef testing::Test DisplayChangeObserverTest; |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 TEST_F(DisplayChangeObserverTest, TestBlackListedDisplay) { | |
20 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(10, 10)); | |
21 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(40, 30)); | |
22 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(50, 40)); | |
23 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(160, 90)); | |
24 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(160, 100)); | |
25 | |
26 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(50, 60)); | |
27 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(100, 70)); | |
28 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(272, 181)); | |
29 } | |
30 | |
31 TEST_F(DisplayChangeObserverTest, GetResolutionList) { | 19 TEST_F(DisplayChangeObserverTest, GetResolutionList) { |
32 OutputConfigurator::OutputSnapshot output; | 20 OutputConfigurator::OutputSnapshot output; |
33 output.mode_infos[11] = OutputConfigurator::ModeInfo(1920, 1200, false, 60); | 21 output.mode_infos[11] = OutputConfigurator::ModeInfo(1920, 1200, false, 60); |
34 | 22 |
35 // All non-interlaced (as would be seen with different refresh rates). | 23 // All non-interlaced (as would be seen with different refresh rates). |
36 output.mode_infos[12] = OutputConfigurator::ModeInfo(1920, 1080, false, 80); | 24 output.mode_infos[12] = OutputConfigurator::ModeInfo(1920, 1080, false, 80); |
37 output.mode_infos[13] = OutputConfigurator::ModeInfo(1920, 1080, false, 70); | 25 output.mode_infos[13] = OutputConfigurator::ModeInfo(1920, 1080, false, 70); |
38 output.mode_infos[14] = OutputConfigurator::ModeInfo(1920, 1080, false, 60); | 26 output.mode_infos[14] = OutputConfigurator::ModeInfo(1920, 1080, false, 60); |
39 | 27 |
40 // Interlaced vs non-interlaced. | 28 // Interlaced vs non-interlaced. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 EXPECT_TRUE(resolutions[5].interlaced); | 63 EXPECT_TRUE(resolutions[5].interlaced); |
76 | 64 |
77 // Outputs without any modes shouldn't cause a crash. | 65 // Outputs without any modes shouldn't cause a crash. |
78 output.mode_infos.clear(); | 66 output.mode_infos.clear(); |
79 resolutions = DisplayChangeObserver::GetResolutionList(output); | 67 resolutions = DisplayChangeObserver::GetResolutionList(output); |
80 EXPECT_EQ(0u, resolutions.size()); | 68 EXPECT_EQ(0u, resolutions.size()); |
81 } | 69 } |
82 | 70 |
83 } // namespace internal | 71 } // namespace internal |
84 } // namespace ash | 72 } // namespace ash |
OLD | NEW |