| 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/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // WindowTreeHost::MoveCursorTo(). EventGenerator uses a hack to move the | 95 // WindowTreeHost::MoveCursorTo(). EventGenerator uses a hack to move the |
| 96 // cursor between displays. | 96 // cursor between displays. |
| 97 // Screen location: 220, 50 | 97 // Screen location: 220, 50 |
| 98 // Root location: 20, 50 | 98 // Root location: 20, 50 |
| 99 secondary_root->MoveCursorTo(gfx::Point(20, 50)); | 99 secondary_root->MoveCursorTo(gfx::Point(20, 50)); |
| 100 | 100 |
| 101 // Chrome relies on WindowTreeHost::MoveCursorTo() dispatching a mouse move | 101 // Chrome relies on WindowTreeHost::MoveCursorTo() dispatching a mouse move |
| 102 // asynchronously. This is implemented in a platform specific way. Generate a | 102 // asynchronously. This is implemented in a platform specific way. Generate a |
| 103 // fake mouse move instead of waiting. | 103 // fake mouse move instead of waiting. |
| 104 gfx::Point new_cursor_position_in_host(20, 50); | 104 gfx::Point new_cursor_position_in_host(20, 50); |
| 105 secondary_root->GetHost()->ConvertPointToHost(&new_cursor_position_in_host); | 105 secondary_root->GetHost()->ConvertPointFromDIPToHost( |
| 106 &new_cursor_position_in_host); |
| 106 ui::test::EventGenerator secondary_generator(secondary_root); | 107 ui::test::EventGenerator secondary_generator(secondary_root); |
| 107 secondary_generator.MoveMouseToInHost(new_cursor_position_in_host); | 108 secondary_generator.MoveMouseToInHost(new_cursor_position_in_host); |
| 108 | 109 |
| 109 EXPECT_TRUE(secondary_root->Contains(GetCursorWindow())); | 110 EXPECT_TRUE(secondary_root->Contains(GetCursorWindow())); |
| 110 EXPECT_EQ(secondary_display_id, GetCursorDisplayId()); | 111 EXPECT_EQ(secondary_display_id, GetCursorDisplayId()); |
| 111 EXPECT_EQ(ui::kCursorNull, GetCursorType()); | 112 EXPECT_EQ(ui::kCursorNull, GetCursorType()); |
| 112 hot_point = GetCursorHotPoint(); | 113 hot_point = GetCursorHotPoint(); |
| 113 EXPECT_EQ("3,3", hot_point.ToString()); | 114 EXPECT_EQ("3,3", hot_point.ToString()); |
| 114 cursor_bounds = GetCursorWindow()->GetBoundsInScreen(); | 115 cursor_bounds = GetCursorWindow()->GetBoundsInScreen(); |
| 115 EXPECT_EQ(220, cursor_bounds.x() + hot_point.x()); | 116 EXPECT_EQ(220, cursor_bounds.x() + hot_point.x()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ASSERT_TRUE(display::test::DisplayManagerTestApi(display_manager()) | 168 ASSERT_TRUE(display::test::DisplayManagerTestApi(display_manager()) |
| 168 .SetDisplayUIScale(primary_id, 2.0f)); | 169 .SetDisplayUIScale(primary_id, 2.0f)); |
| 169 ASSERT_EQ( | 170 ASSERT_EQ( |
| 170 1.0f, | 171 1.0f, |
| 171 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); | 172 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); |
| 172 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); | 173 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); |
| 173 } | 174 } |
| 174 #endif | 175 #endif |
| 175 | 176 |
| 176 } // namespace ash | 177 } // namespace ash |
| OLD | NEW |