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

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

Issue 2747143005: Revert of 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"
25 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_commands.h" 27 #include "chrome/browser/ui/browser_commands.h"
27 #include "chrome/browser/ui/browser_list.h" 28 #include "chrome/browser/ui/browser_list.h"
28 #include "chrome/browser/ui/browser_tabstrip.h" 29 #include "chrome/browser/ui/browser_tabstrip.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/browser/ui/views/frame/browser_view.h" 31 #include "chrome/browser/ui/views/frame/browser_view.h"
31 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" 32 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
32 #include "chrome/browser/ui/views/tabs/tab.h" 33 #include "chrome/browser/ui/views/tabs/tab.h"
33 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" 34 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
34 #include "chrome/browser/ui/views/tabs/tab_strip.h" 35 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 188 }
188 189
189 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { 190 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() {
190 // Create another browser. 191 // Create another browser.
191 Browser* browser2 = CreateBrowser(browser()->profile()); 192 Browser* browser2 = CreateBrowser(browser()->profile());
192 ResetIDs(browser2->tab_strip_model(), 100); 193 ResetIDs(browser2->tab_strip_model(), 100);
193 194
194 // Resize the two windows so they're right next to each other. 195 // Resize the two windows so they're right next to each other.
195 gfx::Rect work_area = 196 gfx::Rect work_area =
196 display::Screen::GetScreen() 197 display::Screen::GetScreen()
197 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) 198 ->GetDisplayNearestWindow(platform_util::GetViewForWindow(
199 browser()->window()->GetNativeWindow()))
198 .work_area(); 200 .work_area();
199 gfx::Size half_size = 201 gfx::Size half_size =
200 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); 202 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
201 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); 203 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size));
202 browser2->window()->SetBounds(gfx::Rect( 204 browser2->window()->SetBounds(gfx::Rect(
203 work_area.x() + half_size.width(), work_area.y(), 205 work_area.x() + half_size.width(), work_area.y(),
204 half_size.width(), half_size.height())); 206 half_size.width(), half_size.height()));
205 return browser2; 207 return browser2;
206 } 208 }
207 209
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 #else 913 #else
912 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow 914 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow
913 #endif 915 #endif
914 // Tests that a tab can be dragged from a browser window that is resized to full 916 // Tests that a tab can be dragged from a browser window that is resized to full
915 // screen. 917 // screen.
916 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 918 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
917 MAYBE_DetachFromFullsizeWindow) { 919 MAYBE_DetachFromFullsizeWindow) {
918 // Resize the browser window so that it is as big as the work area. 920 // Resize the browser window so that it is as big as the work area.
919 gfx::Rect work_area = 921 gfx::Rect work_area =
920 display::Screen::GetScreen() 922 display::Screen::GetScreen()
921 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) 923 ->GetDisplayNearestWindow(platform_util::GetViewForWindow(
924 browser()->window()->GetNativeWindow()))
922 .work_area(); 925 .work_area();
923 browser()->window()->SetBounds(work_area); 926 browser()->window()->SetBounds(work_area);
924 const gfx::Rect initial_bounds(browser()->window()->GetBounds()); 927 const gfx::Rect initial_bounds(browser()->window()->GetBounds());
925 // Add another tab. 928 // Add another tab.
926 AddTabAndResetBrowser(browser()); 929 AddTabAndResetBrowser(browser());
927 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 930 TabStrip* tab_strip = GetTabStripForBrowser(browser());
928 931
929 // Move to the first tab and drag it enough so that it detaches. 932 // Move to the first tab and drag it enough so that it detaches.
930 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 933 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
931 ASSERT_TRUE(PressInput(tab_0_center)); 934 ASSERT_TRUE(PressInput(tab_0_center));
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 DetachToBrowserTabDragControllerTest, 2550 DetachToBrowserTabDragControllerTest,
2548 ::testing::Values("mouse", "touch")); 2551 ::testing::Values("mouse", "touch"));
2549 INSTANTIATE_TEST_CASE_P(TabDragging, 2552 INSTANTIATE_TEST_CASE_P(TabDragging,
2550 DetachToBrowserTabDragControllerTestTouch, 2553 DetachToBrowserTabDragControllerTestTouch,
2551 ::testing::Values("touch")); 2554 ::testing::Values("touch"));
2552 #else 2555 #else
2553 INSTANTIATE_TEST_CASE_P(TabDragging, 2556 INSTANTIATE_TEST_CASE_P(TabDragging,
2554 DetachToBrowserTabDragControllerTest, 2557 DetachToBrowserTabDragControllerTest,
2555 ::testing::Values("mouse")); 2558 ::testing::Values("mouse"));
2556 #endif 2559 #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