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 1920263003: Rename gfx::Display/Screen to display::Display/Screen in chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/ui/views/tabs/window_finder.h" 30 #include "chrome/browser/ui/views/tabs/window_finder.h"
31 #include "chrome/test/base/in_process_browser_test.h" 31 #include "chrome/test/base/in_process_browser_test.h"
32 #include "chrome/test/base/interactive_test_utils.h" 32 #include "chrome/test/base/interactive_test_utils.h"
33 #include "chrome/test/base/ui_test_utils.h" 33 #include "chrome/test/base/ui_test_utils.h"
34 #include "content/public/browser/notification_details.h" 34 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_observer.h" 35 #include "content/public/browser/notification_observer.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
38 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
39 #include "ui/base/test/ui_controls.h" 39 #include "ui/base/test/ui_controls.h"
40 #include "ui/gfx/screen.h" 40 #include "ui/display/screen.h"
41 #include "ui/views/view.h" 41 #include "ui/views/view.h"
42 #include "ui/views/widget/widget.h" 42 #include "ui/views/widget/widget.h"
43 43
44 #if defined(USE_AURA) 44 #if defined(USE_AURA)
45 #include "ui/aura/client/aura_constants.h" 45 #include "ui/aura/client/aura_constants.h"
46 #include "ui/aura/test/test_window_delegate.h" 46 #include "ui/aura/test/test_window_delegate.h"
47 #include "ui/aura/test/test_windows.h" 47 #include "ui/aura/test/test_windows.h"
48 #include "ui/aura/window_targeter.h" 48 #include "ui/aura/window_targeter.h"
49 #endif 49 #endif
50 50
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ResetIDs(browser->tab_strip_model(), 0); 176 ResetIDs(browser->tab_strip_model(), 0);
177 } 177 }
178 178
179 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { 179 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() {
180 // Create another browser. 180 // Create another browser.
181 Browser* browser2 = CreateBrowser(browser()->profile()); 181 Browser* browser2 = CreateBrowser(browser()->profile());
182 ResetIDs(browser2->tab_strip_model(), 100); 182 ResetIDs(browser2->tab_strip_model(), 100);
183 183
184 // Resize the two windows so they're right next to each other. 184 // Resize the two windows so they're right next to each other.
185 gfx::Rect work_area = 185 gfx::Rect work_area =
186 gfx::Screen::GetScreen() 186 display::Screen::GetScreen()
187 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) 187 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())
188 .work_area(); 188 .work_area();
189 gfx::Size half_size = 189 gfx::Size half_size =
190 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); 190 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
191 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); 191 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size));
192 browser2->window()->SetBounds(gfx::Rect( 192 browser2->window()->SetBounds(gfx::Rect(
193 work_area.x() + half_size.width(), work_area.y(), 193 work_area.x() + half_size.width(), work_area.y(),
194 half_size.width(), half_size.height())); 194 half_size.width(), half_size.height()));
195 return browser2; 195 return browser2;
196 } 196 }
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 #define MAYBE_DetachFromFullsizeWindow DISABLED_DetachFromFullsizeWindow 858 #define MAYBE_DetachFromFullsizeWindow DISABLED_DetachFromFullsizeWindow
859 #else 859 #else
860 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow 860 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow
861 #endif 861 #endif
862 // Tests that a tab can be dragged from a browser window that is resized to full 862 // Tests that a tab can be dragged from a browser window that is resized to full
863 // screen. 863 // screen.
864 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 864 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
865 MAYBE_DetachFromFullsizeWindow) { 865 MAYBE_DetachFromFullsizeWindow) {
866 // Resize the browser window so that it is as big as the work area. 866 // Resize the browser window so that it is as big as the work area.
867 gfx::Rect work_area = 867 gfx::Rect work_area =
868 gfx::Screen::GetScreen() 868 display::Screen::GetScreen()
869 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) 869 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())
870 .work_area(); 870 .work_area();
871 browser()->window()->SetBounds(work_area); 871 browser()->window()->SetBounds(work_area);
872 const gfx::Rect initial_bounds(browser()->window()->GetBounds()); 872 const gfx::Rect initial_bounds(browser()->window()->GetBounds());
873 // Add another tab. 873 // Add another tab.
874 AddTabAndResetBrowser(browser()); 874 AddTabAndResetBrowser(browser());
875 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 875 TabStrip* tab_strip = GetTabStripForBrowser(browser());
876 876
877 // Move to the first tab and drag it enough so that it detaches. 877 // Move to the first tab and drag it enough so that it detaches.
878 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 878 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 1824
1825 // Create another browser. 1825 // Create another browser.
1826 Browser* browser2 = CreateBrowser(browser()->profile()); 1826 Browser* browser2 = CreateBrowser(browser()->profile());
1827 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1827 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1828 ResetIDs(browser2->tab_strip_model(), 100); 1828 ResetIDs(browser2->tab_strip_model(), 100);
1829 1829
1830 // Move the second browser to the second display. 1830 // Move the second browser to the second display.
1831 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1831 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1832 ASSERT_EQ(2u, roots.size()); 1832 ASSERT_EQ(2u, roots.size());
1833 aura::Window* second_root = roots[1]; 1833 aura::Window* second_root = roots[1];
1834 gfx::Rect work_area = gfx::Screen::GetScreen() 1834 gfx::Rect work_area = display::Screen::GetScreen()
1835 ->GetDisplayNearestWindow(second_root) 1835 ->GetDisplayNearestWindow(second_root)
1836 .work_area(); 1836 .work_area();
1837 browser2->window()->SetBounds(work_area); 1837 browser2->window()->SetBounds(work_area);
1838 EXPECT_EQ(second_root, 1838 EXPECT_EQ(second_root,
1839 browser2->window()->GetNativeWindow()->GetRootWindow()); 1839 browser2->window()->GetNativeWindow()->GetRootWindow());
1840 1840
1841 // Move to the first tab and drag it enough so that it detaches, but not 1841 // Move to the first tab and drag it enough so that it detaches, but not
1842 // enough that it attaches to browser2. 1842 // enough that it attaches to browser2.
1843 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1843 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1844 ASSERT_TRUE(PressInput(tab_0_center)); 1844 ASSERT_TRUE(PressInput(tab_0_center));
(...skipping 30 matching lines...) Expand all
1875 1875
1876 // Create another browser. 1876 // Create another browser.
1877 Browser* browser2 = CreateBrowser(browser()->profile()); 1877 Browser* browser2 = CreateBrowser(browser()->profile());
1878 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1878 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1879 ResetIDs(browser2->tab_strip_model(), 100); 1879 ResetIDs(browser2->tab_strip_model(), 100);
1880 1880
1881 // Move both browsers to the second display. 1881 // Move both browsers to the second display.
1882 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1882 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1883 ASSERT_EQ(2u, roots.size()); 1883 ASSERT_EQ(2u, roots.size());
1884 aura::Window* second_root = roots[1]; 1884 aura::Window* second_root = roots[1];
1885 gfx::Rect work_area = gfx::Screen::GetScreen() 1885 gfx::Rect work_area = display::Screen::GetScreen()
1886 ->GetDisplayNearestWindow(second_root) 1886 ->GetDisplayNearestWindow(second_root)
1887 .work_area(); 1887 .work_area();
1888 browser()->window()->SetBounds(work_area); 1888 browser()->window()->SetBounds(work_area);
1889 1889
1890 // position both browser windows side by side on the second screen. 1890 // position both browser windows side by side on the second screen.
1891 gfx::Rect work_area2(work_area); 1891 gfx::Rect work_area2(work_area);
1892 work_area.set_width(work_area.width()/2); 1892 work_area.set_width(work_area.width()/2);
1893 browser()->window()->SetBounds(work_area); 1893 browser()->window()->SetBounds(work_area);
1894 work_area2.set_x(work_area2.x() + work_area2.width()/2); 1894 work_area2.set_x(work_area2.x() + work_area2.width()/2);
1895 work_area2.set_width(work_area2.width()/2); 1895 work_area2.set_width(work_area2.width()/2);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 // Add another tab. 1936 // Add another tab.
1937 AddTabAndResetBrowser(browser()); 1937 AddTabAndResetBrowser(browser());
1938 browser()->window()->Maximize(); 1938 browser()->window()->Maximize();
1939 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1939 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1940 1940
1941 // Create another browser on the second display. 1941 // Create another browser on the second display.
1942 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1942 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1943 ASSERT_EQ(2u, roots.size()); 1943 ASSERT_EQ(2u, roots.size());
1944 aura::Window* first_root = roots[0]; 1944 aura::Window* first_root = roots[0];
1945 aura::Window* second_root = roots[1]; 1945 aura::Window* second_root = roots[1];
1946 gfx::Rect work_area = gfx::Screen::GetScreen() 1946 gfx::Rect work_area = display::Screen::GetScreen()
1947 ->GetDisplayNearestWindow(second_root) 1947 ->GetDisplayNearestWindow(second_root)
1948 .work_area(); 1948 .work_area();
1949 work_area.Inset(20, 20, 20, 60); 1949 work_area.Inset(20, 20, 20, 60);
1950 Browser::CreateParams params(browser()->profile()); 1950 Browser::CreateParams params(browser()->profile());
1951 params.initial_show_state = ui::SHOW_STATE_NORMAL; 1951 params.initial_show_state = ui::SHOW_STATE_NORMAL;
1952 params.initial_bounds = work_area; 1952 params.initial_bounds = work_area;
1953 Browser* browser2 = new Browser(params); 1953 Browser* browser2 = new Browser(params);
1954 AddBlankTabAndShow(browser2); 1954 AddBlankTabAndShow(browser2);
1955 1955
1956 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1956 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 2006
2007 // Create another browser. 2007 // Create another browser.
2008 Browser* browser2 = CreateBrowser(browser()->profile()); 2008 Browser* browser2 = CreateBrowser(browser()->profile());
2009 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 2009 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
2010 ResetIDs(browser2->tab_strip_model(), 100); 2010 ResetIDs(browser2->tab_strip_model(), 100);
2011 2011
2012 // Move the second browser to the second display. 2012 // Move the second browser to the second display.
2013 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2013 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2014 ASSERT_EQ(2u, roots.size()); 2014 ASSERT_EQ(2u, roots.size());
2015 aura::Window* second_root = roots[1]; 2015 aura::Window* second_root = roots[1];
2016 gfx::Rect work_area = gfx::Screen::GetScreen() 2016 gfx::Rect work_area = display::Screen::GetScreen()
2017 ->GetDisplayNearestWindow(second_root) 2017 ->GetDisplayNearestWindow(second_root)
2018 .work_area(); 2018 .work_area();
2019 browser2->window()->SetBounds(work_area); 2019 browser2->window()->SetBounds(work_area);
2020 EXPECT_EQ(second_root, 2020 EXPECT_EQ(second_root,
2021 browser2->window()->GetNativeWindow()->GetRootWindow()); 2021 browser2->window()->GetNativeWindow()->GetRootWindow());
2022 2022
2023 // Put the second browser into immersive fullscreen. 2023 // Put the second browser into immersive fullscreen.
2024 BrowserView* browser_view2 = BrowserView::GetBrowserViewForBrowser(browser2); 2024 BrowserView* browser_view2 = BrowserView::GetBrowserViewForBrowser(browser2);
2025 ImmersiveModeController* immersive_controller2 = 2025 ImmersiveModeController* immersive_controller2 =
2026 browser_view2->immersive_mode_controller(); 2026 browser_view2->immersive_mode_controller();
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2253 DISABLED_CancelDragTabToWindowIn2ndDisplay) { 2253 DISABLED_CancelDragTabToWindowIn2ndDisplay) {
2254 // Add another tab. 2254 // Add another tab.
2255 AddTabAndResetBrowser(browser()); 2255 AddTabAndResetBrowser(browser());
2256 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2256 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2257 2257
2258 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2258 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2259 2259
2260 // Move the second browser to the second display. 2260 // Move the second browser to the second display.
2261 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2261 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2262 ASSERT_EQ(2u, roots.size()); 2262 ASSERT_EQ(2u, roots.size());
2263 gfx::Point final_destination = gfx::Screen::GetScreen() 2263 gfx::Point final_destination = display::Screen::GetScreen()
2264 ->GetDisplayNearestWindow(roots[1]) 2264 ->GetDisplayNearestWindow(roots[1])
2265 .work_area() 2265 .work_area()
2266 .CenterPoint(); 2266 .CenterPoint();
2267 2267
2268 // Move to the first tab and drag it enough so that it detaches, but not 2268 // Move to the first tab and drag it enough so that it detaches, but not
2269 // enough to move to another display. 2269 // enough to move to another display.
2270 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 2270 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2271 ASSERT_TRUE(Press(tab_0_dst)); 2271 ASSERT_TRUE(Press(tab_0_dst));
2272 tab_0_dst.Offset(0, GetDetachY(tab_strip)); 2272 tab_0_dst.Offset(0, GetDetachY(tab_strip));
2273 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( 2273 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone(
(...skipping 19 matching lines...) Expand all
2293 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2293 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2294 ASSERT_EQ(2u, roots.size()); 2294 ASSERT_EQ(2u, roots.size());
2295 2295
2296 // Add another tab. 2296 // Add another tab.
2297 AddTabAndResetBrowser(browser()); 2297 AddTabAndResetBrowser(browser());
2298 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2298 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2299 2299
2300 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2300 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2301 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); 2301 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow());
2302 2302
2303 gfx::Rect work_area = 2303 gfx::Rect work_area = display::Screen::GetScreen()
2304 gfx::Screen::GetScreen()->GetDisplayNearestWindow(roots[1]).work_area(); 2304 ->GetDisplayNearestWindow(roots[1])
2305 .work_area();
2305 browser()->window()->SetBounds(work_area); 2306 browser()->window()->SetBounds(work_area);
2306 EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow()); 2307 EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow());
2307 2308
2308 // Move the second browser to the display. 2309 // Move the second browser to the display.
2309 gfx::Point final_destination = gfx::Screen::GetScreen() 2310 gfx::Point final_destination = display::Screen::GetScreen()
2310 ->GetDisplayNearestWindow(roots[0]) 2311 ->GetDisplayNearestWindow(roots[0])
2311 .work_area() 2312 .work_area()
2312 .CenterPoint(); 2313 .CenterPoint();
2313 2314
2314 // Move to the first tab and drag it enough so that it detaches, but not 2315 // Move to the first tab and drag it enough so that it detaches, but not
2315 // enough to move to another display. 2316 // enough to move to another display.
2316 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 2317 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2317 ASSERT_TRUE(Press(tab_0_dst)); 2318 ASSERT_TRUE(Press(tab_0_dst));
2318 tab_0_dst.Offset(0, GetDetachY(tab_strip)); 2319 tab_0_dst.Offset(0, GetDetachY(tab_strip));
2319 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( 2320 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 DetachToBrowserTabDragControllerTest, 2472 DetachToBrowserTabDragControllerTest,
2472 ::testing::Values("mouse", "touch")); 2473 ::testing::Values("mouse", "touch"));
2473 INSTANTIATE_TEST_CASE_P(TabDragging, 2474 INSTANTIATE_TEST_CASE_P(TabDragging,
2474 DetachToBrowserTabDragControllerTestTouch, 2475 DetachToBrowserTabDragControllerTestTouch,
2475 ::testing::Values("touch")); 2476 ::testing::Values("touch"));
2476 #else 2477 #else
2477 INSTANTIATE_TEST_CASE_P(TabDragging, 2478 INSTANTIATE_TEST_CASE_P(TabDragging,
2478 DetachToBrowserTabDragControllerTest, 2479 DetachToBrowserTabDragControllerTest,
2479 ::testing::Values("mouse")); 2480 ::testing::Values("mouse"));
2480 #endif 2481 #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