OLD | NEW |
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 #endif | 358 #endif |
359 | 359 |
360 class DetachToBrowserTabDragControllerTest | 360 class DetachToBrowserTabDragControllerTest |
361 : public TabDragControllerTest, | 361 : public TabDragControllerTest, |
362 public ::testing::WithParamInterface<const char*> { | 362 public ::testing::WithParamInterface<const char*> { |
363 public: | 363 public: |
364 DetachToBrowserTabDragControllerTest() {} | 364 DetachToBrowserTabDragControllerTest() {} |
365 | 365 |
366 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 366 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
367 command_line->AppendSwitch(switches::kTabBrowserDragging); | |
368 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 367 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) |
369 if (!docked_windows_enabled()) { | 368 if (!docked_windows_enabled()) { |
370 CommandLine::ForCurrentProcess()->AppendSwitch( | 369 CommandLine::ForCurrentProcess()->AppendSwitch( |
371 ash::switches::kAshDisableDockedWindows); | 370 ash::switches::kAshDisableDockedWindows); |
372 } | 371 } |
373 #endif | 372 #endif |
374 } | 373 } |
375 | 374 |
376 virtual void SetUpOnMainThread() OVERRIDE { | 375 virtual void SetUpOnMainThread() OVERRIDE { |
377 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 376 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 new_browser->window()->GetNativeWindow())); | 705 new_browser->window()->GetNativeWindow())); |
707 | 706 |
708 // Both windows should not be maximized | 707 // Both windows should not be maximized |
709 EXPECT_FALSE(browser()->window()->IsMaximized()); | 708 EXPECT_FALSE(browser()->window()->IsMaximized()); |
710 EXPECT_FALSE(new_browser->window()->IsMaximized()); | 709 EXPECT_FALSE(new_browser->window()->IsMaximized()); |
711 } | 710 } |
712 | 711 |
713 // Drags from browser to separate window and releases mouse. | 712 // Drags from browser to separate window and releases mouse. |
714 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 713 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
715 DetachToOwnWindowFromMaximizedWindow) { | 714 DetachToOwnWindowFromMaximizedWindow) { |
716 if (!TabDragController::ShouldDetachIntoNewBrowser()) { | |
717 VLOG(1) | |
718 << "Skipping DetachToOwnWindowFromMaximizedWindow on this platform."; | |
719 return; | |
720 } | |
721 | |
722 // Maximize the initial browser window. | 715 // Maximize the initial browser window. |
723 browser()->window()->Maximize(); | 716 browser()->window()->Maximize(); |
724 ASSERT_TRUE(browser()->window()->IsMaximized()); | 717 ASSERT_TRUE(browser()->window()->IsMaximized()); |
725 | 718 |
726 // Add another tab. | 719 // Add another tab. |
727 AddTabAndResetBrowser(browser()); | 720 AddTabAndResetBrowser(browser()); |
728 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 721 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
729 | 722 |
730 // Move to the first tab and drag it enough so that it detaches. | 723 // Move to the first tab and drag it enough so that it detaches. |
731 gfx::Point tab_0_center( | 724 gfx::Point tab_0_center( |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 test, | 2088 test, |
2096 gfx::Point(target_point.x(), 1 + target_point.y()), | 2089 gfx::Point(target_point.x(), 1 + target_point.y()), |
2097 iteration - 1))); | 2090 iteration - 1))); |
2098 } | 2091 } |
2099 | 2092 |
2100 } // namespace | 2093 } // namespace |
2101 | 2094 |
2102 // Drags from browser to separate window, docks that window and releases mouse. | 2095 // Drags from browser to separate window, docks that window and releases mouse. |
2103 IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest, | 2096 IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest, |
2104 DetachToDockedWindowFromMaximizedWindow) { | 2097 DetachToDockedWindowFromMaximizedWindow) { |
2105 if (!TabDragController::ShouldDetachIntoNewBrowser()) { | |
2106 VLOG(1) | |
2107 << "Skipping DetachToDockedWindowFromMaximizedWindow on this platform."; | |
2108 return; | |
2109 } | |
2110 | |
2111 // Maximize the initial browser window. | 2098 // Maximize the initial browser window. |
2112 browser()->window()->Maximize(); | 2099 browser()->window()->Maximize(); |
2113 ASSERT_TRUE(browser()->window()->IsMaximized()); | 2100 ASSERT_TRUE(browser()->window()->IsMaximized()); |
2114 | 2101 |
2115 // Add another tab. | 2102 // Add another tab. |
2116 AddTabAndResetBrowser(browser()); | 2103 AddTabAndResetBrowser(browser()); |
2117 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 2104 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
2118 | 2105 |
2119 // Move to the first tab and drag it enough so that it detaches. | 2106 // Move to the first tab and drag it enough so that it detaches. |
2120 gfx::Point tab_0_center( | 2107 gfx::Point tab_0_center( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 DetachToDockedTabDragControllerTest, | 2174 DetachToDockedTabDragControllerTest, |
2188 ::testing::Values("mouse", "mouse docked")); | 2175 ::testing::Values("mouse", "mouse docked")); |
2189 INSTANTIATE_TEST_CASE_P(TabDragging, | 2176 INSTANTIATE_TEST_CASE_P(TabDragging, |
2190 DetachToBrowserTabDragControllerTestTouch, | 2177 DetachToBrowserTabDragControllerTestTouch, |
2191 ::testing::Values("touch", "touch docked")); | 2178 ::testing::Values("touch", "touch docked")); |
2192 #else | 2179 #else |
2193 INSTANTIATE_TEST_CASE_P(TabDragging, | 2180 INSTANTIATE_TEST_CASE_P(TabDragging, |
2194 DetachToBrowserTabDragControllerTest, | 2181 DetachToBrowserTabDragControllerTest, |
2195 ::testing::Values("mouse")); | 2182 ::testing::Values("mouse")); |
2196 #endif | 2183 #endif |
OLD | NEW |