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/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
9 #include "ash/display/display_layout_store.h" | 9 #include "ash/display/display_layout_store.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 display_controller->GetRootWindowForDisplayId(primary_display.id()); | 928 display_controller->GetRootWindowForDisplayId(primary_display.id()); |
929 aura::Window* secondary_root = | 929 aura::Window* secondary_root = |
930 display_controller->GetRootWindowForDisplayId(secondary_display.id()); | 930 display_controller->GetRootWindowForDisplayId(secondary_display.id()); |
931 EXPECT_NE(primary_root, secondary_root); | 931 EXPECT_NE(primary_root, secondary_root); |
932 | 932 |
933 test::CursorManagerTestApi test_api(Shell::GetInstance()->cursor_manager()); | 933 test::CursorManagerTestApi test_api(Shell::GetInstance()->cursor_manager()); |
934 | 934 |
935 EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> | 935 EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> |
936 device_scale_factor()); | 936 device_scale_factor()); |
937 primary_root->MoveCursorTo(gfx::Point(50, 50)); | 937 primary_root->MoveCursorTo(gfx::Point(50, 50)); |
938 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 938 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
939 EXPECT_EQ(2.0f, secondary_root->GetHost()->compositor()-> | 939 EXPECT_EQ(2.0f, secondary_root->GetHost()->compositor()-> |
940 device_scale_factor()); | 940 device_scale_factor()); |
941 secondary_root->MoveCursorTo(gfx::Point(50, 50)); | 941 secondary_root->MoveCursorTo(gfx::Point(50, 50)); |
942 EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); | 942 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
943 | 943 |
944 // Switch primary and secondary | 944 // Switch primary and secondary |
945 display_controller->SetPrimaryDisplay(secondary_display); | 945 display_controller->SetPrimaryDisplay(secondary_display); |
946 | 946 |
947 // Cursor's device scale factor should be updated accroding to the swap of | 947 // Cursor's device scale factor should be updated accroding to the swap of |
948 // primary and secondary. | 948 // primary and secondary. |
949 EXPECT_EQ(1.0f, secondary_root->GetHost()->compositor()-> | 949 EXPECT_EQ(1.0f, secondary_root->GetHost()->compositor()-> |
950 device_scale_factor()); | 950 device_scale_factor()); |
951 secondary_root->MoveCursorTo(gfx::Point(50, 50)); | 951 secondary_root->MoveCursorTo(gfx::Point(50, 50)); |
952 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 952 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
953 primary_root->MoveCursorTo(gfx::Point(50, 50)); | 953 primary_root->MoveCursorTo(gfx::Point(50, 50)); |
954 EXPECT_EQ(2.0f, primary_root->GetHost()->compositor()-> | 954 EXPECT_EQ(2.0f, primary_root->GetHost()->compositor()-> |
955 device_scale_factor()); | 955 device_scale_factor()); |
956 EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); | 956 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
957 | 957 |
958 // Deleting 2nd display. | 958 // Deleting 2nd display. |
959 UpdateDisplay("200x200"); | 959 UpdateDisplay("200x200"); |
960 RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task. | 960 RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task. |
961 | 961 |
962 // Cursor's device scale factor should be updated even without moving cursor. | 962 // Cursor's device scale factor should be updated even without moving cursor. |
963 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 963 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
964 | 964 |
965 primary_root->MoveCursorTo(gfx::Point(50, 50)); | 965 primary_root->MoveCursorTo(gfx::Point(50, 50)); |
966 EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> | 966 EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> |
967 device_scale_factor()); | 967 device_scale_factor()); |
968 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 968 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
969 } | 969 } |
970 | 970 |
971 TEST_F(DisplayControllerTest, OverscanInsets) { | 971 TEST_F(DisplayControllerTest, OverscanInsets) { |
972 if (!SupportsMultipleDisplays()) | 972 if (!SupportsMultipleDisplays()) |
973 return; | 973 return; |
974 | 974 |
975 DisplayController* display_controller = | 975 DisplayController* display_controller = |
976 Shell::GetInstance()->display_controller(); | 976 Shell::GetInstance()->display_controller(); |
977 TestEventHandler event_handler; | 977 TestEventHandler event_handler; |
978 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 978 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetHost())); | 1293 EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetHost())); |
1294 | 1294 |
1295 // Switching back to single display. | 1295 // Switching back to single display. |
1296 UpdateDisplay("300x400"); | 1296 UpdateDisplay("300x400"); |
1297 EXPECT_EQ("aura_root_0", GetXWindowName( | 1297 EXPECT_EQ("aura_root_0", GetXWindowName( |
1298 Shell::GetPrimaryRootWindow()->GetHost())); | 1298 Shell::GetPrimaryRootWindow()->GetHost())); |
1299 } | 1299 } |
1300 #endif | 1300 #endif |
1301 | 1301 |
1302 } // namespace ash | 1302 } // namespace ash |
OLD | NEW |