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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1786 const gfx::Point& target_point) { | 1786 const gfx::Point& target_point) { |
1787 ASSERT_TRUE(test->DragInputToNotifyWhenDone( | 1787 ASSERT_TRUE(test->DragInputToNotifyWhenDone( |
1788 target_point.x(), target_point.y(), | 1788 target_point.x(), target_point.y(), |
1789 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test))); | 1789 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test))); |
1790 } | 1790 } |
1791 | 1791 |
1792 } // namespace | 1792 } // namespace |
1793 | 1793 |
1794 // Drags from browser to a second display and releases input. | 1794 // Drags from browser to a second display and releases input. |
1795 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1795 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1796 DISABLED_DragSingleTabToSeparateWindowInSecondDisplay) { | 1796 DragSingleTabToSeparateWindowInSecondDisplay) { |
1797 // Add another tab. | 1797 // Add another tab. |
1798 AddTabAndResetBrowser(browser()); | 1798 AddTabAndResetBrowser(browser()); |
1799 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1799 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1800 | 1800 |
1801 // Move to the first tab and drag it enough so that it detaches. | 1801 // Move to the first tab and drag it enough so that it detaches. |
1802 // Then drag it to the final destination on the second screen. | 1802 // Then drag it to the final destination on the second screen. |
1803 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1803 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
1804 ASSERT_TRUE(PressInput(tab_0_center)); | 1804 ASSERT_TRUE(PressInput(tab_0_center)); |
1805 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1805 ASSERT_TRUE(DragInputToNotifyWhenDone( |
1806 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1806 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
1807 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep2, | 1807 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep2, |
1808 this, gfx::Point(600 + tab_0_center.x(), | 1808 this, gfx::Point(600 + tab_0_center.x(), |
1809 tab_0_center.y() | 1809 tab_0_center.y() |
1810 + GetDetachY(tab_strip))))); | 1810 + GetDetachY(tab_strip))))); |
1811 QuitWhenNotDragging(); | 1811 QuitWhenNotDragging(); |
1812 | 1812 |
1813 // Should no longer be dragging. | 1813 // Should no longer be dragging. |
1814 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1814 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
1815 ASSERT_FALSE(TabDragController::IsActive()); | 1815 ASSERT_FALSE(TabDragController::IsActive()); |
1816 | 1816 |
1817 // There should now be another browser. | 1817 // There should now be another browser. |
1818 ASSERT_EQ(2u, browser_list->size()); | 1818 ASSERT_EQ(2u, browser_list->size()); |
1819 Browser* new_browser = browser_list->get(1); | 1819 Browser* new_browser = browser_list->get(1); |
1820 ASSERT_TRUE(new_browser->window()->IsActive()); | 1820 ASSERT_TRUE(new_browser->window()->IsActive()); |
1821 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 1821 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
1822 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 1822 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
1823 | 1823 |
1824 // This other browser should be on the second screen (with mouse drag) | 1824 // This other browser should be on the second screen with mouse drag. |
1825 // With the touch input the browser cannot be dragged from one screen | 1825 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
1826 // to another and the window stays on the first screen. | 1826 ASSERT_EQ(2u, roots.size()); |
1827 if (input_source() == INPUT_SOURCE_MOUSE) { | 1827 aura::Window* second_root = roots[1]; |
1828 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 1828 EXPECT_EQ(second_root, |
1829 ASSERT_EQ(2u, roots.size()); | 1829 new_browser->window()->GetNativeWindow()->GetRootWindow()); |
1830 aura::Window* second_root = roots[1]; | |
1831 EXPECT_EQ(second_root, | |
1832 new_browser->window()->GetNativeWindow()->GetRootWindow()); | |
1833 } | |
1834 | 1830 |
1835 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 1831 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
1836 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 1832 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
1837 | 1833 |
1838 // Both windows should not be maximized | 1834 // Both windows should not be maximized |
1839 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1835 EXPECT_FALSE(browser()->window()->IsMaximized()); |
1840 EXPECT_FALSE(new_browser->window()->IsMaximized()); | 1836 EXPECT_FALSE(new_browser->window()->IsMaximized()); |
1841 } | 1837 } |
1842 | 1838 |
1843 namespace { | 1839 namespace { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 2441 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
2446 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); | 2442 ASSERT_FALSE(tab_strip2->IsDragSessionActive()); |
2447 | 2443 |
2448 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 2444 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
2449 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 2445 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
2450 } | 2446 } |
2451 | 2447 |
2452 #endif // OS_CHROMEOS | 2448 #endif // OS_CHROMEOS |
2453 | 2449 |
2454 #if defined(USE_ASH) | 2450 #if defined(USE_ASH) |
| 2451 // There are no use case for touch drag to move across displays right now. |
| 2452 // Removes touch input here until we have that case. |
2455 INSTANTIATE_TEST_CASE_P(TabDragging, | 2453 INSTANTIATE_TEST_CASE_P(TabDragging, |
2456 DetachToBrowserInSeparateDisplayTabDragControllerTest, | 2454 DetachToBrowserInSeparateDisplayTabDragControllerTest, |
2457 ::testing::Values("mouse", "touch")); | 2455 ::testing::Values("mouse")); |
2458 INSTANTIATE_TEST_CASE_P(TabDragging, | 2456 INSTANTIATE_TEST_CASE_P(TabDragging, |
2459 DifferentDeviceScaleFactorDisplayTabDragControllerTest, | 2457 DifferentDeviceScaleFactorDisplayTabDragControllerTest, |
2460 ::testing::Values("mouse")); | 2458 ::testing::Values("mouse")); |
2461 INSTANTIATE_TEST_CASE_P(TabDragging, | 2459 INSTANTIATE_TEST_CASE_P(TabDragging, |
2462 DetachToBrowserTabDragControllerTest, | 2460 DetachToBrowserTabDragControllerTest, |
2463 ::testing::Values("mouse", "touch")); | 2461 ::testing::Values("mouse", "touch")); |
2464 INSTANTIATE_TEST_CASE_P(TabDragging, | 2462 INSTANTIATE_TEST_CASE_P(TabDragging, |
2465 DetachToBrowserTabDragControllerTestTouch, | 2463 DetachToBrowserTabDragControllerTestTouch, |
2466 ::testing::Values("touch")); | 2464 ::testing::Values("touch")); |
2467 #else | 2465 #else |
2468 INSTANTIATE_TEST_CASE_P(TabDragging, | 2466 INSTANTIATE_TEST_CASE_P(TabDragging, |
2469 DetachToBrowserTabDragControllerTest, | 2467 DetachToBrowserTabDragControllerTest, |
2470 ::testing::Values("mouse")); | 2468 ::testing::Values("mouse")); |
2471 #endif | 2469 #endif |
OLD | NEW |