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/wm/ash_native_cursor_manager.h" | 5 #include "ash/wm/ash_native_cursor_manager.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/cursor_manager_test_api.h" | 9 #include "ash/test/cursor_manager_test_api.h" |
10 #include "ash/wm/image_cursors.h" | 10 #include "ash/wm/image_cursors.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetDisplay().rotation()); | 166 EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetDisplay().rotation()); |
167 | 167 |
168 display.set_device_scale_factor(1.0f); | 168 display.set_device_scale_factor(1.0f); |
169 display.set_rotation(gfx::Display::ROTATE_270); | 169 display.set_rotation(gfx::Display::ROTATE_270); |
170 cursor_manager->SetDisplay(display); | 170 cursor_manager->SetDisplay(display); |
171 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); | 171 EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); |
172 EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetDisplay().rotation()); | 172 EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetDisplay().rotation()); |
173 } | 173 } |
174 | 174 |
175 TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { | 175 TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { |
176 aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); | 176 aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); |
177 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
178 if (base::win::GetVersion() < base::win::VERSION_WIN8) | 178 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
179 return; | 179 return; |
180 // On Windows 8 the ASH environment has two processes, the viewer process | 180 // On Windows 8 the ASH environment has two processes, the viewer process |
181 // which runs in Windows 8 mode and the browser process. The initialization | 181 // which runs in Windows 8 mode and the browser process. The initialization |
182 // happens when the viewer process connects to the browser channel and sends | 182 // happens when the viewer process connects to the browser channel and sends |
183 // the initial IPC message. | 183 // the initial IPC message. |
184 RunAllPendingInMessageLoop(); | 184 RunAllPendingInMessageLoop(); |
185 #endif | 185 #endif |
186 root_window->MoveCursorTo(gfx::Point(10, 10)); | 186 root_window->MoveCursorTo(gfx::Point(10, 10)); |
187 #if defined(OS_WIN) | 187 #if defined(OS_WIN) |
188 // The MoveCursor operation on Windows 8 is implemented in the viewer process | 188 // The MoveCursor operation on Windows 8 is implemented in the viewer process |
189 // which is notified by an IPC message to perform the MoveCursor operation. | 189 // which is notified by an IPC message to perform the MoveCursor operation. |
190 // We need to ensure that the IPC is delivered to the viewer process and it | 190 // We need to ensure that the IPC is delivered to the viewer process and it |
191 // the ACK is sent back from the viewer indicating that the operation | 191 // the ACK is sent back from the viewer indicating that the operation |
192 // completed. | 192 // completed. |
193 Sleep(100); | 193 Sleep(100); |
194 RunAllPendingInMessageLoop(); | 194 RunAllPendingInMessageLoop(); |
195 #endif | 195 #endif |
| 196 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); |
196 gfx::Point mouse_location; | 197 gfx::Point mouse_location; |
197 EXPECT_TRUE(root_window->QueryMouseLocationForTest(&mouse_location)); | 198 EXPECT_TRUE(dispatcher->QueryMouseLocationForTest(&mouse_location)); |
198 EXPECT_EQ("10,10", mouse_location.ToString()); | 199 EXPECT_EQ("10,10", mouse_location.ToString()); |
199 Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); | 200 Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); |
200 EXPECT_FALSE(root_window->QueryMouseLocationForTest(&mouse_location)); | 201 EXPECT_FALSE(dispatcher->QueryMouseLocationForTest(&mouse_location)); |
201 EXPECT_EQ("0,0", mouse_location.ToString()); | 202 EXPECT_EQ("0,0", mouse_location.ToString()); |
202 } | 203 } |
203 | 204 |
204 } // namespace test | 205 } // namespace test |
205 } // namespace ash | 206 } // namespace ash |
OLD | NEW |