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

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

Issue 2751833004: Reland "Add display::GetDisplayNearestView" (Closed)
Patch Set: Created 3 years, 9 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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/callback_helpers.h" 14 #include "base/callback_helpers.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/run_loop.h" 19 #include "base/run_loop.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "chrome/browser/chrome_notification_types.h" 24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/platform_util.h"
26 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_commands.h" 26 #include "chrome/browser/ui/browser_commands.h"
28 #include "chrome/browser/ui/browser_list.h" 27 #include "chrome/browser/ui/browser_list.h"
29 #include "chrome/browser/ui/browser_tabstrip.h" 28 #include "chrome/browser/ui/browser_tabstrip.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" 29 #include "chrome/browser/ui/tabs/tab_strip_model.h"
31 #include "chrome/browser/ui/views/frame/browser_view.h" 30 #include "chrome/browser/ui/views/frame/browser_view.h"
32 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" 31 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
33 #include "chrome/browser/ui/views/tabs/tab.h" 32 #include "chrome/browser/ui/views/tabs/tab.h"
34 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" 33 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
35 #include "chrome/browser/ui/views/tabs/tab_strip.h" 34 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 187 }
189 188
190 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { 189 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() {
191 // Create another browser. 190 // Create another browser.
192 Browser* browser2 = CreateBrowser(browser()->profile()); 191 Browser* browser2 = CreateBrowser(browser()->profile());
193 ResetIDs(browser2->tab_strip_model(), 100); 192 ResetIDs(browser2->tab_strip_model(), 100);
194 193
195 // Resize the two windows so they're right next to each other. 194 // Resize the two windows so they're right next to each other.
196 gfx::Rect work_area = 195 gfx::Rect work_area =
197 display::Screen::GetScreen() 196 display::Screen::GetScreen()
198 ->GetDisplayNearestWindow(platform_util::GetViewForWindow( 197 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())
199 browser()->window()->GetNativeWindow()))
200 .work_area(); 198 .work_area();
201 gfx::Size half_size = 199 gfx::Size half_size =
202 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); 200 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
203 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); 201 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size));
204 browser2->window()->SetBounds(gfx::Rect( 202 browser2->window()->SetBounds(gfx::Rect(
205 work_area.x() + half_size.width(), work_area.y(), 203 work_area.x() + half_size.width(), work_area.y(),
206 half_size.width(), half_size.height())); 204 half_size.width(), half_size.height()));
207 return browser2; 205 return browser2;
208 } 206 }
209 207
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 #else 911 #else
914 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow 912 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow
915 #endif 913 #endif
916 // Tests that a tab can be dragged from a browser window that is resized to full 914 // Tests that a tab can be dragged from a browser window that is resized to full
917 // screen. 915 // screen.
918 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 916 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
919 MAYBE_DetachFromFullsizeWindow) { 917 MAYBE_DetachFromFullsizeWindow) {
920 // Resize the browser window so that it is as big as the work area. 918 // Resize the browser window so that it is as big as the work area.
921 gfx::Rect work_area = 919 gfx::Rect work_area =
922 display::Screen::GetScreen() 920 display::Screen::GetScreen()
923 ->GetDisplayNearestWindow(platform_util::GetViewForWindow( 921 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow())
924 browser()->window()->GetNativeWindow()))
925 .work_area(); 922 .work_area();
926 browser()->window()->SetBounds(work_area); 923 browser()->window()->SetBounds(work_area);
927 const gfx::Rect initial_bounds(browser()->window()->GetBounds()); 924 const gfx::Rect initial_bounds(browser()->window()->GetBounds());
928 // Add another tab. 925 // Add another tab.
929 AddTabAndResetBrowser(browser()); 926 AddTabAndResetBrowser(browser());
930 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 927 TabStrip* tab_strip = GetTabStripForBrowser(browser());
931 928
932 // Move to the first tab and drag it enough so that it detaches. 929 // Move to the first tab and drag it enough so that it detaches.
933 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 930 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
934 ASSERT_TRUE(PressInput(tab_0_center)); 931 ASSERT_TRUE(PressInput(tab_0_center));
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 DetachToBrowserTabDragControllerTest, 2547 DetachToBrowserTabDragControllerTest,
2551 ::testing::Values("mouse", "touch")); 2548 ::testing::Values("mouse", "touch"));
2552 INSTANTIATE_TEST_CASE_P(TabDragging, 2549 INSTANTIATE_TEST_CASE_P(TabDragging,
2553 DetachToBrowserTabDragControllerTestTouch, 2550 DetachToBrowserTabDragControllerTestTouch,
2554 ::testing::Values("touch")); 2551 ::testing::Values("touch"));
2555 #else 2552 #else
2556 INSTANTIATE_TEST_CASE_P(TabDragging, 2553 INSTANTIATE_TEST_CASE_P(TabDragging,
2557 DetachToBrowserTabDragControllerTest, 2554 DetachToBrowserTabDragControllerTest,
2558 ::testing::Values("mouse")); 2555 ::testing::Values("mouse"));
2559 #endif 2556 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/status_bubble_views.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698