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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_layout_store.h" 8 #include "ash/display/display_layout_store.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 EXPECT_TRUE(display_manager()->GetSelectedResolutionForDisplayId( 742 EXPECT_TRUE(display_manager()->GetSelectedResolutionForDisplayId(
743 display_id, &selected)); 743 display_id, &selected));
744 EXPECT_EQ("800x300", selected.ToString()); 744 EXPECT_EQ("800x300", selected.ToString());
745 745
746 // Best resolution. 746 // Best resolution.
747 display_manager()->SetDisplayResolution(display_id, gfx::Size(1000, 500)); 747 display_manager()->SetDisplayResolution(display_id, gfx::Size(1000, 500));
748 EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId( 748 EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId(
749 display_id, &selected)); 749 display_id, &selected));
750 } 750 }
751 751
752 TEST_F(DisplayManagerTest, ResolutionFallback) {
753 int display_id = 1000;
754 DisplayInfo native_display_info =
755 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1000, 500));
756 std::vector<Resolution> resolutions;
757 resolutions.push_back(Resolution(gfx::Size(1000, 500), false));
758 resolutions.push_back(Resolution(gfx::Size(800, 300), false));
759 resolutions.push_back(Resolution(gfx::Size(400, 500), false));
760
761 std::vector<Resolution> copy = resolutions;
762 native_display_info.set_resolutions(copy);
763
764 std::vector<DisplayInfo> display_info_list;
765 display_info_list.push_back(native_display_info);
766 display_manager()->OnNativeDisplaysChanged(display_info_list);
767 {
768 display_manager()->SetDisplayResolution(display_id, gfx::Size(800, 300));
769 DisplayInfo new_native_display_info =
770 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 400, 500));
771 copy = resolutions;
772 new_native_display_info.set_resolutions(copy);
773 std::vector<DisplayInfo> new_display_info_list;
774 new_display_info_list.push_back(new_native_display_info);
775 display_manager()->OnNativeDisplaysChanged(new_display_info_list);
776
777 gfx::Size selected;
778 EXPECT_TRUE(display_manager()->GetSelectedResolutionForDisplayId(
779 display_id, &selected));
780 EXPECT_EQ("400x500", selected.ToString());
781 }
782 {
783 // Best resolution should not be set.
784 display_manager()->SetDisplayResolution(display_id, gfx::Size(800, 300));
785 DisplayInfo new_native_display_info =
786 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1000, 500));
787 std::vector<Resolution> copy = resolutions;
788 new_native_display_info.set_resolutions(copy);
789 std::vector<DisplayInfo> new_display_info_list;
790 new_display_info_list.push_back(new_native_display_info);
791 display_manager()->OnNativeDisplaysChanged(new_display_info_list);
792
793 gfx::Size selected;
794 EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId(
795 display_id, &selected));
796 }
797 }
798
752 TEST_F(DisplayManagerTest, Rotate) { 799 TEST_F(DisplayManagerTest, Rotate) {
753 if (!SupportsMultipleDisplays()) 800 if (!SupportsMultipleDisplays())
754 return; 801 return;
755 802
756 UpdateDisplay("100x200/r,300x400/l"); 803 UpdateDisplay("100x200/r,300x400/l");
757 EXPECT_EQ("1,1 100x200", 804 EXPECT_EQ("1,1 100x200",
758 GetDisplayInfoAt(0).bounds_in_native().ToString()); 805 GetDisplayInfoAt(0).bounds_in_native().ToString());
759 EXPECT_EQ("200x100", 806 EXPECT_EQ("200x100",
760 GetDisplayInfoAt(0).size_in_pixel().ToString()); 807 GetDisplayInfoAt(0).size_in_pixel().ToString());
761 808
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 UpdateDisplay("100+200-100x200,300+500-200x300"); 1176 UpdateDisplay("100+200-100x200,300+500-200x300");
1130 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1177 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
1131 EXPECT_EQ("100,200", dispatcher0->host()->GetBounds().origin().ToString()); 1178 EXPECT_EQ("100,200", dispatcher0->host()->GetBounds().origin().ToString());
1132 EXPECT_EQ("100x200", dispatcher0->host()->GetBounds().size().ToString()); 1179 EXPECT_EQ("100x200", dispatcher0->host()->GetBounds().size().ToString());
1133 EXPECT_EQ("300,500", dispatcher1->host()->GetBounds().origin().ToString()); 1180 EXPECT_EQ("300,500", dispatcher1->host()->GetBounds().origin().ToString());
1134 EXPECT_EQ("200x300", dispatcher1->host()->GetBounds().size().ToString()); 1181 EXPECT_EQ("200x300", dispatcher1->host()->GetBounds().size().ToString());
1135 } 1182 }
1136 1183
1137 } // namespace internal 1184 } // namespace internal
1138 } // namespace ash 1185 } // namespace ash
OLDNEW
« 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