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

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

Issue 2426103004: Specify a default display UI scale to reset the zoom to (Closed)
Patch Set: Working test Created 4 years, 1 month 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
« no previous file with comments | « ash/display/root_window_transformers_unittest.cc ('k') | ash/test/display_manager_test_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 // Changing internal ID display changes the DisplayIdPair (it comes 737 // Changing internal ID display changes the DisplayIdPair (it comes
738 // first), which also changes the primary display candidate. Update 738 // first), which also changes the primary display candidate. Update
739 // the primary display manually to update the primary display to 739 // the primary display manually to update the primary display to
740 // avoid getting the OnDisplayConfigurationChanged() call twice in 740 // avoid getting the OnDisplayConfigurationChanged() call twice in
741 // SetDisplayUIScale. Note that this scenario will never happen on 741 // SetDisplayUIScale. Note that this scenario will never happen on
742 // real devices. 742 // real devices.
743 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( 743 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId(
744 secondary_id); 744 secondary_id);
745 EXPECT_EQ(1, observer.CountAndReset()); 745 EXPECT_EQ(1, observer.CountAndReset());
746 746
747 display_manager()->SetDisplayUIScale(secondary_id, 1.125f); 747 test::DisplayManagerTestApi(display_manager())
748 .SetDisplayUIScale(secondary_id, 1.125f);
748 EXPECT_EQ(1, observer.CountAndReset()); 749 EXPECT_EQ(1, observer.CountAndReset());
749 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 750 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
750 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 751 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
751 display_manager()->SetDisplayUIScale(secondary_id, 1.125f); 752 test::DisplayManagerTestApi(display_manager())
753 .SetDisplayUIScale(secondary_id, 1.125f);
752 EXPECT_EQ(0, observer.CountAndReset()); 754 EXPECT_EQ(0, observer.CountAndReset());
753 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 755 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
754 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 756 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
755 display_manager()->SetDisplayUIScale(primary_id, 1.125f); 757 test::DisplayManagerTestApi(display_manager())
758 .SetDisplayUIScale(primary_id, 1.125f);
756 EXPECT_EQ(0, observer.CountAndReset()); 759 EXPECT_EQ(0, observer.CountAndReset());
757 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 760 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
758 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 761 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
759 display_manager()->SetDisplayUIScale(primary_id, 1.125f); 762 test::DisplayManagerTestApi(display_manager())
763 .SetDisplayUIScale(primary_id, 1.125f);
760 EXPECT_EQ(0, observer.CountAndReset()); 764 EXPECT_EQ(0, observer.CountAndReset());
761 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); 765 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset());
762 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); 766 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset());
763 } 767 }
764 768
765 TEST_P(WindowTreeHostManagerTest, FindNearestDisplay) { 769 TEST_P(WindowTreeHostManagerTest, FindNearestDisplay) {
766 if (!SupportsMultipleDisplays()) 770 if (!SupportsMultipleDisplays())
767 return; 771 return;
768 772
769 WindowTreeHostManager* window_tree_host_manager = 773 WindowTreeHostManager* window_tree_host_manager =
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 EXPECT_EQ("0,0 450x300", display1.bounds().ToString()); 1140 EXPECT_EQ("0,0 450x300", display1.bounds().ToString());
1137 EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString()); 1141 EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString());
1138 EXPECT_EQ("450,0 500x300", display2.bounds().ToString()); 1142 EXPECT_EQ("450,0 500x300", display2.bounds().ToString());
1139 EXPECT_EQ(1.5f, GetStoredUIScale(display1.id())); 1143 EXPECT_EQ(1.5f, GetStoredUIScale(display1.id()));
1140 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); 1144 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id()));
1141 1145
1142 ui::test::EventGenerator generator(root_windows[0]); 1146 ui::test::EventGenerator generator(root_windows[0]);
1143 generator.MoveMouseToInHost(599, 200); 1147 generator.MoveMouseToInHost(599, 200);
1144 EXPECT_EQ("449,150", event_handler.GetLocationAndReset()); 1148 EXPECT_EQ("449,150", event_handler.GetLocationAndReset());
1145 1149
1146 display_manager()->SetDisplayUIScale(display1.id(), 1.25f); 1150 test::DisplayManagerTestApi(display_manager())
1151 .SetDisplayUIScale(display1.id(), 1.25f);
1147 display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); 1152 display1 = display::Screen::GetScreen()->GetPrimaryDisplay();
1148 display2 = display_manager()->GetSecondaryDisplay(); 1153 display2 = display_manager()->GetSecondaryDisplay();
1149 EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); 1154 EXPECT_EQ("0,0 375x250", display1.bounds().ToString());
1150 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); 1155 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString());
1151 EXPECT_EQ("375,0 500x300", display2.bounds().ToString()); 1156 EXPECT_EQ("375,0 500x300", display2.bounds().ToString());
1152 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); 1157 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id()));
1153 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); 1158 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id()));
1154 1159
1155 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 1160 Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
1156 } 1161 }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 widget->GetNativeWindow()->GetRootWindow()); 1566 widget->GetNativeWindow()->GetRootWindow());
1562 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); 1567 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow());
1563 1568
1564 UpdateDisplay("300x300"); 1569 UpdateDisplay("300x300");
1565 watcher.Stop(); 1570 watcher.Stop();
1566 1571
1567 widget->CloseNow(); 1572 widget->CloseNow();
1568 } 1573 }
1569 1574
1570 } // namespace ash 1575 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/root_window_transformers_unittest.cc ('k') | ash/test/display_manager_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698