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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 143153004: [Reland] Fix crash when accidentally touching the screen during a multi window resize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h"
6 6
7 #include "ash/wm/window_state.h" 7 #include "ash/wm/window_state.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 TabStripModel* model = browser()->tab_strip_model(); 558 TabStripModel* model = browser()->tab_strip_model();
559 559
560 gfx::Point tab_1_center(GetCenterInScreenCoordinates(tab_strip->tab_at(1))); 560 gfx::Point tab_1_center(GetCenterInScreenCoordinates(tab_strip->tab_at(1)));
561 ASSERT_TRUE(PressInput(tab_1_center)); 561 ASSERT_TRUE(PressInput(tab_1_center));
562 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 562 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
563 ASSERT_TRUE(DragInputTo(tab_0_center)); 563 ASSERT_TRUE(DragInputTo(tab_0_center));
564 ASSERT_TRUE(ReleaseInput()); 564 ASSERT_TRUE(ReleaseInput());
565 EXPECT_EQ("1 0", IDString(model)); 565 EXPECT_EQ("1 0", IDString(model));
566 EXPECT_FALSE(TabDragController::IsActive()); 566 EXPECT_FALSE(TabDragController::IsActive());
567 EXPECT_FALSE(tab_strip->IsDragSessionActive()); 567 EXPECT_FALSE(tab_strip->IsDragSessionActive());
568
569 // The tab strip should no longer have capture because the drag was ended and
570 // mouse/touch was released.
571 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
568 } 572 }
569 573
570 namespace { 574 namespace {
571 575
572 // Invoked from the nested message loop. 576 // Invoked from the nested message loop.
573 void DragToSeparateWindowStep2(DetachToBrowserTabDragControllerTest* test, 577 void DragToSeparateWindowStep2(DetachToBrowserTabDragControllerTest* test,
574 TabStrip* not_attached_tab_strip, 578 TabStrip* not_attached_tab_strip,
575 TabStrip* target_tab_strip) { 579 TabStrip* target_tab_strip) {
576 ASSERT_FALSE(not_attached_tab_strip->IsDragSessionActive()); 580 ASSERT_FALSE(not_attached_tab_strip->IsDragSessionActive());
577 ASSERT_FALSE(target_tab_strip->IsDragSessionActive()); 581 ASSERT_FALSE(target_tab_strip->IsDragSessionActive());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 base::Bind(&DragToSeparateWindowStep2, 619 base::Bind(&DragToSeparateWindowStep2,
616 this, tab_strip, tab_strip2))); 620 this, tab_strip, tab_strip2)));
617 QuitWhenNotDragging(); 621 QuitWhenNotDragging();
618 622
619 // Should now be attached to tab_strip2. 623 // Should now be attached to tab_strip2.
620 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); 624 ASSERT_TRUE(tab_strip2->IsDragSessionActive());
621 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 625 ASSERT_FALSE(tab_strip->IsDragSessionActive());
622 ASSERT_TRUE(TabDragController::IsActive()); 626 ASSERT_TRUE(TabDragController::IsActive());
623 EXPECT_FALSE(GetIsDragged(browser())); 627 EXPECT_FALSE(GetIsDragged(browser()));
624 628
625 // Release the mouse, stopping the drag session. 629 // Release mouse or touch, stopping the drag session.
626 ASSERT_TRUE(ReleaseInput()); 630 ASSERT_TRUE(ReleaseInput());
627 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); 631 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
628 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 632 ASSERT_FALSE(tab_strip->IsDragSessionActive());
629 ASSERT_FALSE(TabDragController::IsActive()); 633 ASSERT_FALSE(TabDragController::IsActive());
630 EXPECT_EQ("100 0", IDString(browser2->tab_strip_model())); 634 EXPECT_EQ("100 0", IDString(browser2->tab_strip_model()));
631 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 635 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
632 EXPECT_FALSE(GetIsDragged(browser2)); 636 EXPECT_FALSE(GetIsDragged(browser2));
633 637
634 // Both windows should not be maximized 638 // Both windows should not be maximized
635 EXPECT_FALSE(browser()->window()->IsMaximized()); 639 EXPECT_FALSE(browser()->window()->IsMaximized());
636 EXPECT_FALSE(browser2->window()->IsMaximized()); 640 EXPECT_FALSE(browser2->window()->IsMaximized());
641
642 // The tab strip should no longer have capture because the drag was ended and
643 // mouse/touch was released.
644 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
645 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
637 } 646 }
638 647
639 namespace { 648 namespace {
640 649
641 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { 650 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) {
642 if (test->input_source() == INPUT_SOURCE_TOUCH) 651 if (test->input_source() == INPUT_SOURCE_TOUCH)
643 ASSERT_TRUE(test->ReleaseInput()); 652 ASSERT_TRUE(test->ReleaseInput());
644 } 653 }
645 654
646 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 655 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 EXPECT_FALSE(GetIsDragged(browser())); 718 EXPECT_FALSE(GetIsDragged(browser()));
710 EXPECT_FALSE(GetIsDragged(new_browser)); 719 EXPECT_FALSE(GetIsDragged(new_browser));
711 // After this both windows should still be manageable. 720 // After this both windows should still be manageable.
712 EXPECT_TRUE(IsWindowPositionManaged(browser()->window()->GetNativeWindow())); 721 EXPECT_TRUE(IsWindowPositionManaged(browser()->window()->GetNativeWindow()));
713 EXPECT_TRUE(IsWindowPositionManaged( 722 EXPECT_TRUE(IsWindowPositionManaged(
714 new_browser->window()->GetNativeWindow())); 723 new_browser->window()->GetNativeWindow()));
715 724
716 // Both windows should not be maximized 725 // Both windows should not be maximized
717 EXPECT_FALSE(browser()->window()->IsMaximized()); 726 EXPECT_FALSE(browser()->window()->IsMaximized());
718 EXPECT_FALSE(new_browser->window()->IsMaximized()); 727 EXPECT_FALSE(new_browser->window()->IsMaximized());
728
729 // The tab strip should no longer have capture because the drag was ended and
730 // mouse/touch was released.
731 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
732 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
719 } 733 }
720 734
721 #if defined(OS_CHROMEOS) 735 #if defined(OS_CHROMEOS)
722 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 736 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
723 // compositor. crbug.com/331924 737 // compositor. crbug.com/331924
724 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ 738 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \
725 DISABLED_DetachToOwnWindowFromMaximizedWindow 739 DISABLED_DetachToOwnWindowFromMaximizedWindow
726 #else 740 #else
727 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ 741 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \
728 DetachToOwnWindowFromMaximizedWindow 742 DetachToOwnWindowFromMaximizedWindow
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 996 ASSERT_FALSE(tab_strip->IsDragSessionActive());
983 ASSERT_FALSE(TabDragController::IsActive()); 997 ASSERT_FALSE(TabDragController::IsActive());
984 998
985 // And there should only be one window. 999 // And there should only be one window.
986 EXPECT_EQ(1u, native_browser_list->size()); 1000 EXPECT_EQ(1u, native_browser_list->size());
987 1001
988 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 1002 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
989 1003
990 // Remaining browser window should not be maximized 1004 // Remaining browser window should not be maximized
991 EXPECT_FALSE(browser()->window()->IsMaximized()); 1005 EXPECT_FALSE(browser()->window()->IsMaximized());
1006
1007 // The tab strip should no longer have capture because the drag was ended and
1008 // mouse/touch was released.
1009 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
992 } 1010 }
993 1011
994 namespace { 1012 namespace {
995 1013
996 void DragAllStep2(DetachToBrowserTabDragControllerTest* test, 1014 void DragAllStep2(DetachToBrowserTabDragControllerTest* test,
997 const BrowserList* browser_list) { 1015 const BrowserList* browser_list) {
998 // Should only be one window. 1016 // Should only be one window.
999 ASSERT_EQ(1u, browser_list->size()); 1017 ASSERT_EQ(1u, browser_list->size());
1000 if (test->input_source() == INPUT_SOURCE_TOUCH) { 1018 if (test->input_source() == INPUT_SOURCE_TOUCH) {
1001 ASSERT_TRUE(test->ReleaseInput()); 1019 ASSERT_TRUE(test->ReleaseInput());
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 DetachToDockedTabDragControllerTest, 2332 DetachToDockedTabDragControllerTest,
2315 ::testing::Values("mouse", "mouse docked")); 2333 ::testing::Values("mouse", "mouse docked"));
2316 INSTANTIATE_TEST_CASE_P(TabDragging, 2334 INSTANTIATE_TEST_CASE_P(TabDragging,
2317 DetachToBrowserTabDragControllerTestTouch, 2335 DetachToBrowserTabDragControllerTestTouch,
2318 ::testing::Values("touch", "touch docked")); 2336 ::testing::Values("touch", "touch docked"));
2319 #else 2337 #else
2320 INSTANTIATE_TEST_CASE_P(TabDragging, 2338 INSTANTIATE_TEST_CASE_P(TabDragging,
2321 DetachToBrowserTabDragControllerTest, 2339 DetachToBrowserTabDragControllerTest,
2322 ::testing::Values("mouse")); 2340 ::testing::Values("mouse"));
2323 #endif 2341 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698