| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(160, 90)); | 23 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(160, 90)); |
| 24 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(160, 100)); | 24 EXPECT_TRUE(DisplayChangeObserver::ShouldIgnoreSize(160, 100)); |
| 25 | 25 |
| 26 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(50, 60)); | 26 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(50, 60)); |
| 27 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(100, 70)); | 27 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(100, 70)); |
| 28 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(272, 181)); | 28 EXPECT_FALSE(DisplayChangeObserver::ShouldIgnoreSize(272, 181)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 TEST_F(DisplayChangeObserverTest, GetResolutionList) { | 31 TEST_F(DisplayChangeObserverTest, GetResolutionList) { |
| 32 OutputConfigurator::OutputSnapshot output; | 32 OutputConfigurator::OutputSnapshot output; |
| 33 output.mode_infos[11] = OutputConfigurator::ModeInfo(1920, 1200, false); | 33 output.mode_infos[11] = OutputConfigurator::ModeInfo(1920, 1200, false, 60); |
| 34 | 34 |
| 35 // All non-interlaced (as would be seen with different refresh rates). | 35 // All non-interlaced (as would be seen with different refresh rates). |
| 36 output.mode_infos[12] = OutputConfigurator::ModeInfo(1920, 1080, false); | 36 output.mode_infos[12] = OutputConfigurator::ModeInfo(1920, 1080, false, 80); |
| 37 output.mode_infos[13] = OutputConfigurator::ModeInfo(1920, 1080, false); | 37 output.mode_infos[13] = OutputConfigurator::ModeInfo(1920, 1080, false, 70); |
| 38 output.mode_infos[14] = OutputConfigurator::ModeInfo(1920, 1080, false); | 38 output.mode_infos[14] = OutputConfigurator::ModeInfo(1920, 1080, false, 60); |
| 39 | 39 |
| 40 // Interlaced vs non-interlaced. | 40 // Interlaced vs non-interlaced. |
| 41 output.mode_infos[15] = OutputConfigurator::ModeInfo(1280, 720, true); | 41 output.mode_infos[15] = OutputConfigurator::ModeInfo(1280, 720, true, 60); |
| 42 output.mode_infos[16] = OutputConfigurator::ModeInfo(1280, 720, false); | 42 output.mode_infos[16] = OutputConfigurator::ModeInfo(1280, 720, false, 60); |
| 43 | 43 |
| 44 // Interlaced only. | 44 // Interlaced only. |
| 45 output.mode_infos[17] = OutputConfigurator::ModeInfo(1024, 768, true); | 45 output.mode_infos[17] = OutputConfigurator::ModeInfo(1024, 768, true, 70); |
| 46 output.mode_infos[18] = OutputConfigurator::ModeInfo(1024, 768, true); | 46 output.mode_infos[18] = OutputConfigurator::ModeInfo(1024, 768, true, 60); |
| 47 | 47 |
| 48 // Mixed. | 48 // Mixed. |
| 49 output.mode_infos[19] = OutputConfigurator::ModeInfo(1024, 600, true); | 49 output.mode_infos[19] = OutputConfigurator::ModeInfo(1024, 600, true, 60); |
| 50 output.mode_infos[20] = OutputConfigurator::ModeInfo(1024, 600, false); | 50 output.mode_infos[20] = OutputConfigurator::ModeInfo(1024, 600, false, 70); |
| 51 output.mode_infos[21] = OutputConfigurator::ModeInfo(1024, 600, false); | 51 output.mode_infos[21] = OutputConfigurator::ModeInfo(1024, 600, false, 60); |
| 52 | 52 |
| 53 // Just one interlaced mode. | 53 // Just one interlaced mode. |
| 54 output.mode_infos[22] = OutputConfigurator::ModeInfo(640, 480, true); | 54 output.mode_infos[22] = OutputConfigurator::ModeInfo(640, 480, true, 60); |
| 55 | 55 |
| 56 std::vector<Resolution> resolutions = | 56 std::vector<Resolution> resolutions = |
| 57 DisplayChangeObserver::GetResolutionList(output); | 57 DisplayChangeObserver::GetResolutionList(output); |
| 58 ASSERT_EQ(6u, resolutions.size()); | 58 ASSERT_EQ(6u, resolutions.size()); |
| 59 EXPECT_EQ("1920x1200", resolutions[0].size.ToString()); | 59 EXPECT_EQ("1920x1200", resolutions[0].size.ToString()); |
| 60 EXPECT_FALSE(resolutions[0].interlaced); | 60 EXPECT_FALSE(resolutions[0].interlaced); |
| 61 | 61 |
| 62 EXPECT_EQ("1920x1080", resolutions[1].size.ToString()); | 62 EXPECT_EQ("1920x1080", resolutions[1].size.ToString()); |
| 63 EXPECT_FALSE(resolutions[1].interlaced); | 63 EXPECT_FALSE(resolutions[1].interlaced); |
| 64 | 64 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 75 EXPECT_TRUE(resolutions[5].interlaced); | 75 EXPECT_TRUE(resolutions[5].interlaced); |
| 76 | 76 |
| 77 // Outputs without any modes shouldn't cause a crash. | 77 // Outputs without any modes shouldn't cause a crash. |
| 78 output.mode_infos.clear(); | 78 output.mode_infos.clear(); |
| 79 resolutions = DisplayChangeObserver::GetResolutionList(output); | 79 resolutions = DisplayChangeObserver::GetResolutionList(output); |
| 80 EXPECT_EQ(0u, resolutions.size()); | 80 EXPECT_EQ(0u, resolutions.size()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace internal | 83 } // namespace internal |
| 84 } // namespace ash | 84 } // namespace ash |
| OLD | NEW |