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