| 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/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/strings/grit/ash_strings.h" | 9 #include "ash/strings/grit/ash_strings.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 scoped_refptr<display::ManagedDisplayMode> old_mode( | 59 scoped_refptr<display::ManagedDisplayMode> old_mode( |
| 60 new display::ManagedDisplayMode( | 60 new display::ManagedDisplayMode( |
| 61 info.size_in_pixel(), 60 /* refresh_rate */, false /* interlaced */, | 61 info.size_in_pixel(), 60 /* refresh_rate */, false /* interlaced */, |
| 62 false /* native */)); | 62 false /* native */)); |
| 63 scoped_refptr<display::ManagedDisplayMode> new_mode( | 63 scoped_refptr<display::ManagedDisplayMode> new_mode( |
| 64 new display::ManagedDisplayMode( | 64 new display::ManagedDisplayMode( |
| 65 new_resolution, old_mode->refresh_rate(), old_mode->is_interlaced(), | 65 new_resolution, old_mode->refresh_rate(), old_mode->is_interlaced(), |
| 66 old_mode->native(), old_mode->ui_scale(), | 66 old_mode->native(), old_mode->ui_scale(), |
| 67 old_mode->device_scale_factor())); | 67 old_mode->device_scale_factor())); |
| 68 | 68 |
| 69 if (display_manager()->SetDisplayMode(display.id(), new_mode)) { | 69 EXPECT_TRUE(controller()->PrepareNotificationAndSetDisplayMode( |
| 70 controller()->PrepareNotification( | 70 display.id(), old_mode, new_mode, |
| 71 display.id(), old_mode, new_mode, | 71 base::Bind(&ResolutionNotificationControllerTest::OnAccepted, |
| 72 base::Bind(&ResolutionNotificationControllerTest::OnAccepted, | 72 base::Unretained(this)))); |
| 73 base::Unretained(this))); | |
| 74 } | |
| 75 | 73 |
| 76 // OnConfigurationChanged event won't be emitted in the test environment, | 74 // OnConfigurationChanged event won't be emitted in the test environment, |
| 77 // so invoke UpdateDisplay() to emit that event explicitly. | 75 // so invoke UpdateDisplay() to emit that event explicitly. |
| 78 std::vector<display::ManagedDisplayInfo> info_list; | 76 std::vector<display::ManagedDisplayInfo> info_list; |
| 79 for (size_t i = 0; i < display_manager()->GetNumDisplays(); ++i) { | 77 for (size_t i = 0; i < display_manager()->GetNumDisplays(); ++i) { |
| 80 int64_t id = display_manager()->GetDisplayAt(i).id(); | 78 int64_t id = display_manager()->GetDisplayAt(i).id(); |
| 81 display::ManagedDisplayInfo info = display_manager()->GetDisplayInfo(id); | 79 display::ManagedDisplayInfo info = display_manager()->GetDisplayInfo(id); |
| 82 if (display.id() == id) { | 80 if (display.id() == id) { |
| 83 gfx::Rect bounds = info.bounds_in_native(); | 81 gfx::Rect bounds = info.bounds_in_native(); |
| 84 bounds.set_size(actual_new_resolution); | 82 bounds.set_size(actual_new_resolution); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 EXPECT_FALSE(IsNotificationVisible()); | 376 EXPECT_FALSE(IsNotificationVisible()); |
| 379 EXPECT_EQ(0, accept_count()); | 377 EXPECT_EQ(0, accept_count()); |
| 380 | 378 |
| 381 mode = display_manager()->GetSelectedModeForDisplayId(id2); | 379 mode = display_manager()->GetSelectedModeForDisplayId(id2); |
| 382 EXPECT_TRUE(!!mode); | 380 EXPECT_TRUE(!!mode); |
| 383 EXPECT_EQ("250x250", mode->size().ToString()); | 381 EXPECT_EQ("250x250", mode->size().ToString()); |
| 384 EXPECT_EQ(58.0f, mode->refresh_rate()); | 382 EXPECT_EQ(58.0f, mode->refresh_rate()); |
| 385 } | 383 } |
| 386 | 384 |
| 387 } // namespace ash | 385 } // namespace ash |
| OLD | NEW |