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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 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) 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/aura/wm_window_aura.h"
5 #include "ash/common/shell_window_ids.h" 6 #include "ash/common/shell_window_ids.h"
6 #include "ash/common/wm/root_window_finder.h" 7 #include "ash/common/wm/root_window_finder.h"
7 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/system_tray.h"
12 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
13 #include "ash/wm/aura/wm_window_aura.h"
14 #include "ash/wm/window_properties.h" 14 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "ui/aura/client/capture_client.h" 18 #include "ui/aura/client/capture_client.h"
19 #include "ui/aura/client/focus_client.h" 19 #include "ui/aura/client/focus_client.h"
20 #include "ui/aura/test/test_windows.h" 20 #include "ui/aura/test/test_windows.h"
21 #include "ui/aura/test/window_test_api.h" 21 #include "ui/aura/test/window_test_api.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/aura/window_event_dispatcher.h" 23 #include "ui/aura/window_event_dispatcher.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 309
310 TEST_F(ExtendedDesktopTest, GetRootWindowAt) { 310 TEST_F(ExtendedDesktopTest, GetRootWindowAt) {
311 if (!SupportsMultipleDisplays()) 311 if (!SupportsMultipleDisplays())
312 return; 312 return;
313 313
314 UpdateDisplay("700x500,500x500"); 314 UpdateDisplay("700x500,500x500");
315 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT); 315 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT);
316 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 316 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
317 317
318 EXPECT_EQ(root_windows[1], wm::WmWindowAura::GetAuraWindow( 318 EXPECT_EQ(root_windows[1], WmWindowAura::GetAuraWindow(
319 wm::GetRootWindowAt(gfx::Point(-400, 100)))); 319 wm::GetRootWindowAt(gfx::Point(-400, 100))));
320 EXPECT_EQ(root_windows[1], wm::WmWindowAura::GetAuraWindow( 320 EXPECT_EQ(root_windows[1], WmWindowAura::GetAuraWindow(
321 wm::GetRootWindowAt(gfx::Point(-1, 100)))); 321 wm::GetRootWindowAt(gfx::Point(-1, 100))));
322 EXPECT_EQ(root_windows[0], wm::WmWindowAura::GetAuraWindow( 322 EXPECT_EQ(root_windows[0], WmWindowAura::GetAuraWindow(
323 wm::GetRootWindowAt(gfx::Point(0, 300)))); 323 wm::GetRootWindowAt(gfx::Point(0, 300))));
324 EXPECT_EQ(root_windows[0], wm::WmWindowAura::GetAuraWindow( 324 EXPECT_EQ(root_windows[0], WmWindowAura::GetAuraWindow(
325 wm::GetRootWindowAt(gfx::Point(700, 300)))); 325 wm::GetRootWindowAt(gfx::Point(700, 300))));
326 326
327 // Zero origin. 327 // Zero origin.
328 EXPECT_EQ(root_windows[0], wm::WmWindowAura::GetAuraWindow( 328 EXPECT_EQ(root_windows[0],
329 wm::GetRootWindowAt(gfx::Point(0, 0)))); 329 WmWindowAura::GetAuraWindow(wm::GetRootWindowAt(gfx::Point(0, 0))));
330 330
331 // Out of range point should return the nearest root window 331 // Out of range point should return the nearest root window
332 EXPECT_EQ(root_windows[1], wm::WmWindowAura::GetAuraWindow( 332 EXPECT_EQ(root_windows[1], WmWindowAura::GetAuraWindow(
333 wm::GetRootWindowAt(gfx::Point(-600, 0)))); 333 wm::GetRootWindowAt(gfx::Point(-600, 0))));
334 EXPECT_EQ(root_windows[0], wm::WmWindowAura::GetAuraWindow( 334 EXPECT_EQ(root_windows[0], WmWindowAura::GetAuraWindow(
335 wm::GetRootWindowAt(gfx::Point(701, 100)))); 335 wm::GetRootWindowAt(gfx::Point(701, 100))));
336 } 336 }
337 337
338 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) { 338 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) {
339 if (!SupportsMultipleDisplays()) 339 if (!SupportsMultipleDisplays())
340 return; 340 return;
341 341
342 UpdateDisplay("700x500,500x500"); 342 UpdateDisplay("700x500,500x500");
343 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT); 343 SetSecondaryDisplayLayout(display::DisplayPlacement::LEFT);
344 344
345 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 345 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
346 346
347 // Containing rect. 347 // Containing rect.
348 EXPECT_EQ(root_windows[1], 348 EXPECT_EQ(root_windows[1],
349 wm::WmWindowAura::GetAuraWindow( 349 WmWindowAura::GetAuraWindow(
350 wm::GetRootWindowMatching(gfx::Rect(-300, 10, 50, 50)))); 350 wm::GetRootWindowMatching(gfx::Rect(-300, 10, 50, 50))));
351 EXPECT_EQ(root_windows[0], 351 EXPECT_EQ(root_windows[0],
352 wm::WmWindowAura::GetAuraWindow( 352 WmWindowAura::GetAuraWindow(
353 wm::GetRootWindowMatching(gfx::Rect(100, 10, 50, 50)))); 353 wm::GetRootWindowMatching(gfx::Rect(100, 10, 50, 50))));
354 354
355 // Intersecting rect. 355 // Intersecting rect.
356 EXPECT_EQ(root_windows[1], 356 EXPECT_EQ(root_windows[1],
357 wm::WmWindowAura::GetAuraWindow( 357 WmWindowAura::GetAuraWindow(
358 wm::GetRootWindowMatching(gfx::Rect(-200, 0, 300, 300)))); 358 wm::GetRootWindowMatching(gfx::Rect(-200, 0, 300, 300))));
359 EXPECT_EQ(root_windows[0], 359 EXPECT_EQ(root_windows[0],
360 wm::WmWindowAura::GetAuraWindow( 360 WmWindowAura::GetAuraWindow(
361 wm::GetRootWindowMatching(gfx::Rect(-100, 0, 300, 300)))); 361 wm::GetRootWindowMatching(gfx::Rect(-100, 0, 300, 300))));
362 362
363 // Zero origin. 363 // Zero origin.
364 EXPECT_EQ(root_windows[0], 364 EXPECT_EQ(root_windows[0],
365 wm::WmWindowAura::GetAuraWindow( 365 WmWindowAura::GetAuraWindow(
366 wm::GetRootWindowMatching(gfx::Rect(0, 0, 0, 0)))); 366 wm::GetRootWindowMatching(gfx::Rect(0, 0, 0, 0))));
367 EXPECT_EQ(root_windows[0], 367 EXPECT_EQ(root_windows[0],
368 wm::WmWindowAura::GetAuraWindow( 368 WmWindowAura::GetAuraWindow(
369 wm::GetRootWindowMatching(gfx::Rect(0, 0, 1, 1)))); 369 wm::GetRootWindowMatching(gfx::Rect(0, 0, 1, 1))));
370 370
371 // Empty rect. 371 // Empty rect.
372 EXPECT_EQ(root_windows[1], 372 EXPECT_EQ(root_windows[1],
373 wm::WmWindowAura::GetAuraWindow( 373 WmWindowAura::GetAuraWindow(
374 wm::GetRootWindowMatching(gfx::Rect(-400, 100, 0, 0)))); 374 wm::GetRootWindowMatching(gfx::Rect(-400, 100, 0, 0))));
375 EXPECT_EQ(root_windows[0], 375 EXPECT_EQ(root_windows[0],
376 wm::WmWindowAura::GetAuraWindow( 376 WmWindowAura::GetAuraWindow(
377 wm::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0)))); 377 wm::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0))));
378 378
379 // Out of range rect should return the primary root window. 379 // Out of range rect should return the primary root window.
380 EXPECT_EQ(root_windows[0], 380 EXPECT_EQ(root_windows[0],
381 wm::WmWindowAura::GetAuraWindow( 381 WmWindowAura::GetAuraWindow(
382 wm::GetRootWindowMatching(gfx::Rect(-600, -300, 50, 50)))); 382 wm::GetRootWindowMatching(gfx::Rect(-600, -300, 50, 50))));
383 EXPECT_EQ(root_windows[0], 383 EXPECT_EQ(root_windows[0],
384 wm::WmWindowAura::GetAuraWindow( 384 WmWindowAura::GetAuraWindow(
385 wm::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50)))); 385 wm::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50))));
386 } 386 }
387 387
388 TEST_F(ExtendedDesktopTest, Capture) { 388 TEST_F(ExtendedDesktopTest, Capture) {
389 if (!SupportsMultipleDisplays()) 389 if (!SupportsMultipleDisplays())
390 return; 390 return;
391 391
392 UpdateDisplay("1000x600,600x400"); 392 UpdateDisplay("1000x600,600x400");
393 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 393 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
394 394
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 generator.ReleaseLeftButton(); 947 generator.ReleaseLeftButton();
948 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 948 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
949 949
950 generator.MoveMouseTo(400, 150); 950 generator.MoveMouseTo(400, 150);
951 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 951 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
952 952
953 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 953 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
954 } 954 }
955 955
956 } // namespace ash 956 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698