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

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

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: GetNativeScreen Created 4 years, 11 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
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"
(...skipping 166 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::GetScreenFor(Shell::GetPrimaryRootWindow()) 187 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
188 ->GetNumDisplays());
189 188
190 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 189 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
191 // Touch the right edge of the first display. Pointer should warp. 190 // Touch the right edge of the first display. Pointer should warp.
192 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 191 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
193 EXPECT_EQ("501,10", // by 2px. 192 EXPECT_EQ("501,10", // by 2px.
194 aura::Env::GetInstance()->last_mouse_location().ToString()); 193 aura::Env::GetInstance()->last_mouse_location().ToString());
195 194
196 // Touch the left edge of the second display. Pointer should warp. 195 // Touch the left edge of the second display. Pointer should warp.
197 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 196 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
198 EXPECT_EQ("498,10", // by 2px. 197 EXPECT_EQ("498,10", // by 2px.
199 aura::Env::GetInstance()->last_mouse_location().ToString()); 198 aura::Env::GetInstance()->last_mouse_location().ToString());
200 { 199 {
201 SCOPED_TRACE("1x1 NO WARP"); 200 SCOPED_TRACE("1x1 NO WARP");
202 NoWarpTestBody(); 201 NoWarpTestBody();
203 } 202 }
204 203
205 // With 2X and 1X displays 204 // With 2X and 1X displays
206 UpdateDisplay("500x500*2,600+0-500x500"); 205 UpdateDisplay("500x500*2,600+0-500x500");
207 ASSERT_EQ(1, gfx::Screen::GetScreenFor(Shell::GetPrimaryRootWindow()) 206 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
208 ->GetNumDisplays());
209 207
210 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 208 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
211 // Touch the right edge of the first display. Pointer should warp. 209 // Touch the right edge of the first display. Pointer should warp.
212 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 210 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
213 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).
214 aura::Env::GetInstance()->last_mouse_location().ToString()); 212 aura::Env::GetInstance()->last_mouse_location().ToString());
215 213
216 // Touch the left edge of the second display. Pointer should warp. 214 // Touch the left edge of the second display. Pointer should warp.
217 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 215 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
218 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).
219 aura::Env::GetInstance()->last_mouse_location().ToString()); 217 aura::Env::GetInstance()->last_mouse_location().ToString());
220 218
221 { 219 {
222 SCOPED_TRACE("2x1 NO WARP"); 220 SCOPED_TRACE("2x1 NO WARP");
223 NoWarpTestBody(); 221 NoWarpTestBody();
224 } 222 }
225 223
226 // With 1X and 2X displays 224 // With 1X and 2X displays
227 UpdateDisplay("500x500,600+0-500x500*2"); 225 UpdateDisplay("500x500,600+0-500x500*2");
228 ASSERT_EQ(1, gfx::Screen::GetScreenFor(Shell::GetPrimaryRootWindow()) 226 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
229 ->GetNumDisplays());
230 227
231 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 228 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
232 // Touch the right edge of the first display. Pointer should warp. 229 // Touch the right edge of the first display. Pointer should warp.
233 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 230 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
234 EXPECT_EQ("501,10", // by 2px. 231 EXPECT_EQ("501,10", // by 2px.
235 aura::Env::GetInstance()->last_mouse_location().ToString()); 232 aura::Env::GetInstance()->last_mouse_location().ToString());
236 233
237 // Touch the left edge of the second display. Pointer should warp. 234 // Touch the left edge of the second display. Pointer should warp.
238 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 235 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
239 EXPECT_EQ("498,10", // by 2px. 236 EXPECT_EQ("498,10", // by 2px.
240 aura::Env::GetInstance()->last_mouse_location().ToString()); 237 aura::Env::GetInstance()->last_mouse_location().ToString());
241 { 238 {
242 SCOPED_TRACE("1x2 NO WARP"); 239 SCOPED_TRACE("1x2 NO WARP");
243 NoWarpTestBody(); 240 NoWarpTestBody();
244 } 241 }
245 242
246 // With two 2X displays 243 // With two 2X displays
247 UpdateDisplay("500x500*2,600+0-500x500*2"); 244 UpdateDisplay("500x500*2,600+0-500x500*2");
248 ASSERT_EQ(1, gfx::Screen::GetScreenFor(Shell::GetPrimaryRootWindow()) 245 ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays());
249 ->GetNumDisplays());
250 246
251 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10))); 247 EXPECT_FALSE(TestIfMouseWarpsAt(gfx::Point(10, 10)));
252 // Touch the right edge of the first display. Pointer should warp. 248 // Touch the right edge of the first display. Pointer should warp.
253 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10))); 249 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(499, 10)));
254 EXPECT_EQ("250,5", // by 2px. 250 EXPECT_EQ("250,5", // by 2px.
255 aura::Env::GetInstance()->last_mouse_location().ToString()); 251 aura::Env::GetInstance()->last_mouse_location().ToString());
256 252
257 // Touch the left edge of the second display. Pointer should warp. 253 // Touch the left edge of the second display. Pointer should warp.
258 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 254 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
259 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).
260 aura::Env::GetInstance()->last_mouse_location().ToString()); 256 aura::Env::GetInstance()->last_mouse_location().ToString());
261 { 257 {
262 SCOPED_TRACE("1x2 NO WARP"); 258 SCOPED_TRACE("1x2 NO WARP");
263 NoWarpTestBody(); 259 NoWarpTestBody();
264 } 260 }
265 } 261 }
266 262
267 } // namespace aura 263 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698