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

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

Issue 1631023002: Fix moving the mouse between two displays after the secondary display becomes primary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: 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/extended_mouse_warp_controller.h" 5 #include "ash/display/extended_mouse_warp_controller.h"
6 6
7 #include "ash/display/display_layout_store.h" 7 #include "ash/display/display_layout_store.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/display/mouse_cursor_event_filter.h" 9 #include "ash/display/mouse_cursor_event_filter.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds); 208 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
209 209
210 event_filter()->HideSharedEdgeIndicator(); 210 event_filter()->HideSharedEdgeIndicator();
211 } 211 }
212 212
213 // Verify indicators show up as expected with 3+ displays. 213 // Verify indicators show up as expected with 3+ displays.
214 TEST_F(ExtendedMouseWarpControllerTest, IndicatorBoundsTestThreeDisplays) { 214 TEST_F(ExtendedMouseWarpControllerTest, IndicatorBoundsTestThreeDisplays) {
215 if (!SupportsMultipleDisplays()) 215 if (!SupportsMultipleDisplays())
216 return; 216 return;
217 217
218 auto run_test = [this] {
219 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
220
221 // Left most display
222 event_filter()->ShowSharedEdgeIndicator(root_windows[0]);
223 ASSERT_EQ(2U, mouse_warp_controller()->warp_regions_.size());
224 EXPECT_EQ(gfx::Rect(359, 16, 1, 344),
225 mouse_warp_controller()->warp_regions_[0]->a_indicator_bounds);
226 EXPECT_EQ(gfx::Rect(360, 0, 1, 360),
227 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
228 EXPECT_EQ(gfx::Rect(1060, 16, 1, 684),
229 mouse_warp_controller()->warp_regions_[1]->a_indicator_bounds);
230 EXPECT_EQ(gfx::Rect(1059, 0, 1, 700),
231 mouse_warp_controller()->warp_regions_[1]->b_indicator_bounds);
232
233 // Middle display
234 event_filter()->ShowSharedEdgeIndicator(root_windows[1]);
235 ASSERT_EQ(2U, mouse_warp_controller()->warp_regions_.size());
236 EXPECT_EQ(gfx::Rect(360, 16, 1, 344),
237 mouse_warp_controller()->warp_regions_[0]->a_indicator_bounds);
238 EXPECT_EQ(gfx::Rect(359, 0, 1, 360),
239 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
240 EXPECT_EQ(gfx::Rect(1059, 16, 1, 684),
241 mouse_warp_controller()->warp_regions_[1]->a_indicator_bounds);
242 EXPECT_EQ(gfx::Rect(1060, 0, 1, 700),
243 mouse_warp_controller()->warp_regions_[1]->b_indicator_bounds);
244
245 // Right most display
246 event_filter()->ShowSharedEdgeIndicator(root_windows[2]);
247 ASSERT_EQ(2U, mouse_warp_controller()->warp_regions_.size());
248 EXPECT_EQ(gfx::Rect(360, 16, 1, 344),
249 mouse_warp_controller()->warp_regions_[0]->a_indicator_bounds);
250 EXPECT_EQ(gfx::Rect(359, 0, 1, 360),
251 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
252 EXPECT_EQ(gfx::Rect(1060, 16, 1, 684),
253 mouse_warp_controller()->warp_regions_[1]->a_indicator_bounds);
254 EXPECT_EQ(gfx::Rect(1059, 0, 1, 700),
255 mouse_warp_controller()->warp_regions_[1]->b_indicator_bounds);
256
257 event_filter()->HideSharedEdgeIndicator();
258 };
259
218 UpdateDisplay("360x360,700x700,1000x1000"); 260 UpdateDisplay("360x360,700x700,1000x1000");
219 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 261 run_test();
220 262
221 // Left most display 263 UpdateDisplay("360x360,700x700,1000x1000");
222 event_filter()->ShowSharedEdgeIndicator(root_windows[0]); 264 Shell::GetInstance()->window_tree_host_manager()->SwapPrimaryDisplayForTest();
223 ASSERT_EQ(2U, mouse_warp_controller()->warp_regions_.size()); 265 run_test();
224 EXPECT_EQ(gfx::Rect(359, 16, 1, 344),
225 mouse_warp_controller()->warp_regions_[0]->a_indicator_bounds);
226 EXPECT_EQ(gfx::Rect(360, 0, 1, 360),
227 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
228 EXPECT_EQ(gfx::Rect(1060, 16, 1, 684),
229 mouse_warp_controller()->warp_regions_[1]->a_indicator_bounds);
230 EXPECT_EQ(gfx::Rect(1059, 0, 1, 700),
231 mouse_warp_controller()->warp_regions_[1]->b_indicator_bounds);
232
233 // Middle display
234 event_filter()->ShowSharedEdgeIndicator(root_windows[1]);
235 ASSERT_EQ(2U, mouse_warp_controller()->warp_regions_.size());
236 EXPECT_EQ(gfx::Rect(360, 16, 1, 344),
237 mouse_warp_controller()->warp_regions_[0]->a_indicator_bounds);
238 EXPECT_EQ(gfx::Rect(359, 0, 1, 360),
239 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
240 EXPECT_EQ(gfx::Rect(1059, 16, 1, 684),
241 mouse_warp_controller()->warp_regions_[1]->a_indicator_bounds);
242 EXPECT_EQ(gfx::Rect(1060, 0, 1, 700),
243 mouse_warp_controller()->warp_regions_[1]->b_indicator_bounds);
244
245 // Right most display
246 event_filter()->ShowSharedEdgeIndicator(root_windows[2]);
247 ASSERT_EQ(2U, mouse_warp_controller()->warp_regions_.size());
248 EXPECT_EQ(gfx::Rect(360, 16, 1, 344),
249 mouse_warp_controller()->warp_regions_[0]->a_indicator_bounds);
250 EXPECT_EQ(gfx::Rect(359, 0, 1, 360),
251 mouse_warp_controller()->warp_regions_[0]->b_indicator_bounds);
252 EXPECT_EQ(gfx::Rect(1060, 16, 1, 684),
253 mouse_warp_controller()->warp_regions_[1]->a_indicator_bounds);
254 EXPECT_EQ(gfx::Rect(1059, 0, 1, 700),
255 mouse_warp_controller()->warp_regions_[1]->b_indicator_bounds);
256
257 event_filter()->HideSharedEdgeIndicator();
258 } 266 }
259 267
260 } // namespace ash 268 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698