Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: ash/display/unified_mouse_warp_controller_unittest.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/display/unified_mouse_warp_controller.cc ('k') | ash/display/window_tree_host_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/unified_mouse_warp_controller.h" 5 #include "ash/display/unified_mouse_warp_controller.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/display/display_util.h" 8 #include "ash/display/display_util.h"
9 #include "ash/display/mirror_window_controller.h" 9 #include "ash/display/mirror_window_controller.h"
10 #include "ash/display/mouse_cursor_event_filter.h" 10 #include "ash/display/mouse_cursor_event_filter.h"
11 #include "ash/host/ash_window_tree_host.h" 11 #include "ash/host/ash_window_tree_host.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
14 #include "ash/test/display_manager_test_api.h" 14 #include "ash/test/display_manager_test_api.h"
15 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
16 #include "ui/aura/window_tree_host.h" 16 #include "ui/aura/window_tree_host.h"
17 #include "ui/display/display.h"
18 #include "ui/display/screen.h"
17 #include "ui/events/test/event_generator.h" 19 #include "ui/events/test/event_generator.h"
18 #include "ui/gfx/display.h"
19 #include "ui/gfx/screen.h"
20 #include "ui/wm/core/coordinate_conversion.h" 20 #include "ui/wm/core/coordinate_conversion.h"
21 21
22 namespace ash { 22 namespace ash {
23 23
24 class UnifiedMouseWarpControllerTest : public test::AshTestBase { 24 class UnifiedMouseWarpControllerTest : public test::AshTestBase {
25 public: 25 public:
26 UnifiedMouseWarpControllerTest() {} 26 UnifiedMouseWarpControllerTest() {}
27 ~UnifiedMouseWarpControllerTest() override {} 27 ~UnifiedMouseWarpControllerTest() override {}
28 28
29 void SetUp() override { 29 void SetUp() override {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 BoundaryTestBody("400x400*2,0+450-700x400*2", "400x400*2,0+450-700x600*2"); 177 BoundaryTestBody("400x400*2,0+450-700x400*2", "400x400*2,0+450-700x600*2");
178 } 178 }
179 } 179 }
180 180
181 // Verifies if the mouse pointer correctly moves to another display in 181 // Verifies if the mouse pointer correctly moves to another display in
182 // unified desktop mode. 182 // unified desktop mode.
183 TEST_F(UnifiedMouseWarpControllerTest, WarpMouse) { 183 TEST_F(UnifiedMouseWarpControllerTest, WarpMouse) {
184 if (!SupportsMultipleDisplays()) 184 if (!SupportsMultipleDisplays())
185 return; 185 return;
186 UpdateDisplay("500x500,600+0-500x500"); 186 UpdateDisplay("500x500,600+0-500x500");
187 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); 187 ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
188 188
189 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 189 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
190 // Touch the right edge of the first display. Pointer should warp. 190 // Touch the right edge of the first display. Pointer should warp.
191 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 191 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
192 EXPECT_EQ("501,10", // by 2px. 192 EXPECT_EQ("501,10", // by 2px.
193 aura::Env::GetInstance()->last_mouse_location().ToString()); 193 aura::Env::GetInstance()->last_mouse_location().ToString());
194 194
195 // Touch the left edge of the second display. Pointer should warp. 195 // Touch the left edge of the second display. Pointer should warp.
196 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 196 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
197 EXPECT_EQ("498,10", // by 2px. 197 EXPECT_EQ("498,10", // by 2px.
198 aura::Env::GetInstance()->last_mouse_location().ToString()); 198 aura::Env::GetInstance()->last_mouse_location().ToString());
199 { 199 {
200 SCOPED_TRACE("1x1 NO WARP"); 200 SCOPED_TRACE("1x1 NO WARP");
201 NoWarpTestBody(); 201 NoWarpTestBody();
202 } 202 }
203 203
204 // With 2X and 1X displays 204 // With 2X and 1X displays
205 UpdateDisplay("500x500*2,600+0-500x500"); 205 UpdateDisplay("500x500*2,600+0-500x500");
206 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); 206 ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
207 207
208 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 208 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
209 // Touch the right edge of the first display. Pointer should warp. 209 // Touch the right edge of the first display. Pointer should warp.
210 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 210 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
211 EXPECT_EQ("250,5", // moved to 501 by 2px, devided by 2 (dsf). 211 EXPECT_EQ("250,5", // moved to 501 by 2px, devided by 2 (dsf).
212 aura::Env::GetInstance()->last_mouse_location().ToString()); 212 aura::Env::GetInstance()->last_mouse_location().ToString());
213 213
214 // Touch the left edge of the second display. Pointer should warp. 214 // Touch the left edge of the second display. Pointer should warp.
215 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 215 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
216 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf). 216 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf).
217 aura::Env::GetInstance()->last_mouse_location().ToString()); 217 aura::Env::GetInstance()->last_mouse_location().ToString());
218 218
219 { 219 {
220 SCOPED_TRACE("2x1 NO WARP"); 220 SCOPED_TRACE("2x1 NO WARP");
221 NoWarpTestBody(); 221 NoWarpTestBody();
222 } 222 }
223 223
224 // With 1X and 2X displays 224 // With 1X and 2X displays
225 UpdateDisplay("500x500,600+0-500x500*2"); 225 UpdateDisplay("500x500,600+0-500x500*2");
226 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); 226 ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
227 227
228 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 228 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
229 // Touch the right edge of the first display. Pointer should warp. 229 // Touch the right edge of the first display. Pointer should warp.
230 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 230 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
231 EXPECT_EQ("501,10", // by 2px. 231 EXPECT_EQ("501,10", // by 2px.
232 aura::Env::GetInstance()->last_mouse_location().ToString()); 232 aura::Env::GetInstance()->last_mouse_location().ToString());
233 233
234 // Touch the left edge of the second display. Pointer should warp. 234 // Touch the left edge of the second display. Pointer should warp.
235 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 235 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
236 EXPECT_EQ("498,10", // by 2px. 236 EXPECT_EQ("498,10", // by 2px.
237 aura::Env::GetInstance()->last_mouse_location().ToString()); 237 aura::Env::GetInstance()->last_mouse_location().ToString());
238 { 238 {
239 SCOPED_TRACE("1x2 NO WARP"); 239 SCOPED_TRACE("1x2 NO WARP");
240 NoWarpTestBody(); 240 NoWarpTestBody();
241 } 241 }
242 242
243 // With two 2X displays 243 // With two 2X displays
244 UpdateDisplay("500x500*2,600+0-500x500*2"); 244 UpdateDisplay("500x500*2,600+0-500x500*2");
245 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); 245 ASSERT_EQ(1, display::Screen::GetScreen()->GetNumDisplays());
246 246
247 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 247 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
248 // Touch the right edge of the first display. Pointer should warp. 248 // Touch the right edge of the first display. Pointer should warp.
249 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 249 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
250 EXPECT_EQ("250,5", // by 2px. 250 EXPECT_EQ("250,5", // by 2px.
251 aura::Env::GetInstance()->last_mouse_location().ToString()); 251 aura::Env::GetInstance()->last_mouse_location().ToString());
252 252
253 // Touch the left edge of the second display. Pointer should warp. 253 // Touch the left edge of the second display. Pointer should warp.
254 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 254 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
255 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf). 255 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf).
256 aura::Env::GetInstance()->last_mouse_location().ToString()); 256 aura::Env::GetInstance()->last_mouse_location().ToString());
257 { 257 {
258 SCOPED_TRACE("1x2 NO WARP"); 258 SCOPED_TRACE("1x2 NO WARP");
259 NoWarpTestBody(); 259 NoWarpTestBody();
260 } 260 }
261 } 261 }
262 262
263 } // namespace aura 263 } // namespace aura
OLDNEW
« no previous file with comments | « ash/display/unified_mouse_warp_controller.cc ('k') | ash/display/window_tree_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698