Chromium Code Reviews| 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 both |
| 1825 // With the touch input the browser cannot be dragged from one screen | 1825 // mouse drag and touch drag. |
|
Peter Kasting
2017/04/24 22:04:16
Nit: Make sure to wrap at 80 columns (not earlier)
weidongg
2017/04/25 00:25:47
Done.
| |
| 1826 // to another and the window stays on the first screen. | 1826 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
| 1827 if (input_source() == INPUT_SOURCE_MOUSE) { | 1827 ASSERT_EQ(2u, roots.size()); |
| 1828 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 1828 aura::Window* second_root = roots[1]; |
| 1829 ASSERT_EQ(2u, roots.size()); | 1829 EXPECT_EQ(second_root, |
| 1830 aura::Window* second_root = roots[1]; | 1830 new_browser->window()->GetNativeWindow()->GetRootWindow()); |
| 1831 EXPECT_EQ(second_root, | |
| 1832 new_browser->window()->GetNativeWindow()->GetRootWindow()); | |
| 1833 } | |
| 1834 | 1831 |
| 1835 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); | 1832 EXPECT_EQ("0", IDString(new_browser->tab_strip_model())); |
| 1836 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 1833 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
| 1837 | 1834 |
| 1838 // Both windows should not be maximized | 1835 // Both windows should not be maximized |
| 1839 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1836 EXPECT_FALSE(browser()->window()->IsMaximized()); |
| 1840 EXPECT_FALSE(new_browser->window()->IsMaximized()); | 1837 EXPECT_FALSE(new_browser->window()->IsMaximized()); |
| 1841 } | 1838 } |
| 1842 | 1839 |
| 1843 namespace { | 1840 namespace { |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2462 DetachToBrowserTabDragControllerTest, | 2459 DetachToBrowserTabDragControllerTest, |
| 2463 ::testing::Values("mouse", "touch")); | 2460 ::testing::Values("mouse", "touch")); |
| 2464 INSTANTIATE_TEST_CASE_P(TabDragging, | 2461 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2465 DetachToBrowserTabDragControllerTestTouch, | 2462 DetachToBrowserTabDragControllerTestTouch, |
| 2466 ::testing::Values("touch")); | 2463 ::testing::Values("touch")); |
| 2467 #else | 2464 #else |
| 2468 INSTANTIATE_TEST_CASE_P(TabDragging, | 2465 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2469 DetachToBrowserTabDragControllerTest, | 2466 DetachToBrowserTabDragControllerTest, |
| 2470 ::testing::Values("mouse")); | 2467 ::testing::Values("mouse")); |
| 2471 #endif | 2468 #endif |
| OLD | NEW |