| 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 "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/display/chromeos/display_configurator.h" |
| 10 #include "ui/display/chromeos/display_mode.h" | 11 #include "ui/display/chromeos/display_mode.h" |
| 11 #include "ui/display/chromeos/output_configurator.h" | |
| 12 #include "ui/display/chromeos/test/test_display_snapshot.h" | 12 #include "ui/display/chromeos/test/test_display_snapshot.h" |
| 13 | 13 |
| 14 using ui::OutputConfigurator; | 14 using ui::DisplayConfigurator; |
| 15 | 15 |
| 16 typedef testing::Test DisplayChangeObserverTest; | 16 typedef testing::Test DisplayChangeObserverTest; |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 TEST_F(DisplayChangeObserverTest, GetDisplayModeList) { | 20 TEST_F(DisplayChangeObserverTest, GetDisplayModeList) { |
| 21 ScopedVector<const ui::DisplayMode> modes; | 21 ScopedVector<const ui::DisplayMode> modes; |
| 22 modes.push_back(new ui::DisplayMode(gfx::Size(1920, 1200), false, 60)); | 22 modes.push_back(new ui::DisplayMode(gfx::Size(1920, 1200), false, 60)); |
| 23 | 23 |
| 24 // All non-interlaced (as would be seen with different refresh rates). | 24 // All non-interlaced (as would be seen with different refresh rates). |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 // Mixed. | 37 // Mixed. |
| 38 modes.push_back(new ui::DisplayMode(gfx::Size(1024, 600), true, 60)); | 38 modes.push_back(new ui::DisplayMode(gfx::Size(1024, 600), true, 60)); |
| 39 modes.push_back(new ui::DisplayMode(gfx::Size(1024, 600), false, 70)); | 39 modes.push_back(new ui::DisplayMode(gfx::Size(1024, 600), false, 70)); |
| 40 modes.push_back(new ui::DisplayMode(gfx::Size(1024, 600), false, 60)); | 40 modes.push_back(new ui::DisplayMode(gfx::Size(1024, 600), false, 60)); |
| 41 | 41 |
| 42 // Just one interlaced mode. | 42 // Just one interlaced mode. |
| 43 modes.push_back(new ui::DisplayMode(gfx::Size(640, 480), true, 60)); | 43 modes.push_back(new ui::DisplayMode(gfx::Size(640, 480), true, 60)); |
| 44 | 44 |
| 45 ui::TestDisplaySnapshot display_snapshot; | 45 ui::TestDisplaySnapshot display_snapshot; |
| 46 display_snapshot.set_modes(modes.get()); | 46 display_snapshot.set_modes(modes.get()); |
| 47 OutputConfigurator::DisplayState output; | 47 DisplayConfigurator::DisplayState output; |
| 48 output.display = &display_snapshot; | 48 output.display = &display_snapshot; |
| 49 | 49 |
| 50 std::vector<DisplayMode> display_modes = | 50 std::vector<DisplayMode> display_modes = |
| 51 DisplayChangeObserver::GetDisplayModeList(output); | 51 DisplayChangeObserver::GetDisplayModeList(output); |
| 52 ASSERT_EQ(6u, display_modes.size()); | 52 ASSERT_EQ(6u, display_modes.size()); |
| 53 EXPECT_EQ("1920x1200", display_modes[0].size.ToString()); | 53 EXPECT_EQ("1920x1200", display_modes[0].size.ToString()); |
| 54 EXPECT_FALSE(display_modes[0].interlaced); | 54 EXPECT_FALSE(display_modes[0].interlaced); |
| 55 EXPECT_EQ(display_modes[0].refresh_rate, 60); | 55 EXPECT_EQ(display_modes[0].refresh_rate, 60); |
| 56 | 56 |
| 57 EXPECT_EQ("1920x1080", display_modes[1].size.ToString()); | 57 EXPECT_EQ("1920x1080", display_modes[1].size.ToString()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 | 76 |
| 77 // Outputs without any modes shouldn't cause a crash. | 77 // Outputs without any modes shouldn't cause a crash. |
| 78 modes.clear(); | 78 modes.clear(); |
| 79 display_snapshot.set_modes(modes.get()); | 79 display_snapshot.set_modes(modes.get()); |
| 80 | 80 |
| 81 display_modes = DisplayChangeObserver::GetDisplayModeList(output); | 81 display_modes = DisplayChangeObserver::GetDisplayModeList(output); |
| 82 EXPECT_EQ(0u, display_modes.size()); | 82 EXPECT_EQ(0u, display_modes.size()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace ash | 85 } // namespace ash |
| OLD | NEW |