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

Unified Diff: ash/display/display_manager_unittest.cc

Issue 106673003: Update the selected resolution to the resolution that is actually selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« ash/display/display_manager.cc ('K') | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager_unittest.cc
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 162f9a90a819b3989bdd187ff5899691cab7490b..d9978cd073c4847655e8883fe021aa975c621727 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -749,6 +749,53 @@ TEST_F(DisplayManagerTest, DontRememberBestResolution) {
display_id, &selected));
}
+TEST_F(DisplayManagerTest, ResolutionFallback) {
+ int display_id = 1000;
+ DisplayInfo native_display_info =
+ CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1000, 500));
+ std::vector<Resolution> resolutions;
+ resolutions.push_back(Resolution(gfx::Size(1000, 500), false));
+ resolutions.push_back(Resolution(gfx::Size(800, 300), false));
+ resolutions.push_back(Resolution(gfx::Size(400, 500), false));
+
+ std::vector<Resolution> copy = resolutions;
+ native_display_info.set_resolutions(copy);
+
+ std::vector<DisplayInfo> display_info_list;
+ display_info_list.push_back(native_display_info);
+ display_manager()->OnNativeDisplaysChanged(display_info_list);
+ {
+ display_manager()->SetDisplayResolution(display_id, gfx::Size(800, 300));
+ DisplayInfo new_native_display_info =
+ CreateDisplayInfo(display_id, gfx::Rect(0, 0, 400, 500));
+ copy = resolutions;
+ new_native_display_info.set_resolutions(copy);
+ std::vector<DisplayInfo> new_display_info_list;
+ new_display_info_list.push_back(new_native_display_info);
+ display_manager()->OnNativeDisplaysChanged(new_display_info_list);
+
+ gfx::Size selected;
+ EXPECT_TRUE(display_manager()->GetSelectedResolutionForDisplayId(
+ display_id, &selected));
+ EXPECT_EQ("400x500", selected.ToString());
+ }
+ {
+ // Best resolution should not be set.
+ display_manager()->SetDisplayResolution(display_id, gfx::Size(800, 300));
+ DisplayInfo new_native_display_info =
+ CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1000, 500));
+ std::vector<Resolution> copy = resolutions;
+ new_native_display_info.set_resolutions(copy);
+ std::vector<DisplayInfo> new_display_info_list;
+ new_display_info_list.push_back(new_native_display_info);
+ display_manager()->OnNativeDisplaysChanged(new_display_info_list);
+
+ gfx::Size selected;
+ EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId(
+ display_id, &selected));
+ }
+}
+
TEST_F(DisplayManagerTest, Rotate) {
if (!SupportsMultipleDisplays())
return;
« ash/display/display_manager.cc ('K') | « ash/display/display_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698