Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: ash/display/resolution_notification_controller_unittest.cc

Issue 417113012: Introduce user customization of external HighDPI mode for 4K monitor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 virtual void SetUp() OVERRIDE { 57 virtual void SetUp() OVERRIDE {
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
67 const DisplayInfo& info = display_manager->GetDisplayInfo(display.id()); 68 const DisplayInfo& info = display_manager->GetDisplayInfo(display.id());
68 controller()->SetDisplayResolutionAndNotify( 69 DisplayMode old_mode(info.size_in_pixel(),
69 display.id(), 70 60 /* refresh_rate */,
70 info.size_in_pixel(), 71 false /* interlaced */,
71 new_resolution, 72 false /* native */);
72 base::Bind(&ResolutionNotificationControllerTest::OnAccepted, 73 DisplayMode new_mode = old_mode;
73 base::Unretained(this))); 74 new_mode.size = new_resolution;
75
76 if (display_manager->SetDisplayMode(display.id(), new_mode)) {
77 controller()->PrepareNotification(
78 display.id(),
79 old_mode,
80 new_mode,
81 base::Bind(&ResolutionNotificationControllerTest::OnAccepted,
82 base::Unretained(this)));
83 }
74 84
75 // OnConfigurationChanged event won't be emitted in the test environment, 85 // OnConfigurationChanged event won't be emitted in the test environment,
76 // so invoke UpdateDisplay() to emit that event explicitly. 86 // so invoke UpdateDisplay() to emit that event explicitly.
77 std::vector<DisplayInfo> info_list; 87 std::vector<DisplayInfo> info_list;
78 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { 88 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
79 int64 id = display_manager->GetDisplayAt(i).id(); 89 int64 id = display_manager->GetDisplayAt(i).id();
80 DisplayInfo info = display_manager->GetDisplayInfo(id); 90 DisplayInfo info = display_manager->GetDisplayInfo(id);
81 if (display.id() == id) { 91 if (display.id() == id) {
82 gfx::Rect bounds = info.bounds_in_native(); 92 gfx::Rect bounds = info.bounds_in_native();
83 bounds.set_size(actual_new_resolution); 93 bounds.set_size(actual_new_resolution);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 ClickOnNotificationButton(0); 414 ClickOnNotificationButton(0);
405 RunAllPendingInMessageLoop(); 415 RunAllPendingInMessageLoop();
406 EXPECT_FALSE(IsNotificationVisible()); 416 EXPECT_FALSE(IsNotificationVisible());
407 EXPECT_EQ(0, accept_count()); 417 EXPECT_EQ(0, accept_count());
408 EXPECT_TRUE(display_manager->GetSelectedModeForDisplayId(id2, &mode)); 418 EXPECT_TRUE(display_manager->GetSelectedModeForDisplayId(id2, &mode));
409 EXPECT_EQ("250x250", mode.size.ToString()); 419 EXPECT_EQ("250x250", mode.size.ToString());
410 EXPECT_EQ(58.0f, mode.refresh_rate); 420 EXPECT_EQ(58.0f, mode.refresh_rate);
411 } 421 }
412 422
413 } // namespace ash 423 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/resolution_notification_controller.cc ('k') | chrome/browser/chromeos/display/display_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698