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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new android code Created 8 years, 2 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 | Annotate | Revision Log
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 "ash/wm/property_util.h" 7 #include "ash/wm/property_util.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 StopAnimating(GetTabStripForBrowser(browser)); 150 StopAnimating(GetTabStripForBrowser(browser));
151 ResetIDs(browser->tab_strip_model(), 0); 151 ResetIDs(browser->tab_strip_model(), 0);
152 } 152 }
153 153
154 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { 154 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() {
155 // Create another browser. 155 // Create another browser.
156 Browser* browser2 = CreateBrowser(browser()->profile()); 156 Browser* browser2 = CreateBrowser(browser()->profile());
157 ResetIDs(browser2->tab_strip_model(), 100); 157 ResetIDs(browser2->tab_strip_model(), 100);
158 158
159 // Resize the two windows so they're right next to each other. 159 // Resize the two windows so they're right next to each other.
160 gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow( 160 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
161 browser()->window()->GetNativeWindow()).work_area(); 161 browser()->window()->GetNativeWindow()).work_area();
162 gfx::Size half_size = 162 gfx::Size half_size =
163 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); 163 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
164 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); 164 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size));
165 browser2->window()->SetBounds(gfx::Rect( 165 browser2->window()->SetBounds(gfx::Rect(
166 work_area.x() + half_size.width(), work_area.y(), 166 work_area.x() + half_size.width(), work_area.y(),
167 half_size.width(), half_size.height())); 167 half_size.width(), half_size.height()));
168 return browser2; 168 return browser2;
169 } 169 }
170 170
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 1078
1079 // Create another browser. 1079 // Create another browser.
1080 Browser* browser2 = CreateBrowser(browser()->profile()); 1080 Browser* browser2 = CreateBrowser(browser()->profile());
1081 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1081 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1082 ResetIDs(browser2->tab_strip_model(), 100); 1082 ResetIDs(browser2->tab_strip_model(), 100);
1083 1083
1084 // Move the second browser to the second display. 1084 // Move the second browser to the second display.
1085 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); 1085 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows());
1086 ASSERT_EQ(2u, roots.size()); 1086 ASSERT_EQ(2u, roots.size());
1087 aura::RootWindow* second_root = roots[1]; 1087 aura::RootWindow* second_root = roots[1];
1088 gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow( 1088 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
1089 second_root).work_area(); 1089 second_root).work_area();
1090 browser2->window()->SetBounds(work_area); 1090 browser2->window()->SetBounds(work_area);
1091 EXPECT_EQ(second_root, 1091 EXPECT_EQ(second_root,
1092 browser2->window()->GetNativeWindow()->GetRootWindow()); 1092 browser2->window()->GetNativeWindow()->GetRootWindow());
1093 1093
1094 // Move to the first tab and drag it enough so that it detaches, but not 1094 // Move to the first tab and drag it enough so that it detaches, but not
1095 // enough that it attaches to browser2. 1095 // enough that it attaches to browser2.
1096 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1096 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1097 ASSERT_TRUE(PressInput(tab_0_center)); 1097 ASSERT_TRUE(PressInput(tab_0_center));
1098 ASSERT_TRUE(DragInputToNotifyWhenDone( 1098 ASSERT_TRUE(DragInputToNotifyWhenDone(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 // Add another tab. 1190 // Add another tab.
1191 AddTabAndResetBrowser(browser()); 1191 AddTabAndResetBrowser(browser());
1192 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1192 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1193 1193
1194 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 1194 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
1195 1195
1196 // Move the second browser to the second display. 1196 // Move the second browser to the second display.
1197 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); 1197 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows());
1198 ASSERT_EQ(2u, roots.size()); 1198 ASSERT_EQ(2u, roots.size());
1199 gfx::Point final_destination = 1199 gfx::Point final_destination =
1200 gfx::Screen::GetDisplayNearestWindow(roots[1]).work_area().CenterPoint(); 1200 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
1201 roots[1]).work_area().CenterPoint();
1201 1202
1202 // Move to the first tab and drag it enough so that it detaches, but not 1203 // Move to the first tab and drag it enough so that it detaches, but not
1203 // enough to move to another display. 1204 // enough to move to another display.
1204 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1205 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1205 ASSERT_TRUE(Press(tab_0_dst)); 1206 ASSERT_TRUE(Press(tab_0_dst));
1206 tab_0_dst.Offset(0, GetDetachY(tab_strip)); 1207 tab_0_dst.Offset(0, GetDetachY(tab_strip));
1207 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( 1208 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone(
1208 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, 1209 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2,
1209 this, tab_strip, roots[0], final_destination))); 1210 this, tab_strip, roots[0], final_destination)));
1210 QuitWhenNotDragging(); 1211 QuitWhenNotDragging();
(...skipping 15 matching lines...) Expand all
1226 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); 1227 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows());
1227 ASSERT_EQ(2u, roots.size()); 1228 ASSERT_EQ(2u, roots.size());
1228 1229
1229 // Add another tab. 1230 // Add another tab.
1230 AddTabAndResetBrowser(browser()); 1231 AddTabAndResetBrowser(browser());
1231 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1232 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1232 1233
1233 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 1234 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
1234 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); 1235 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow());
1235 1236
1236 gfx::Rect work_area = 1237 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->
1237 gfx::Screen::GetDisplayNearestWindow(roots[1]).work_area(); 1238 GetDisplayNearestWindow(roots[1]).work_area();
1238 browser()->window()->SetBounds(work_area); 1239 browser()->window()->SetBounds(work_area);
1239 EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow()); 1240 EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow());
1240 1241
1241 // Move the second browser to the display. 1242 // Move the second browser to the display.
1242 gfx::Point final_destination = 1243 gfx::Point final_destination =
1243 gfx::Screen::GetDisplayNearestWindow(roots[0]).work_area().CenterPoint(); 1244 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
1245 roots[0]).work_area().CenterPoint();
1244 1246
1245 // Move to the first tab and drag it enough so that it detaches, but not 1247 // Move to the first tab and drag it enough so that it detaches, but not
1246 // enough to move to another display. 1248 // enough to move to another display.
1247 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1249 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1248 ASSERT_TRUE(Press(tab_0_dst)); 1250 ASSERT_TRUE(Press(tab_0_dst));
1249 tab_0_dst.Offset(0, GetDetachY(tab_strip)); 1251 tab_0_dst.Offset(0, GetDetachY(tab_strip));
1250 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( 1252 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone(
1251 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, 1253 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2,
1252 this, tab_strip, roots[1], final_destination))); 1254 this, tab_strip, roots[1], final_destination)));
1253 QuitWhenNotDragging(); 1255 QuitWhenNotDragging();
(...skipping 15 matching lines...) Expand all
1269 DetachToBrowserInSeparateDisplayTabDragControllerTest, 1271 DetachToBrowserInSeparateDisplayTabDragControllerTest,
1270 ::testing::Values("mouse", "touch")); 1272 ::testing::Values("mouse", "touch"));
1271 INSTANTIATE_TEST_CASE_P(TabDragging, 1273 INSTANTIATE_TEST_CASE_P(TabDragging,
1272 DetachToBrowserTabDragControllerTest, 1274 DetachToBrowserTabDragControllerTest,
1273 ::testing::Values("mouse", "touch")); 1275 ::testing::Values("mouse", "touch"));
1274 #else 1276 #else
1275 INSTANTIATE_TEST_CASE_P(TabDragging, 1277 INSTANTIATE_TEST_CASE_P(TabDragging,
1276 DetachToBrowserTabDragControllerTest, 1278 DetachToBrowserTabDragControllerTest,
1277 ::testing::Values("mouse")); 1279 ::testing::Values("mouse"));
1278 #endif 1280 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698