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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 11419271: Revert "Use WS_POPUP for ash_unittests" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/root_window_controller_unittest.cc » ('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 (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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/display_manager.h" 6 #include "ash/display/display_manager.h"
7 #include "ash/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 EXPECT_EQ(root_windows[0], 318 EXPECT_EQ(root_windows[0],
319 wm::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0))); 319 wm::GetRootWindowMatching(gfx::Rect(100, 100, 0, 0)));
320 320
321 // Out of range rect should return the primary root window. 321 // Out of range rect should return the primary root window.
322 EXPECT_EQ(root_windows[0], 322 EXPECT_EQ(root_windows[0],
323 wm::GetRootWindowMatching(gfx::Rect(-600, -300, 50, 50))); 323 wm::GetRootWindowMatching(gfx::Rect(-600, -300, 50, 50)));
324 EXPECT_EQ(root_windows[0], 324 EXPECT_EQ(root_windows[0],
325 wm::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50))); 325 wm::GetRootWindowMatching(gfx::Rect(0, 1000, 50, 50)));
326 } 326 }
327 327
328 TEST_F(ExtendedDesktopTest, Capture) { 328 #if defined(OS_WIN)
329 // TODO(mazda): Re-enable this (http://crbug.com/150986).
330 #define MAYBE_Capture DISABLED_Capture
331 #else
332 #define MAYBE_Capture Capture
333 #endif
334
335 TEST_F(ExtendedDesktopTest, MAYBE_Capture) {
329 UpdateDisplay("1000x600,600x400"); 336 UpdateDisplay("1000x600,600x400");
330 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 337 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
331 338
332 aura::test::EventCountDelegate r1_d1; 339 aura::test::EventCountDelegate r1_d1;
333 aura::test::EventCountDelegate r1_d2; 340 aura::test::EventCountDelegate r1_d2;
334 aura::test::EventCountDelegate r2_d1; 341 aura::test::EventCountDelegate r2_d1;
335 342
336 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 343 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
337 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 344 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
338 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 345 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
339 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0])); 346 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
340 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate( 347 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate(
341 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1])); 348 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1]));
342 349
343 r1_w1->SetCapture(); 350 r1_w1->SetCapture();
344 351
345 EXPECT_EQ(r1_w1.get(), 352 EXPECT_EQ(r1_w1.get(),
346 aura::client::GetCaptureWindow(r2_w1->GetRootWindow())); 353 aura::client::GetCaptureWindow(r2_w1->GetRootWindow()));
347 aura::test::EventGenerator generator2(root_windows[1]); 354 aura::test::EventGenerator generator2(root_windows[1]);
348 generator2.MoveMouseToCenterOf(r2_w1.get()); 355 generator2.MoveMouseToCenterOf(r2_w1.get());
349 generator2.ClickLeftButton(); 356 generator2.ClickLeftButton();
350 EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset()); 357 EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset());
351 EXPECT_EQ("0 0", r2_d1.GetMouseButtonCountsAndReset()); 358 EXPECT_EQ("0 0", r2_d1.GetMouseButtonCountsAndReset());
352 // The mouse is outside. On chromeos, the mouse is warped to the 359 // The mouse is outside. On chromeos, the mouse is warped to the
353 // dest root window, but it's not implemented on Win yet, so 360 // dest root window, but it's not implemented on Win yet, so
354 // no mouse move event on Win. 361 // no mouse move event on Win.
362 #if defined(OS_WIN)
363 EXPECT_EQ("1 0 0", r1_d1.GetMouseMotionCountsAndReset());
364 #else
355 EXPECT_EQ("1 1 0", r1_d1.GetMouseMotionCountsAndReset()); 365 EXPECT_EQ("1 1 0", r1_d1.GetMouseMotionCountsAndReset());
366 #endif
356 EXPECT_EQ("1 1", r1_d1.GetMouseButtonCountsAndReset()); 367 EXPECT_EQ("1 1", r1_d1.GetMouseButtonCountsAndReset());
357 // (15,15) on 1st display is (-985,15) on 2nd display. 368 // (15,15) on 1st display is (-985,15) on 2nd display.
358 generator2.MoveMouseTo(-985, 15); 369 generator2.MoveMouseTo(-985, 15);
359 EXPECT_EQ("0 1 0", r1_d1.GetMouseMotionCountsAndReset()); 370 EXPECT_EQ("0 1 0", r1_d1.GetMouseMotionCountsAndReset());
360 371
361 r1_w2->SetCapture(); 372 r1_w2->SetCapture();
362 EXPECT_EQ(r1_w2.get(), 373 EXPECT_EQ(r1_w2.get(),
363 aura::client::GetCaptureWindow(r2_w1->GetRootWindow())); 374 aura::client::GetCaptureWindow(r2_w1->GetRootWindow()));
364 generator2.MoveMouseBy(10, 10); 375 generator2.MoveMouseBy(10, 10);
365 generator2.ClickLeftButton(); 376 generator2.ClickLeftButton();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 MoveWindowByClickEventFilter event_filter(window.get()); 435 MoveWindowByClickEventFilter event_filter(window.get());
425 window->AddPreTargetHandler(&event_filter); 436 window->AddPreTargetHandler(&event_filter);
426 aura::test::EventGenerator generator(root_windows[0], window.get()); 437 aura::test::EventGenerator generator(root_windows[0], window.get());
427 generator.ClickLeftButton(); 438 generator.ClickLeftButton();
428 // Both mouse pressed and released arrive at the window and its delegate. 439 // Both mouse pressed and released arrive at the window and its delegate.
429 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset()); 440 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset());
430 // Also event_filter moves the window to another root at mouse release. 441 // Also event_filter moves the window to another root at mouse release.
431 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 442 EXPECT_EQ(root_windows[1], window->GetRootWindow());
432 } 443 }
433 444
434 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { 445 // This test fails on the "Win Aura" bot: <http://crbug.com/157817>.
446 #if defined(OS_WIN)
447 #define MAYBE_MoveWindowToDisplay DISABLED_MoveWindowToDisplay
448 #else
449 #define MAYBE_MoveWindowToDisplay MoveWindowToDisplay
450 #endif
451 TEST_F(ExtendedDesktopTest, MAYBE_MoveWindowToDisplay) {
435 UpdateDisplay("1000x1000,1000x1000"); 452 UpdateDisplay("1000x1000,1000x1000");
436 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 453 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
437 454
438 gfx::Display display0 = Shell::GetScreen()->GetDisplayMatching( 455 gfx::Display display0 = Shell::GetScreen()->GetDisplayMatching(
439 root_windows[0]->GetBoundsInScreen()); 456 root_windows[0]->GetBoundsInScreen());
440 gfx::Display display1 = Shell::GetScreen()->GetDisplayMatching( 457 gfx::Display display1 = Shell::GetScreen()->GetDisplayMatching(
441 root_windows[1]->GetBoundsInScreen()); 458 root_windows[1]->GetBoundsInScreen());
442 EXPECT_NE(display0.id(), display1.id()); 459 EXPECT_NE(display0.id(), display1.id());
443 460
444 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); 461 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100));
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 705
689 aura::test::EventGenerator generator22(root_windows[1]); 706 aura::test::EventGenerator generator22(root_windows[1]);
690 generator22.PressKey(ui::VKEY_E, 0); 707 generator22.PressKey(ui::VKEY_E, 0);
691 generator22.ReleaseKey(ui::VKEY_E, 0); 708 generator22.ReleaseKey(ui::VKEY_E, 0);
692 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 709 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
693 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text())); 710 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text()));
694 } 711 }
695 712
696 } // namespace internal 713 } // namespace internal
697 } // namespace ash 714 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698