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

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

Issue 11085053: Improving window auto management between workspaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed merge problems with trunk Created 8 years, 1 month 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/property_util.h" 7 #include "ash/wm/property_util.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 20 matching lines...) Expand all
31 #include "ui/ui_controls/ui_controls.h" 31 #include "ui/ui_controls/ui_controls.h"
32 #include "ui/views/view.h" 32 #include "ui/views/view.h"
33 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
34 34
35 #if defined(USE_ASH) 35 #if defined(USE_ASH)
36 #include "ash/display/display_controller.h" 36 #include "ash/display/display_controller.h"
37 #include "ash/display/multi_display_manager.h" 37 #include "ash/display/multi_display_manager.h"
38 #include "ash/shell.h" 38 #include "ash/shell.h"
39 #include "ash/test/cursor_manager_test_api.h" 39 #include "ash/test/cursor_manager_test_api.h"
40 #include "ash/wm/cursor_manager.h" 40 #include "ash/wm/cursor_manager.h"
41 #include "ash/wm/window_util.h"
41 #include "ui/aura/test/event_generator.h" 42 #include "ui/aura/test/event_generator.h"
42 #include "ui/aura/root_window.h" 43 #include "ui/aura/root_window.h"
43 #endif 44 #endif
44 45
45 namespace test { 46 namespace test {
46 47
47 namespace { 48 namespace {
48 49
49 const char kTabDragControllerInteractiveUITestUserDataKey[] = 50 const char kTabDragControllerInteractiveUITestUserDataKey[] =
50 "TabDragControllerInteractiveUITestUserData"; 51 "TabDragControllerInteractiveUITestUserData";
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 435
435 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); 436 EXPECT_EQ("0", IDString(new_browser->tab_strip_model()));
436 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 437 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
437 438
438 // The bounds of the initial window should not have changed. 439 // The bounds of the initial window should not have changed.
439 EXPECT_EQ(initial_bounds.ToString(), 440 EXPECT_EQ(initial_bounds.ToString(),
440 browser()->window()->GetBounds().ToString()); 441 browser()->window()->GetBounds().ToString());
441 442
442 EXPECT_TRUE(GetTrackedByWorkspace(browser())); 443 EXPECT_TRUE(GetTrackedByWorkspace(browser()));
443 EXPECT_TRUE(GetTrackedByWorkspace(new_browser)); 444 EXPECT_TRUE(GetTrackedByWorkspace(new_browser));
445 #if defined(USE_ASH)
446 // After this both windows should still be managable.
447 ASSERT_TRUE(ash::wm::IsWindowPositionManaged(
sky 2012/10/25 19:40:36 In general you only use ASSERT for things for that
Mr4D (OOO till 08-26) 2012/10/25 20:44:05 Done.
448 browser()->window()->GetNativeWindow()));
449 ASSERT_TRUE(ash::wm::IsWindowPositionManaged(
450 new_browser->window()->GetNativeWindow()));
451 #endif
444 } 452 }
445 453
446 // Deletes a tab being dragged before the user moved enough to start a drag. 454 // Deletes a tab being dragged before the user moved enough to start a drag.
447 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 455 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
448 DeleteBeforeStartedDragging) { 456 DeleteBeforeStartedDragging) {
449 // Add another tab. 457 // Add another tab.
450 AddTabAndResetBrowser(browser()); 458 AddTabAndResetBrowser(browser());
451 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 459 TabStrip* tab_strip = GetTabStripForBrowser(browser());
452 460
453 // Click on the first tab, but don't move it. 461 // Click on the first tab, but don't move it.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // second browser. 857 // second browser.
850 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 858 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
851 DragSingleTabToSeparateWindow) { 859 DragSingleTabToSeparateWindow) {
852 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 860 TabStrip* tab_strip = GetTabStripForBrowser(browser());
853 861
854 ResetIDs(browser()->tab_strip_model(), 0); 862 ResetIDs(browser()->tab_strip_model(), 0);
855 863
856 // Create another browser. 864 // Create another browser.
857 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout(); 865 Browser* browser2 = CreateAnotherWindowBrowserAndRelayout();
858 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 866 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
867 #if defined(USE_ASH)
sky 2012/10/25 19:40:36 Same comment here about the ifdef, remove it and a
Mr4D (OOO till 08-26) 2012/10/25 20:44:05 Done.
868 const gfx::Rect initial_bounds(browser2->window()->GetBounds());
869 #endif
859 870
860 // Move to the first tab and drag it enough so that it detaches, but not 871 // Move to the first tab and drag it enough so that it detaches, but not
861 // enough that it attaches to browser2. 872 // enough that it attaches to browser2.
862 gfx::Point tab_0_center( 873 gfx::Point tab_0_center(
863 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 874 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
864 ASSERT_TRUE(PressInput(tab_0_center)); 875 ASSERT_TRUE(PressInput(tab_0_center));
865 ASSERT_TRUE(DragInputToNotifyWhenDone( 876 ASSERT_TRUE(DragInputToNotifyWhenDone(
866 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 877 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
867 base::Bind(&DragAllToSeparateWindowStep2, this, tab_strip, tab_strip2))); 878 base::Bind(&DragAllToSeparateWindowStep2, this, tab_strip, tab_strip2)));
868 QuitWhenNotDragging(); 879 QuitWhenNotDragging();
869 880
870 // Should now be attached to tab_strip2. 881 // Should now be attached to tab_strip2.
871 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); 882 ASSERT_TRUE(tab_strip2->IsDragSessionActive());
872 ASSERT_TRUE(TabDragController::IsActive()); 883 ASSERT_TRUE(TabDragController::IsActive());
873 ASSERT_EQ(1u, BrowserList::size()); 884 ASSERT_EQ(1u, BrowserList::size());
874 885
875 // Release the mouse, stopping the drag session. 886 // Release the mouse, stopping the drag session.
876 ASSERT_TRUE(ReleaseInput()); 887 ASSERT_TRUE(ReleaseInput());
877 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); 888 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
878 ASSERT_FALSE(TabDragController::IsActive()); 889 ASSERT_FALSE(TabDragController::IsActive());
879 EXPECT_EQ("100 0", IDString(browser2->tab_strip_model())); 890 EXPECT_EQ("100 0", IDString(browser2->tab_strip_model()));
880 891
881 EXPECT_TRUE(GetTrackedByWorkspace(browser2)); 892 EXPECT_TRUE(GetTrackedByWorkspace(browser2));
893 #if defined(USE_ASH)
894 // Make sure that the window is still managed and not user moved.
895 ASSERT_TRUE(ash::wm::IsWindowPositionManaged(
896 browser2->window()->GetNativeWindow()));
897 ASSERT_FALSE(ash::wm::HasUserChangedWindowPositionOrSize(
898 browser2->window()->GetNativeWindow()));
899 // Also make sure that the drag to window position has not changed.
900 EXPECT_EQ(initial_bounds.ToString(),
901 browser2->window()->GetBounds().ToString());
902 #endif
882 } 903 }
883 904
884 namespace { 905 namespace {
885 906
886 // Invoked from the nested message loop. 907 // Invoked from the nested message loop.
887 void CancelOnNewTabWhenDraggingStep2( 908 void CancelOnNewTabWhenDraggingStep2(
888 DetachToBrowserTabDragControllerTest* test) { 909 DetachToBrowserTabDragControllerTest* test) {
889 ASSERT_TRUE(TabDragController::IsActive()); 910 ASSERT_TRUE(TabDragController::IsActive());
890 ASSERT_EQ(2u, BrowserList::size()); 911 ASSERT_EQ(2u, BrowserList::size());
891 912
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 DifferentDeviceScaleFactorDisplayTabDragControllerTest, 1394 DifferentDeviceScaleFactorDisplayTabDragControllerTest,
1374 ::testing::Values("mouse")); 1395 ::testing::Values("mouse"));
1375 INSTANTIATE_TEST_CASE_P(TabDragging, 1396 INSTANTIATE_TEST_CASE_P(TabDragging,
1376 DetachToBrowserTabDragControllerTest, 1397 DetachToBrowserTabDragControllerTest,
1377 ::testing::Values("mouse", "touch")); 1398 ::testing::Values("mouse", "touch"));
1378 #else 1399 #else
1379 INSTANTIATE_TEST_CASE_P(TabDragging, 1400 INSTANTIATE_TEST_CASE_P(TabDragging,
1380 DetachToBrowserTabDragControllerTest, 1401 DetachToBrowserTabDragControllerTest,
1381 ::testing::Values("mouse")); 1402 ::testing::Values("mouse"));
1382 #endif 1403 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | chrome/browser/ui/window_sizer/window_sizer_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698