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

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

Issue 22662005: Don't remember best resolution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 (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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 EXPECT_EQ("0,0 100x100", GetDisplayForId(10).bounds().ToString()); 710 EXPECT_EQ("0,0 100x100", GetDisplayForId(10).bounds().ToString());
711 711
712 // OnNativeDisplaysChanged may change the display bounds. Here makes sure 712 // OnNativeDisplaysChanged may change the display bounds. Here makes sure
713 // nothing changed if the exactly same displays are specified. 713 // nothing changed if the exactly same displays are specified.
714 display_manager()->OnNativeDisplaysChanged(display_info_list); 714 display_manager()->OnNativeDisplaysChanged(display_info_list);
715 EXPECT_EQ("-500,0 500x500", 715 EXPECT_EQ("-500,0 500x500",
716 GetDisplayForId(internal_display_id).bounds().ToString()); 716 GetDisplayForId(internal_display_id).bounds().ToString());
717 EXPECT_EQ("0,0 100x100", GetDisplayForId(10).bounds().ToString()); 717 EXPECT_EQ("0,0 100x100", GetDisplayForId(10).bounds().ToString());
718 } 718 }
719 719
720 TEST_F(DisplayManagerTest, DontRememberBestResolution) {
721 int display_id = 1000;
722 DisplayInfo native_display_info =
723 CreateDisplayInfo(display_id, gfx::Rect(0, 0, 1000, 500));
724 std::vector<Resolution> resolutions;
725 resolutions.push_back(Resolution(gfx::Size(1000, 500), false));
726 resolutions.push_back(Resolution(gfx::Size(800, 300), false));
727 resolutions.push_back(Resolution(gfx::Size(400, 500), false));
728
729 native_display_info.set_resolutions(resolutions);
730
731 std::vector<DisplayInfo> display_info_list;
732 display_info_list.push_back(native_display_info);
733 display_manager()->OnNativeDisplaysChanged(display_info_list);
734
735 gfx::Size selected;
736 EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId(
737 display_id, &selected));
738
739 // Unsupported resolution.
740 display_manager()->SetDisplayResolution(display_id, gfx::Size(800, 4000));
741 EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId(
742 display_id, &selected));
743
744 // Supported resolution.
745 display_manager()->SetDisplayResolution(display_id, gfx::Size(800, 300));
746 EXPECT_TRUE(display_manager()->GetSelectedResolutionForDisplayId(
747 display_id, &selected));
748 EXPECT_EQ("800x300", selected.ToString());
749
750 // Best resolution.
751 display_manager()->SetDisplayResolution(display_id, gfx::Size(1000, 500));
752 EXPECT_FALSE(display_manager()->GetSelectedResolutionForDisplayId(
753 display_id, &selected));
754 }
755
720 TEST_F(DisplayManagerTest, Rotate) { 756 TEST_F(DisplayManagerTest, Rotate) {
721 if (!SupportsMultipleDisplays()) 757 if (!SupportsMultipleDisplays())
722 return; 758 return;
723 759
724 UpdateDisplay("100x200/r,300x400/l"); 760 UpdateDisplay("100x200/r,300x400/l");
725 EXPECT_EQ("1,1 100x200", 761 EXPECT_EQ("1,1 100x200",
726 GetDisplayInfoAt(0).bounds_in_pixel().ToString()); 762 GetDisplayInfoAt(0).bounds_in_pixel().ToString());
727 EXPECT_EQ("200x100", 763 EXPECT_EQ("200x100",
728 GetDisplayInfoAt(0).size_in_pixel().ToString()); 764 GetDisplayInfoAt(0).size_in_pixel().ToString());
729 765
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 UpdateDisplay("400x600/o,600x800/o"); 1022 UpdateDisplay("400x600/o,600x800/o");
987 EXPECT_FALSE(display_observer.changed_and_reset()); 1023 EXPECT_FALSE(display_observer.changed_and_reset());
988 EXPECT_EQ("400x600", test_api.GetRootWindow()->bounds().size().ToString()); 1024 EXPECT_EQ("400x600", test_api.GetRootWindow()->bounds().size().ToString());
989 EXPECT_EQ("600x800", GetMirroredDisplay().size().ToString()); 1025 EXPECT_EQ("600x800", GetMirroredDisplay().size().ToString());
990 1026
991 Shell::GetScreen()->RemoveObserver(&display_observer); 1027 Shell::GetScreen()->RemoveObserver(&display_observer);
992 } 1028 }
993 1029
994 } // namespace internal 1030 } // namespace internal
995 } // namespace ash 1031 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/resolution_notification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698