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

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

Issue 2400553002: ash: Remove broken display notification suppression when settings is open (Closed)
Patch Set: fix tests Created 4 years, 2 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 4
5 #include "ash/display/mirror_window_controller.h" 5 #include "ash/display/mirror_window_controller.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/display/window_tree_host_manager.h" 8 #include "ash/display/window_tree_host_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 // Test the behavior of the cursor when entering software mirror mode swaps the 206 // Test the behavior of the cursor when entering software mirror mode swaps the
207 // cursor's display. 207 // cursor's display.
208 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorMoveOnEnter) { 208 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorMoveOnEnter) {
209 aura::Env* env = aura::Env::GetInstance(); 209 aura::Env* env = aura::Env::GetInstance();
210 Shell* shell = Shell::GetInstance(); 210 Shell* shell = Shell::GetInstance();
211 WindowTreeHostManager* window_tree_host_manager = 211 WindowTreeHostManager* window_tree_host_manager =
212 shell->window_tree_host_manager(); 212 shell->window_tree_host_manager();
213 213
214 UpdateDisplay("400x400*2/r,400x400"); 214 // Ensure the display is large enough that the cursor does not appear on top
215 // of the display change notifications (which changes the cursor to a hand).
216 UpdateDisplay("600x400*2/r,600x400");
215 int64_t primary_display_id = window_tree_host_manager->GetPrimaryDisplayId(); 217 int64_t primary_display_id = window_tree_host_manager->GetPrimaryDisplayId();
216 int64_t secondary_display_id = display_manager()->GetSecondaryDisplay().id(); 218 int64_t secondary_display_id = display_manager()->GetSecondaryDisplay().id();
217 test::ScopedSetInternalDisplayId set_internal(display_manager(), 219 test::ScopedSetInternalDisplayId set_internal(display_manager(),
218 primary_display_id); 220 primary_display_id);
219 221
220 // Chrome uses the internal display as the source display for software mirror 222 // Chrome uses the internal display as the source display for software mirror
221 // mode. Move the cursor to the external display. 223 // mode. Move the cursor to the external display.
222 aura::Window* secondary_root_window = 224 aura::Window* secondary_root_window =
223 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id); 225 window_tree_host_manager->GetRootWindowForDisplayId(secondary_display_id);
224 secondary_root_window->MoveCursorTo(gfx::Point(100, 200)); 226 secondary_root_window->MoveCursorTo(gfx::Point(100, 200));
225 EXPECT_EQ("300,200", env->last_mouse_location().ToString()); 227 EXPECT_EQ("300,200", env->last_mouse_location().ToString());
226 test::CursorManagerTestApi cursor_test_api(shell->cursor_manager()); 228 test::CursorManagerTestApi cursor_test_api(shell->cursor_manager());
227 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); 229 EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
228 EXPECT_EQ(display::Display::ROTATE_0, 230 EXPECT_EQ(display::Display::ROTATE_0,
229 cursor_test_api.GetCurrentCursorRotation()); 231 cursor_test_api.GetCurrentCursorRotation());
230 232
231 display_manager()->SetMultiDisplayMode(DisplayManager::MIRRORING); 233 display_manager()->SetMultiDisplayMode(DisplayManager::MIRRORING);
232 UpdateDisplay("400x400*2/r,400x400"); 234 UpdateDisplay("600x400*2/r,600x400");
233 235
234 // Entering mirror mode should have centered the cursor on the primary display 236 // Entering mirror mode should have centered the cursor on the primary display
235 // because the cursor's previous position is out of bounds. 237 // because the cursor's previous position is out of bounds.
236 // Check real cursor's position and properties. 238 // Check real cursor's position and properties.
237 EXPECT_EQ("100,100", env->last_mouse_location().ToString()); 239 EXPECT_EQ("100,150", env->last_mouse_location().ToString());
238 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); 240 EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor());
239 EXPECT_EQ(display::Display::ROTATE_90, 241 EXPECT_EQ(display::Display::ROTATE_90,
240 cursor_test_api.GetCurrentCursorRotation()); 242 cursor_test_api.GetCurrentCursorRotation());
241 243
242 // Check mirrored cursor's location. 244 // Check mirrored cursor's location.
243 test::MirrorWindowTestApi test_api; 245 test::MirrorWindowTestApi test_api;
246 // The hot point location depends on the specific cursor.
247 EXPECT_EQ(ui::kCursorNull, test_api.GetCurrentCursorType());
244 // Rotated hot point must be (25-7, 7). 248 // Rotated hot point must be (25-7, 7).
245 EXPECT_EQ("18,7", test_api.GetCursorHotPoint().ToString()); 249 EXPECT_EQ("18,7", test_api.GetCursorHotPoint().ToString());
246 // New coordinates are not (200,200) because (200,200) is not the center of 250 // New coordinates are not (300,200) because (300,200) is not the center of
247 // the display. 251 // the display.
248 EXPECT_EQ("199,200", 252 EXPECT_EQ("299,200",
249 test_api.GetCursorHotPointLocationInRootWindow().ToString()); 253 test_api.GetCursorHotPointLocationInRootWindow().ToString());
250 } 254 }
251 255
252 // Make sure that the compositor based mirroring can switch 256 // Make sure that the compositor based mirroring can switch
253 // from/to dock mode. 257 // from/to dock mode.
254 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) { 258 TEST_F(MirrorWindowControllerTest, MAYBE_DockMode) {
255 const int64_t internal_id = 1; 259 const int64_t internal_id = 1;
256 const int64_t external_id = 2; 260 const int64_t external_id = 2;
257 261
258 const display::ManagedDisplayInfo internal_display_info = 262 const display::ManagedDisplayInfo internal_display_info =
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 300 }
297 301
298 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { 302 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) {
299 EXPECT_TRUE(display_manager()->IsInMirrorMode()); 303 EXPECT_TRUE(display_manager()->IsInMirrorMode());
300 RunAllPendingInMessageLoop(); 304 RunAllPendingInMessageLoop();
301 test::MirrorWindowTestApi test_api; 305 test::MirrorWindowTestApi test_api;
302 EXPECT_TRUE(test_api.GetHost()); 306 EXPECT_TRUE(test_api.GetHost());
303 } 307 }
304 308
305 } // namespace ash 309 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698