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

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: update test Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | chrome/browser/chromeos/display/display_preferences_unittest.cc » ('j') | 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 63a37f5e1b24c6f67e8d5f108b3f419750c0b8d0..9ada6a8de6753c07d6c63303b5d9d6cda6595dbb 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;
« no previous file with comments | « ash/display/display_manager.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