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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 16539005: Skip mulitple-dispay tests on win8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, and comment Created 7 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 | Annotate | Revision Log
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/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_controller.h" 8 #include "ash/display/display_controller.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 EXPECT_EQ("20,500 100x100", window3_->bounds().ToString()); 466 EXPECT_EQ("20,500 100x100", window3_->bounds().ToString());
467 467
468 // 100 up again. 468 // 100 up again.
469 resizer->Drag(CalculateDragPoint(*resizer, -10, -100), 0); 469 resizer->Drag(CalculateDragPoint(*resizer, -10, -100), 0);
470 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); 470 EXPECT_EQ("0,0 200x100", window_->bounds().ToString());
471 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString()); 471 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString());
472 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString()); 472 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString());
473 } 473 }
474 474
475 475
476 #if defined(OS_WIN)
477 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962
478 #define MAYBE_Edge DISABLED_Edge
479 #else
480 #define MAYBE_Edge Edge
481 #endif
482
483 // Assertions around dragging to the left/right edge of the screen. 476 // Assertions around dragging to the left/right edge of the screen.
484 TEST_F(WorkspaceWindowResizerTest, MAYBE_Edge) { 477 TEST_F(WorkspaceWindowResizerTest, Edge) {
485 int bottom = 478 int bottom =
486 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); 479 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
487 window_->SetBounds(gfx::Rect(20, 30, 50, 60)); 480 window_->SetBounds(gfx::Rect(20, 30, 50, 60));
488 { 481 {
489 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 482 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
490 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); 483 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
491 ASSERT_TRUE(resizer.get()); 484 ASSERT_TRUE(resizer.get());
492 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0); 485 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0);
493 resizer->CompleteDrag(0); 486 resizer->CompleteDrag(0);
494 EXPECT_EQ("0,0 720x" + base::IntToString(bottom), 487 EXPECT_EQ("0,0 720x" + base::IntToString(bottom),
(...skipping 11 matching lines...) Expand all
506 resizer->CompleteDrag(0); 499 resizer->CompleteDrag(0);
507 EXPECT_EQ("80,0 720x" + base::IntToString(bottom), 500 EXPECT_EQ("80,0 720x" + base::IntToString(bottom),
508 window_->bounds().ToString()); 501 window_->bounds().ToString());
509 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); 502 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
510 EXPECT_EQ("20,30 50x60", 503 EXPECT_EQ("20,30 50x60",
511 GetRestoreBoundsInScreen(window_.get())->ToString()); 504 GetRestoreBoundsInScreen(window_.get())->ToString());
512 } 505 }
513 506
514 // Test if the restore bounds is correct in multiple displays. 507 // Test if the restore bounds is correct in multiple displays.
515 ClearRestoreBounds(window_.get()); 508 ClearRestoreBounds(window_.get());
509
510 RETURN_IF_WIN8;
511
516 UpdateDisplay("800x600,200x600"); 512 UpdateDisplay("800x600,200x600");
517 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 513 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
518 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 514 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
519 window_->SetBoundsInScreen(gfx::Rect(800, 10, 50, 60), 515 window_->SetBoundsInScreen(gfx::Rect(800, 10, 50, 60),
520 ScreenAsh::GetSecondaryDisplay()); 516 ScreenAsh::GetSecondaryDisplay());
521 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 517 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
522 { 518 {
523 bottom = 519 bottom =
524 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); 520 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
525 EXPECT_EQ("800,10 50x60", window_->GetBoundsInScreen().ToString()); 521 EXPECT_EQ("800,10 50x60", window_->GetBoundsInScreen().ToString());
(...skipping 19 matching lines...) Expand all
545 window_->SetProperty(aura::client::kCanResizeKey, false); 541 window_->SetProperty(aura::client::kCanResizeKey, false);
546 542
547 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 543 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
548 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); 544 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
549 ASSERT_TRUE(resizer.get()); 545 ASSERT_TRUE(resizer.get());
550 resizer->Drag(CalculateDragPoint(*resizer, -20, 0), 0); 546 resizer->Drag(CalculateDragPoint(*resizer, -20, 0), 0);
551 resizer->CompleteDrag(0); 547 resizer->CompleteDrag(0);
552 EXPECT_EQ("0,30 50x60", window_->bounds().ToString()); 548 EXPECT_EQ("0,30 50x60", window_->bounds().ToString());
553 } 549 }
554 550
555 #if defined(OS_WIN) 551 TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) {
556 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 552 RETURN_IF_WIN8;
557 #define MAYBE_CancelSnapPhantom DISABLED_CancelSnapPhantom
558 #else
559 #define MAYBE_CancelSnapPhantom CancelSnapPhantom
560 #endif
561 553
562 TEST_F(WorkspaceWindowResizerTest, MAYBE_CancelSnapPhantom) {
563 UpdateDisplay("800x600,800x600"); 554 UpdateDisplay("800x600,800x600");
564 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 555 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
565 ASSERT_EQ(2U, root_windows.size()); 556 ASSERT_EQ(2U, root_windows.size());
566 557
567 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 558 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
568 Shell::GetScreen()->GetPrimaryDisplay()); 559 Shell::GetScreen()->GetPrimaryDisplay());
569 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 560 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
570 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); 561 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
571 { 562 {
572 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 563 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 621 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
631 window_.get(), gfx::Point(), HTCAPTION, empty_windows())); 622 window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
632 ASSERT_TRUE(resizer.get()); 623 ASSERT_TRUE(resizer.get());
633 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0); 624 resizer->Drag(CalculateDragPoint(*resizer, 0, 600), 0);
634 int expected_y = 625 int expected_y =
635 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10; 626 kRootHeight - WorkspaceWindowResizer::kMinOnscreenHeight - 10;
636 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400", 627 EXPECT_EQ("100," + base::IntToString(expected_y) + " 300x400",
637 window_->bounds().ToString()); 628 window_->bounds().ToString());
638 } 629 }
639 630
640 #if defined(OS_WIN) 631 // Makes sure we don't allow dragging on the work area with multidisplay.
641 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962 632 TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) {
642 #define MAYBE_DontDragOffBottomWithMultiDisplay \ 633 RETURN_IF_WIN8;
643 DISABLED_DontDragOffBottomWithMultiDisplay
644 #else
645 #define MAYBE_DontDragOffBottomWithMultiDisplay \
646 DontDragOffBottomWithMultiDisplay
647 #endif
648 634
649 // Makes sure we don't allow dragging on the work area with multidisplay.
650 TEST_F(WorkspaceWindowResizerTest, MAYBE_DontDragOffBottomWithMultiDisplay) {
651 UpdateDisplay("800x600,800x600"); 635 UpdateDisplay("800x600,800x600");
652 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 636 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
653 637
654 Shell::GetInstance()->SetDisplayWorkAreaInsets( 638 Shell::GetInstance()->SetDisplayWorkAreaInsets(
655 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); 639 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0));
656 640
657 // Positions the secondary display at the bottom the primary display. 641 // Positions the secondary display at the bottom the primary display.
658 Shell::GetInstance()->display_controller()->SetLayoutForCurrentDisplays( 642 Shell::GetInstance()->display_controller()->SetLayoutForCurrentDisplays(
659 ash::DisplayLayout(ash::DisplayLayout::BOTTOM, 0)); 643 ash::DisplayLayout(ash::DisplayLayout::BOTTOM, 0));
660 644
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 ASSERT_TRUE(resizer.get()); 746 ASSERT_TRUE(resizer.get());
763 resizer->Drag(CalculateDragPoint(*resizer, 0, bottom), 0); 747 resizer->Drag(CalculateDragPoint(*resizer, 0, bottom), 0);
764 EXPECT_EQ("100," + 748 EXPECT_EQ("100," +
765 base::IntToString(bottom - kMinimumOnScreenArea) + 749 base::IntToString(bottom - kMinimumOnScreenArea) +
766 " 300x" + 750 " 300x" +
767 base::IntToString(height - (delta_to_bottom - 751 base::IntToString(height - (delta_to_bottom -
768 kMinimumOnScreenArea)), 752 kMinimumOnScreenArea)),
769 window_->bounds().ToString()); 753 window_->bounds().ToString());
770 } 754 }
771 755
772 #if defined(OS_WIN)
773 // Multiple displays are not supported on Windows Ash. http://crbug.com/165962
774 #define MAYBE_DragWindowOutsideRightToSecondaryDisplay \
775 DISABLED_DragWindowOutsideRightToSecondaryDisplay
776 #else
777 #define MAYBE_DragWindowOutsideRightToSecondaryDisplay \
778 DragWindowOutsideRightToSecondaryDisplay
779 #endif
780
781 // Verifies that 'outside' check of the resizer take into account the extended 756 // Verifies that 'outside' check of the resizer take into account the extended
782 // desktop in case of repositions. 757 // desktop in case of repositions.
783 TEST_F(WorkspaceWindowResizerTest, 758 TEST_F(WorkspaceWindowResizerTest, DragWindowOutsideRightToSecondaryDisplay) {
784 MAYBE_DragWindowOutsideRightToSecondaryDisplay) {
785 // Only primary display. Changes the window position to fit within the 759 // Only primary display. Changes the window position to fit within the
786 // display. 760 // display.
787 Shell::GetInstance()->SetDisplayWorkAreaInsets( 761 Shell::GetInstance()->SetDisplayWorkAreaInsets(
788 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 50, 0)); 762 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 50, 0));
789 int right = ScreenAsh::GetDisplayWorkAreaBoundsInParent( 763 int right = ScreenAsh::GetDisplayWorkAreaBoundsInParent(
790 window_.get()).right(); 764 window_.get()).right();
791 int pixels_to_right_border = 50; 765 int pixels_to_right_border = 50;
792 int window_width = 300; 766 int window_width = 300;
793 int window_x = right - pixels_to_right_border; 767 int window_x = right - pixels_to_right_border;
794 window_->SetBounds(gfx::Rect(window_x, 100, window_width, 380)); 768 window_->SetBounds(gfx::Rect(window_x, 100, window_width, 380));
795 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( 769 scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
796 window_.get(), gfx::Point(window_x, 0), HTCAPTION, 770 window_.get(), gfx::Point(window_x, 0), HTCAPTION,
797 empty_windows())); 771 empty_windows()));
798 ASSERT_TRUE(resizer.get()); 772 ASSERT_TRUE(resizer.get());
799 resizer->Drag(CalculateDragPoint(*resizer, window_width, 0), 0); 773 resizer->Drag(CalculateDragPoint(*resizer, window_width, 0), 0);
800 EXPECT_EQ(base::IntToString(right - kMinimumOnScreenArea) + 774 EXPECT_EQ(base::IntToString(right - kMinimumOnScreenArea) +
801 ",100 " + 775 ",100 " +
802 base::IntToString(window_width) + 776 base::IntToString(window_width) +
803 "x380", window_->bounds().ToString()); 777 "x380", window_->bounds().ToString());
804 778
779 RETURN_IF_WIN8;
780
805 // With secondary display. Operation itself is same but doesn't change 781 // With secondary display. Operation itself is same but doesn't change
806 // the position because the window is still within the secondary display. 782 // the position because the window is still within the secondary display.
807 UpdateDisplay("1000x600,600x400"); 783 UpdateDisplay("1000x600,600x400");
808 Shell::GetInstance()->SetDisplayWorkAreaInsets( 784 Shell::GetInstance()->SetDisplayWorkAreaInsets(
809 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 50, 0)); 785 Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 50, 0));
810 window_->SetBounds(gfx::Rect(window_x, 100, window_width, 380)); 786 window_->SetBounds(gfx::Rect(window_x, 100, window_width, 380));
811 resizer->Drag(CalculateDragPoint(*resizer, window_width, 0), 0); 787 resizer->Drag(CalculateDragPoint(*resizer, window_width, 0), 0);
812 EXPECT_EQ(base::IntToString(window_x + window_width) + 788 EXPECT_EQ(base::IntToString(window_x + window_width) +
813 ",100 " + 789 ",100 " +
814 base::IntToString(window_width) + 790 base::IntToString(window_width) +
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 ASSERT_TRUE(resizer.get()); 1576 ASSERT_TRUE(resizer.get());
1601 // Move it 50 to the left, which should contract w1 and expand w2-3. 1577 // Move it 50 to the left, which should contract w1 and expand w2-3.
1602 resizer->Drag(CalculateDragPoint(*resizer, -50, 0), 0); 1578 resizer->Drag(CalculateDragPoint(*resizer, -50, 0), 0);
1603 EXPECT_EQ("100,100 98x100", window_->bounds().ToString()); 1579 EXPECT_EQ("100,100 98x100", window_->bounds().ToString());
1604 EXPECT_EQ("198,100 101x100", window2_->bounds().ToString()); 1580 EXPECT_EQ("198,100 101x100", window2_->bounds().ToString());
1605 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString()); 1581 EXPECT_EQ("299,100 101x100", window3_->bounds().ToString());
1606 } 1582 }
1607 1583
1608 } // namespace internal 1584 } // namespace internal
1609 } // namespace ash 1585 } // namespace ash
OLDNEW
« ash/test/ash_test_base.h ('K') | « ash/wm/workspace/workspace_layout_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698