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/resolution_notification_controller.h" | 5 #include "ash/display/resolution_notification_controller.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ash::test::AshTestBase::SetUp(); | 58 ash::test::AshTestBase::SetUp(); |
59 ResolutionNotificationController::SuppressTimerForTest(); | 59 ResolutionNotificationController::SuppressTimerForTest(); |
60 } | 60 } |
61 | 61 |
62 void SetDisplayResolutionAndNotifyWithResolution( | 62 void SetDisplayResolutionAndNotifyWithResolution( |
63 const gfx::Display& display, | 63 const gfx::Display& display, |
64 const gfx::Size& new_resolution, | 64 const gfx::Size& new_resolution, |
65 const gfx::Size& actual_new_resolution) { | 65 const gfx::Size& actual_new_resolution) { |
66 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 66 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
67 const DisplayInfo& info = display_manager->GetDisplayInfo(display.id()); | 67 const DisplayInfo& info = display_manager->GetDisplayInfo(display.id()); |
| 68 DisplayMode old_mode(info.size_in_pixel(), |
| 69 60 /* refresh_rate */, |
| 70 false /* interlaced */, |
| 71 false /* native */); |
| 72 DisplayMode new_mode = old_mode; |
| 73 new_mode.size = new_resolution; |
68 controller()->SetDisplayResolutionAndNotify( | 74 controller()->SetDisplayResolutionAndNotify( |
69 display.id(), | 75 display.id(), |
70 info.size_in_pixel(), | 76 old_mode, |
71 new_resolution, | 77 new_mode, |
72 base::Bind(&ResolutionNotificationControllerTest::OnAccepted, | 78 base::Bind(&ResolutionNotificationControllerTest::OnAccepted, |
73 base::Unretained(this))); | 79 base::Unretained(this))); |
74 | 80 |
75 // OnConfigurationChanged event won't be emitted in the test environment, | 81 // OnConfigurationChanged event won't be emitted in the test environment, |
76 // so invoke UpdateDisplay() to emit that event explicitly. | 82 // so invoke UpdateDisplay() to emit that event explicitly. |
77 std::vector<DisplayInfo> info_list; | 83 std::vector<DisplayInfo> info_list; |
78 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 84 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
79 int64 id = display_manager->GetDisplayAt(i).id(); | 85 int64 id = display_manager->GetDisplayAt(i).id(); |
80 DisplayInfo info = display_manager->GetDisplayInfo(id); | 86 DisplayInfo info = display_manager->GetDisplayInfo(id); |
81 if (display.id() == id) { | 87 if (display.id() == id) { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 ClickOnNotificationButton(0); | 410 ClickOnNotificationButton(0); |
405 RunAllPendingInMessageLoop(); | 411 RunAllPendingInMessageLoop(); |
406 EXPECT_FALSE(IsNotificationVisible()); | 412 EXPECT_FALSE(IsNotificationVisible()); |
407 EXPECT_EQ(0, accept_count()); | 413 EXPECT_EQ(0, accept_count()); |
408 EXPECT_TRUE(display_manager->GetSelectedModeForDisplayId(id2, &mode)); | 414 EXPECT_TRUE(display_manager->GetSelectedModeForDisplayId(id2, &mode)); |
409 EXPECT_EQ("250x250", mode.size.ToString()); | 415 EXPECT_EQ("250x250", mode.size.ToString()); |
410 EXPECT_EQ(58.0f, mode.refresh_rate); | 416 EXPECT_EQ(58.0f, mode.refresh_rate); |
411 } | 417 } |
412 | 418 |
413 } // namespace ash | 419 } // namespace ash |
OLD | NEW |