OLD | NEW |
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" |
11 #include "ash/common/shelf/shelf_widget.h" | 11 #include "ash/common/shelf/shelf_widget.h" |
12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
13 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
14 #include "ash/common/wm/wm_event.h" | 14 #include "ash/common/wm/wm_event.h" |
15 #include "ash/common/wm/wm_screen_util.h" | 15 #include "ash/common/wm/wm_screen_util.h" |
16 #include "ash/display/display_manager.h" | |
17 #include "ash/display/display_util.h" | 16 #include "ash/display/display_util.h" |
18 #include "ash/screen_util.h" | 17 #include "ash/screen_util.h" |
19 #include "ash/shell.h" | 18 #include "ash/shell.h" |
20 #include "ash/test/ash_md_test_base.h" | 19 #include "ash/test/ash_md_test_base.h" |
21 #include "ash/test/ash_test_base.h" | 20 #include "ash/test/ash_test_base.h" |
22 #include "ash/test/ash_test_helper.h" | 21 #include "ash/test/ash_test_helper.h" |
23 #include "ash/test/cursor_manager_test_api.h" | 22 #include "ash/test/cursor_manager_test_api.h" |
24 #include "ash/test/display_manager_test_api.h" | |
25 #include "ash/test/test_shell_delegate.h" | 23 #include "ash/test/test_shell_delegate.h" |
26 #include "ash/wm/window_state_aura.h" | 24 #include "ash/wm/window_state_aura.h" |
27 #include "base/command_line.h" | 25 #include "base/command_line.h" |
28 #include "ui/aura/client/focus_change_observer.h" | 26 #include "ui/aura/client/focus_change_observer.h" |
29 #include "ui/aura/client/focus_client.h" | 27 #include "ui/aura/client/focus_client.h" |
30 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
31 #include "ui/aura/window_observer.h" | 29 #include "ui/aura/window_observer.h" |
32 #include "ui/aura/window_tracker.h" | 30 #include "ui/aura/window_tracker.h" |
33 #include "ui/aura/window_tree_host.h" | 31 #include "ui/aura/window_tree_host.h" |
34 #include "ui/display/display.h" | 32 #include "ui/display/display.h" |
35 #include "ui/display/display_observer.h" | 33 #include "ui/display/display_observer.h" |
36 #include "ui/display/manager/display_layout.h" | 34 #include "ui/display/manager/display_layout.h" |
37 #include "ui/display/manager/display_layout_store.h" | 35 #include "ui/display/manager/display_layout_store.h" |
| 36 #include "ui/display/manager/display_manager.h" |
38 #include "ui/display/manager/managed_display_info.h" | 37 #include "ui/display/manager/managed_display_info.h" |
39 #include "ui/display/screen.h" | 38 #include "ui/display/screen.h" |
| 39 #include "ui/display/test/display_manager_test_api.h" |
40 #include "ui/events/event_handler.h" | 40 #include "ui/events/event_handler.h" |
41 #include "ui/events/test/event_generator.h" | 41 #include "ui/events/test/event_generator.h" |
42 #include "ui/views/mouse_watcher.h" | 42 #include "ui/views/mouse_watcher.h" |
43 #include "ui/views/mouse_watcher_view_host.h" | 43 #include "ui/views/mouse_watcher_view_host.h" |
44 #include "ui/views/view.h" | 44 #include "ui/views/view.h" |
45 #include "ui/views/widget/widget.h" | 45 #include "ui/views/widget/widget.h" |
46 #include "ui/wm/public/activation_change_observer.h" | 46 #include "ui/wm/public/activation_change_observer.h" |
47 #include "ui/wm/public/activation_client.h" | 47 #include "ui/wm/public/activation_client.h" |
48 | 48 |
49 namespace ash { | 49 namespace ash { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 test::AshTestBase* delegate_; // Not owned | 210 test::AshTestBase* delegate_; // Not owned |
211 DISALLOW_COPY_AND_ASSIGN(TestHelper); | 211 DISALLOW_COPY_AND_ASSIGN(TestHelper); |
212 }; | 212 }; |
213 | 213 |
214 TestHelper::TestHelper(test::AshTestBase* delegate) : delegate_(delegate) {} | 214 TestHelper::TestHelper(test::AshTestBase* delegate) : delegate_(delegate) {} |
215 TestHelper::~TestHelper() {} | 215 TestHelper::~TestHelper() {} |
216 | 216 |
217 void TestHelper::SetSecondaryDisplayLayoutAndOffset( | 217 void TestHelper::SetSecondaryDisplayLayoutAndOffset( |
218 display::DisplayPlacement::Position position, | 218 display::DisplayPlacement::Position position, |
219 int offset) { | 219 int offset) { |
220 std::unique_ptr<display::DisplayLayout> layout(test::CreateDisplayLayout( | 220 std::unique_ptr<display::DisplayLayout> layout( |
221 delegate_->display_manager(), position, offset)); | 221 display::test::CreateDisplayLayout(delegate_->display_manager(), position, |
| 222 offset)); |
222 ASSERT_GT(display::Screen::GetScreen()->GetNumDisplays(), 1); | 223 ASSERT_GT(display::Screen::GetScreen()->GetNumDisplays(), 1); |
223 delegate_->display_manager()->SetLayoutForCurrentDisplays(std::move(layout)); | 224 delegate_->display_manager()->SetLayoutForCurrentDisplays(std::move(layout)); |
224 } | 225 } |
225 | 226 |
226 void TestHelper::SetSecondaryDisplayLayout( | 227 void TestHelper::SetSecondaryDisplayLayout( |
227 display::DisplayPlacement::Position position) { | 228 display::DisplayPlacement::Position position) { |
228 SetSecondaryDisplayLayoutAndOffset(position, 0); | 229 SetSecondaryDisplayLayoutAndOffset(position, 0); |
229 } | 230 } |
230 | 231 |
231 void TestHelper::SetDefaultDisplayLayout( | 232 void TestHelper::SetDefaultDisplayLayout( |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 CreateMirroredDisplayInfo(1, 2.0f); | 616 CreateMirroredDisplayInfo(1, 2.0f); |
616 const display::ManagedDisplayInfo external_display_info = | 617 const display::ManagedDisplayInfo external_display_info = |
617 CreateMirroredDisplayInfo(2, 1.0f); | 618 CreateMirroredDisplayInfo(2, 1.0f); |
618 | 619 |
619 std::vector<display::ManagedDisplayInfo> display_info_list; | 620 std::vector<display::ManagedDisplayInfo> display_info_list; |
620 // Mirror. | 621 // Mirror. |
621 display_info_list.push_back(internal_display_info); | 622 display_info_list.push_back(internal_display_info); |
622 display_info_list.push_back(external_display_info); | 623 display_info_list.push_back(external_display_info); |
623 display_manager()->OnNativeDisplaysChanged(display_info_list); | 624 display_manager()->OnNativeDisplaysChanged(display_info_list); |
624 const int64_t internal_display_id = | 625 const int64_t internal_display_id = |
625 test::DisplayManagerTestApi(display_manager()) | 626 display::test::DisplayManagerTestApi(display_manager()) |
626 .SetFirstDisplayAsInternalDisplay(); | 627 .SetFirstDisplayAsInternalDisplay(); |
627 EXPECT_EQ(1, internal_display_id); | 628 EXPECT_EQ(1, internal_display_id); |
628 EXPECT_EQ(2U, display_manager()->num_connected_displays()); | 629 EXPECT_EQ(2U, display_manager()->num_connected_displays()); |
629 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 630 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
630 | 631 |
631 wm::WindowState* window_state = wm::GetWindowState(w1.get()); | 632 wm::WindowState* window_state = wm::GetWindowState(w1.get()); |
632 const wm::WMEvent toggle_fullscreen_event(wm::WM_EVENT_TOGGLE_FULLSCREEN); | 633 const wm::WMEvent toggle_fullscreen_event(wm::WM_EVENT_TOGGLE_FULLSCREEN); |
633 window_state->OnWMEvent(&toggle_fullscreen_event); | 634 window_state->OnWMEvent(&toggle_fullscreen_event); |
634 EXPECT_TRUE(window_state->IsFullscreen()); | 635 EXPECT_TRUE(window_state->IsFullscreen()); |
635 EXPECT_EQ("0,0 250x250", w1->bounds().ToString()); | 636 EXPECT_EQ("0,0 250x250", w1->bounds().ToString()); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 display_manager()->SetDisplayRotation( | 726 display_manager()->SetDisplayRotation( |
726 primary_id, display::Display::ROTATE_90, | 727 primary_id, display::Display::ROTATE_90, |
727 display::Display::ROTATION_SOURCE_ACTIVE); | 728 display::Display::ROTATION_SOURCE_ACTIVE); |
728 EXPECT_EQ(0, observer.GetRotationChangedCountAndReset()); | 729 EXPECT_EQ(0, observer.GetRotationChangedCountAndReset()); |
729 EXPECT_EQ(0, observer.CountAndReset()); | 730 EXPECT_EQ(0, observer.CountAndReset()); |
730 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 731 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
731 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 732 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
732 | 733 |
733 // UI scale is eanbled only on internal display. | 734 // UI scale is eanbled only on internal display. |
734 int64_t secondary_id = GetSecondaryDisplay().id(); | 735 int64_t secondary_id = GetSecondaryDisplay().id(); |
735 test::ScopedSetInternalDisplayId set_internal(display_manager(), | 736 display::test::ScopedSetInternalDisplayId set_internal(display_manager(), |
736 secondary_id); | 737 secondary_id); |
737 // Changing internal ID display changes the DisplayIdPair (it comes | 738 // Changing internal ID display changes the DisplayIdPair (it comes |
738 // first), which also changes the primary display candidate. Update | 739 // first), which also changes the primary display candidate. Update |
739 // the primary display manually to update the primary display to | 740 // the primary display manually to update the primary display to |
740 // avoid getting the OnDisplayConfigurationChanged() call twice in | 741 // avoid getting the OnDisplayConfigurationChanged() call twice in |
741 // SetDisplayUIScale. Note that this scenario will never happen on | 742 // SetDisplayUIScale. Note that this scenario will never happen on |
742 // real devices. | 743 // real devices. |
743 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( | 744 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( |
744 secondary_id); | 745 secondary_id); |
745 EXPECT_EQ(1, observer.CountAndReset()); | 746 EXPECT_EQ(1, observer.CountAndReset()); |
746 | 747 |
747 test::DisplayManagerTestApi(display_manager()) | 748 display::test::DisplayManagerTestApi(display_manager()) |
748 .SetDisplayUIScale(secondary_id, 1.125f); | 749 .SetDisplayUIScale(secondary_id, 1.125f); |
749 EXPECT_EQ(1, observer.CountAndReset()); | 750 EXPECT_EQ(1, observer.CountAndReset()); |
750 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 751 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
751 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 752 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
752 test::DisplayManagerTestApi(display_manager()) | 753 display::test::DisplayManagerTestApi(display_manager()) |
753 .SetDisplayUIScale(secondary_id, 1.125f); | 754 .SetDisplayUIScale(secondary_id, 1.125f); |
754 EXPECT_EQ(0, observer.CountAndReset()); | 755 EXPECT_EQ(0, observer.CountAndReset()); |
755 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 756 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
756 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 757 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
757 test::DisplayManagerTestApi(display_manager()) | 758 display::test::DisplayManagerTestApi(display_manager()) |
758 .SetDisplayUIScale(primary_id, 1.125f); | 759 .SetDisplayUIScale(primary_id, 1.125f); |
759 EXPECT_EQ(0, observer.CountAndReset()); | 760 EXPECT_EQ(0, observer.CountAndReset()); |
760 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 761 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
761 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 762 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
762 test::DisplayManagerTestApi(display_manager()) | 763 display::test::DisplayManagerTestApi(display_manager()) |
763 .SetDisplayUIScale(primary_id, 1.125f); | 764 .SetDisplayUIScale(primary_id, 1.125f); |
764 EXPECT_EQ(0, observer.CountAndReset()); | 765 EXPECT_EQ(0, observer.CountAndReset()); |
765 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 766 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
766 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 767 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
767 } | 768 } |
768 | 769 |
769 TEST_P(WindowTreeHostManagerTest, FindNearestDisplay) { | 770 TEST_P(WindowTreeHostManagerTest, FindNearestDisplay) { |
770 if (!SupportsMultipleDisplays()) | 771 if (!SupportsMultipleDisplays()) |
771 return; | 772 return; |
772 | 773 |
773 WindowTreeHostManager* window_tree_host_manager = | 774 WindowTreeHostManager* window_tree_host_manager = |
774 Shell::GetInstance()->window_tree_host_manager(); | 775 Shell::GetInstance()->window_tree_host_manager(); |
775 | 776 |
776 UpdateDisplay("200x200,300x300"); | 777 UpdateDisplay("200x200,300x300"); |
777 display_manager()->SetLayoutForCurrentDisplays(test::CreateDisplayLayout( | 778 display_manager()->SetLayoutForCurrentDisplays( |
778 display_manager(), display::DisplayPlacement::RIGHT, 50)); | 779 display::test::CreateDisplayLayout(display_manager(), |
| 780 display::DisplayPlacement::RIGHT, 50)); |
779 | 781 |
780 display::Display primary_display = | 782 display::Display primary_display = |
781 display::Screen::GetScreen()->GetPrimaryDisplay(); | 783 display::Screen::GetScreen()->GetPrimaryDisplay(); |
782 display::Display secondary_display = display_manager()->GetSecondaryDisplay(); | 784 display::Display secondary_display = display_manager()->GetSecondaryDisplay(); |
783 EXPECT_NE(primary_display.id(), secondary_display.id()); | 785 EXPECT_NE(primary_display.id(), secondary_display.id()); |
784 aura::Window* primary_root = | 786 aura::Window* primary_root = |
785 window_tree_host_manager->GetRootWindowForDisplayId(primary_display.id()); | 787 window_tree_host_manager->GetRootWindowForDisplayId(primary_display.id()); |
786 aura::Window* secondary_root = | 788 aura::Window* secondary_root = |
787 window_tree_host_manager->GetRootWindowForDisplayId( | 789 window_tree_host_manager->GetRootWindowForDisplayId( |
788 secondary_display.id()); | 790 secondary_display.id()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 const int height_offset = GetMdMaximizedWindowHeightOffset(); | 835 const int height_offset = GetMdMaximizedWindowHeightOffset(); |
834 | 836 |
835 WindowTreeHostManager* window_tree_host_manager = | 837 WindowTreeHostManager* window_tree_host_manager = |
836 Shell::GetInstance()->window_tree_host_manager(); | 838 Shell::GetInstance()->window_tree_host_manager(); |
837 | 839 |
838 UpdateDisplay("200x200,300x300"); | 840 UpdateDisplay("200x200,300x300"); |
839 display::Display primary_display = | 841 display::Display primary_display = |
840 display::Screen::GetScreen()->GetPrimaryDisplay(); | 842 display::Screen::GetScreen()->GetPrimaryDisplay(); |
841 display::Display secondary_display = display_manager()->GetSecondaryDisplay(); | 843 display::Display secondary_display = display_manager()->GetSecondaryDisplay(); |
842 | 844 |
843 display_manager()->SetLayoutForCurrentDisplays(test::CreateDisplayLayout( | 845 display_manager()->SetLayoutForCurrentDisplays( |
844 display_manager(), display::DisplayPlacement::RIGHT, 50)); | 846 display::test::CreateDisplayLayout(display_manager(), |
| 847 display::DisplayPlacement::RIGHT, 50)); |
845 | 848 |
846 EXPECT_NE(primary_display.id(), secondary_display.id()); | 849 EXPECT_NE(primary_display.id(), secondary_display.id()); |
847 aura::Window* primary_root = | 850 aura::Window* primary_root = |
848 window_tree_host_manager->GetRootWindowForDisplayId(primary_display.id()); | 851 window_tree_host_manager->GetRootWindowForDisplayId(primary_display.id()); |
849 aura::Window* secondary_root = | 852 aura::Window* secondary_root = |
850 window_tree_host_manager->GetRootWindowForDisplayId( | 853 window_tree_host_manager->GetRootWindowForDisplayId( |
851 secondary_display.id()); | 854 secondary_display.id()); |
852 aura::Window* shelf_window = | 855 aura::Window* shelf_window = |
853 GetPrimaryShelf()->shelf_widget()->GetNativeView(); | 856 GetPrimaryShelf()->shelf_widget()->GetNativeView(); |
854 EXPECT_TRUE(primary_root->Contains(shelf_window)); | 857 EXPECT_TRUE(primary_root->Contains(shelf_window)); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString()); | 1074 EXPECT_EQ("150x200", root_windows[1]->bounds().size().ToString()); |
1072 EXPECT_EQ("200,0 150x200", | 1075 EXPECT_EQ("200,0 150x200", |
1073 display_manager()->GetSecondaryDisplay().bounds().ToString()); | 1076 display_manager()->GetSecondaryDisplay().bounds().ToString()); |
1074 generator1.MoveMouseToInHost(50, 40); | 1077 generator1.MoveMouseToInHost(50, 40); |
1075 EXPECT_EQ("40,69", event_handler.GetLocationAndReset()); | 1078 EXPECT_EQ("40,69", event_handler.GetLocationAndReset()); |
1076 EXPECT_EQ(display::Display::ROTATE_90, | 1079 EXPECT_EQ(display::Display::ROTATE_90, |
1077 GetActiveDisplayRotation(display1.id())); | 1080 GetActiveDisplayRotation(display1.id())); |
1078 EXPECT_EQ(display::Display::ROTATE_0, GetActiveDisplayRotation(display2_id)); | 1081 EXPECT_EQ(display::Display::ROTATE_0, GetActiveDisplayRotation(display2_id)); |
1079 EXPECT_EQ(1, observer.GetRotationChangedCountAndReset()); | 1082 EXPECT_EQ(1, observer.GetRotationChangedCountAndReset()); |
1080 | 1083 |
1081 display_manager()->SetLayoutForCurrentDisplays(test::CreateDisplayLayout( | 1084 display_manager()->SetLayoutForCurrentDisplays( |
1082 display_manager(), display::DisplayPlacement::BOTTOM, 50)); | 1085 display::test::CreateDisplayLayout( |
| 1086 display_manager(), display::DisplayPlacement::BOTTOM, 50)); |
1083 EXPECT_EQ("50,120 150x200", | 1087 EXPECT_EQ("50,120 150x200", |
1084 display_manager()->GetSecondaryDisplay().bounds().ToString()); | 1088 display_manager()->GetSecondaryDisplay().bounds().ToString()); |
1085 | 1089 |
1086 display_manager()->SetDisplayRotation( | 1090 display_manager()->SetDisplayRotation( |
1087 display2_id, display::Display::ROTATE_270, | 1091 display2_id, display::Display::ROTATE_270, |
1088 display::Display::ROTATION_SOURCE_ACTIVE); | 1092 display::Display::ROTATION_SOURCE_ACTIVE); |
1089 EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString()); | 1093 EXPECT_EQ("200x120", root_windows[0]->bounds().size().ToString()); |
1090 EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString()); | 1094 EXPECT_EQ("200x150", root_windows[1]->bounds().size().ToString()); |
1091 EXPECT_EQ("50,120 200x150", | 1095 EXPECT_EQ("50,120 200x150", |
1092 display_manager()->GetSecondaryDisplay().bounds().ToString()); | 1096 display_manager()->GetSecondaryDisplay().bounds().ToString()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 TEST_P(WindowTreeHostManagerTest, ScaleRootWindow) { | 1129 TEST_P(WindowTreeHostManagerTest, ScaleRootWindow) { |
1126 if (!SupportsMultipleDisplays()) | 1130 if (!SupportsMultipleDisplays()) |
1127 return; | 1131 return; |
1128 | 1132 |
1129 TestEventHandler event_handler; | 1133 TestEventHandler event_handler; |
1130 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 1134 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
1131 | 1135 |
1132 UpdateDisplay("600x400*2@1.5,500x300"); | 1136 UpdateDisplay("600x400*2@1.5,500x300"); |
1133 | 1137 |
1134 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1138 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
1135 test::ScopedSetInternalDisplayId set_internal(display_manager(), | 1139 display::test::ScopedSetInternalDisplayId set_internal(display_manager(), |
1136 display1.id()); | 1140 display1.id()); |
1137 | 1141 |
1138 display::Display display2 = display_manager()->GetSecondaryDisplay(); | 1142 display::Display display2 = display_manager()->GetSecondaryDisplay(); |
1139 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 1143 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
1140 EXPECT_EQ("0,0 450x300", display1.bounds().ToString()); | 1144 EXPECT_EQ("0,0 450x300", display1.bounds().ToString()); |
1141 EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString()); | 1145 EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString()); |
1142 EXPECT_EQ("450,0 500x300", display2.bounds().ToString()); | 1146 EXPECT_EQ("450,0 500x300", display2.bounds().ToString()); |
1143 EXPECT_EQ(1.5f, GetStoredUIScale(display1.id())); | 1147 EXPECT_EQ(1.5f, GetStoredUIScale(display1.id())); |
1144 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); | 1148 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); |
1145 | 1149 |
1146 ui::test::EventGenerator generator(root_windows[0]); | 1150 ui::test::EventGenerator generator(root_windows[0]); |
1147 generator.MoveMouseToInHost(599, 200); | 1151 generator.MoveMouseToInHost(599, 200); |
1148 EXPECT_EQ("449,150", event_handler.GetLocationAndReset()); | 1152 EXPECT_EQ("449,150", event_handler.GetLocationAndReset()); |
1149 | 1153 |
1150 test::DisplayManagerTestApi(display_manager()) | 1154 display::test::DisplayManagerTestApi(display_manager()) |
1151 .SetDisplayUIScale(display1.id(), 1.25f); | 1155 .SetDisplayUIScale(display1.id(), 1.25f); |
1152 display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1156 display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
1153 display2 = display_manager()->GetSecondaryDisplay(); | 1157 display2 = display_manager()->GetSecondaryDisplay(); |
1154 EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); | 1158 EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); |
1155 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); | 1159 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); |
1156 EXPECT_EQ("375,0 500x300", display2.bounds().ToString()); | 1160 EXPECT_EQ("375,0 500x300", display2.bounds().ToString()); |
1157 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); | 1161 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); |
1158 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); | 1162 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); |
1159 | 1163 |
1160 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 1164 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 CreateDisplayInfo(internal_id, 0, display::Display::ROTATE_0); | 1268 CreateDisplayInfo(internal_id, 0, display::Display::ROTATE_0); |
1265 const display::ManagedDisplayInfo external_display_info = | 1269 const display::ManagedDisplayInfo external_display_info = |
1266 CreateDisplayInfo(2, 1, display::Display::ROTATE_90); | 1270 CreateDisplayInfo(2, 1, display::Display::ROTATE_90); |
1267 | 1271 |
1268 std::vector<display::ManagedDisplayInfo> display_info_list; | 1272 std::vector<display::ManagedDisplayInfo> display_info_list; |
1269 // Extended | 1273 // Extended |
1270 display_info_list.push_back(internal_display_info); | 1274 display_info_list.push_back(internal_display_info); |
1271 display_info_list.push_back(external_display_info); | 1275 display_info_list.push_back(external_display_info); |
1272 display_manager()->OnNativeDisplaysChanged(display_info_list); | 1276 display_manager()->OnNativeDisplaysChanged(display_info_list); |
1273 const int64_t internal_display_id = | 1277 const int64_t internal_display_id = |
1274 test::DisplayManagerTestApi(display_manager()) | 1278 display::test::DisplayManagerTestApi(display_manager()) |
1275 .SetFirstDisplayAsInternalDisplay(); | 1279 .SetFirstDisplayAsInternalDisplay(); |
1276 EXPECT_EQ(internal_id, internal_display_id); | 1280 EXPECT_EQ(internal_id, internal_display_id); |
1277 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 1281 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
1278 | 1282 |
1279 // Dock mode. | 1283 // Dock mode. |
1280 display_info_list.clear(); | 1284 display_info_list.clear(); |
1281 display_info_list.push_back(external_display_info); | 1285 display_info_list.push_back(external_display_info); |
1282 display_manager()->OnNativeDisplaysChanged(display_info_list); | 1286 display_manager()->OnNativeDisplaysChanged(display_info_list); |
1283 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 1287 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
1284 EXPECT_FALSE(Shell::GetPrimaryRootWindow() | 1288 EXPECT_FALSE(Shell::GetPrimaryRootWindow() |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 widget->GetNativeWindow()->GetRootWindow()); | 1570 widget->GetNativeWindow()->GetRootWindow()); |
1567 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); | 1571 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); |
1568 | 1572 |
1569 UpdateDisplay("300x300"); | 1573 UpdateDisplay("300x300"); |
1570 watcher.Stop(); | 1574 watcher.Stop(); |
1571 | 1575 |
1572 widget->CloseNow(); | 1576 widget->CloseNow(); |
1573 } | 1577 } |
1574 | 1578 |
1575 } // namespace ash | 1579 } // namespace ash |
OLD | NEW |