| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cursor_window_controller.h" | 5 #include "ash/display/cursor_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_util.h" | 7 #include "ash/display/display_util.h" |
| 8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/display_manager_test_api.h" | 12 #include "ash/test/display_manager_test_api.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_tree_host.h" | 14 #include "ui/aura/window_tree_host.h" |
| 15 #include "ui/base/cursor/cursor.h" | 15 #include "ui/base/cursor/cursor.h" |
| 16 #include "ui/display/display.h" |
| 17 #include "ui/display/screen.h" |
| 16 #include "ui/events/test/event_generator.h" | 18 #include "ui/events/test/event_generator.h" |
| 17 #include "ui/gfx/display.h" | |
| 18 #include "ui/wm/core/coordinate_conversion.h" | 19 #include "ui/wm/core/coordinate_conversion.h" |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 | 22 |
| 22 class CursorWindowControllerTest : public test::AshTestBase { | 23 class CursorWindowControllerTest : public test::AshTestBase { |
| 23 public: | 24 public: |
| 24 CursorWindowControllerTest() {} | 25 CursorWindowControllerTest() {} |
| 25 ~CursorWindowControllerTest() override {} | 26 ~CursorWindowControllerTest() override {} |
| 26 | 27 |
| 27 // test::AshTestBase: | 28 // test::AshTestBase: |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Cursor was shown. | 148 // Cursor was shown. |
| 148 SetCursorCompositionEnabled(true); | 149 SetCursorCompositionEnabled(true); |
| 149 ASSERT_TRUE(GetCursorWindow()); | 150 ASSERT_TRUE(GetCursorWindow()); |
| 150 EXPECT_TRUE(GetCursorWindow()->IsVisible()); | 151 EXPECT_TRUE(GetCursorWindow()->IsVisible()); |
| 151 } | 152 } |
| 152 | 153 |
| 153 // Make sure that composition cursor stays big even when | 154 // Make sure that composition cursor stays big even when |
| 154 // the DSF becomes 1x as a result of zooming out. | 155 // the DSF becomes 1x as a result of zooming out. |
| 155 TEST_F(CursorWindowControllerTest, DSF) { | 156 TEST_F(CursorWindowControllerTest, DSF) { |
| 156 UpdateDisplay("1000x500*2"); | 157 UpdateDisplay("1000x500*2"); |
| 157 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); | 158 int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
| 158 | 159 |
| 159 test::ScopedSetInternalDisplayId set_internal(primary_id); | 160 test::ScopedSetInternalDisplayId set_internal(primary_id); |
| 160 SetCursorCompositionEnabled(true); | 161 SetCursorCompositionEnabled(true); |
| 161 ASSERT_EQ( | 162 ASSERT_EQ( |
| 162 2.0f, | 163 2.0f, |
| 163 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 164 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 164 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); | 165 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); |
| 165 | 166 |
| 166 ASSERT_TRUE(SetDisplayUIScale(primary_id, 2.0f)); | 167 ASSERT_TRUE(SetDisplayUIScale(primary_id, 2.0f)); |
| 167 ASSERT_EQ( | 168 ASSERT_EQ( |
| 168 1.0f, | 169 1.0f, |
| 169 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 170 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 170 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); | 171 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); |
| 171 } | 172 } |
| 172 #endif | 173 #endif |
| 173 | 174 |
| 174 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |