OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ash/wm/ash_native_cursor_manager.h" | 4 #include "ash/wm/ash_native_cursor_manager.h" |
5 | 5 |
6 #include "ash/display/display_info.h" | 6 #include "ash/display/display_info.h" |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/test/cursor_manager_test_api.h" | 10 #include "ash/test/cursor_manager_test_api.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); | 43 resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); |
44 ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 44 ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
45 resources_pack_path, ui::SCALE_FACTOR_NONE); | 45 resources_pack_path, ui::SCALE_FACTOR_NONE); |
46 | 46 |
47 test::AshTestBase::SetUp(); | 47 test::AshTestBase::SetUp(); |
48 } | 48 } |
49 }; | 49 }; |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 internal::DisplayInfo CreateDisplayInfo(int64 id, | 53 DisplayInfo CreateDisplayInfo(int64 id, |
54 const gfx::Rect& bounds, | 54 const gfx::Rect& bounds, |
55 float device_scale_factor) { | 55 float device_scale_factor) { |
56 internal::DisplayInfo info(id, "", false); | 56 DisplayInfo info(id, "", false); |
57 info.SetBounds(bounds); | 57 info.SetBounds(bounds); |
58 info.set_device_scale_factor(device_scale_factor); | 58 info.set_device_scale_factor(device_scale_factor); |
59 return info; | 59 return info; |
60 } | 60 } |
61 | 61 |
62 void MoveMouseSync(aura::Window* window, int x, int y) { | 62 void MoveMouseSync(aura::Window* window, int x, int y) { |
63 #if defined(USE_X11) | 63 #if defined(USE_X11) |
64 XWarpPointer(base::MessagePumpX11::GetDefaultXDisplay(), | 64 XWarpPointer(base::MessagePumpX11::GetDefaultXDisplay(), |
65 None, | 65 None, |
66 window->GetHost()->GetAcceleratedWidget(), | 66 window->GetHost()->GetAcceleratedWidget(), |
(...skipping 19 matching lines...) Expand all Loading... |
86 #if defined(USE_X11) | 86 #if defined(USE_X11) |
87 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify | 87 #define MAYBE_CursorChangeOnEnterNotify CursorChangeOnEnterNotify |
88 #else | 88 #else |
89 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify | 89 #define MAYBE_CursorChangeOnEnterNotify DISABLED_CursorChangeOnEnterNotify |
90 #endif | 90 #endif |
91 | 91 |
92 TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) { | 92 TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) { |
93 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); | 93 CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); |
94 test::CursorManagerTestApi test_api(cursor_manager); | 94 test::CursorManagerTestApi test_api(cursor_manager); |
95 | 95 |
96 internal::DisplayManager* display_manager = | 96 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
97 Shell::GetInstance()->display_manager(); | 97 DisplayInfo display_info1 = |
98 internal::DisplayInfo display_info1 = | |
99 CreateDisplayInfo(10, gfx::Rect(0, 0, 500, 300), 1.0f); | 98 CreateDisplayInfo(10, gfx::Rect(0, 0, 500, 300), 1.0f); |
100 internal::DisplayInfo display_info2 = | 99 DisplayInfo display_info2 = |
101 CreateDisplayInfo(20, gfx::Rect(500, 0, 500, 300), 2.0f); | 100 CreateDisplayInfo(20, gfx::Rect(500, 0, 500, 300), 2.0f); |
102 std::vector<internal::DisplayInfo> display_info_list; | 101 std::vector<DisplayInfo> display_info_list; |
103 display_info_list.push_back(display_info1); | 102 display_info_list.push_back(display_info1); |
104 display_info_list.push_back(display_info2); | 103 display_info_list.push_back(display_info2); |
105 display_manager->OnNativeDisplaysChanged(display_info_list); | 104 display_manager->OnNativeDisplaysChanged(display_info_list); |
106 | 105 |
107 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); | 106 MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); |
108 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 107 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); |
109 | 108 |
110 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); | 109 MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); |
111 EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); | 110 EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); |
112 } | 111 } |
113 | 112 |
114 } // namespace ash | 113 } // namespace ash |
OLD | NEW |