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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 StopAnimating(GetTabStripForBrowser(browser)); | 149 StopAnimating(GetTabStripForBrowser(browser)); |
150 ResetIDs(browser->tab_strip_model(), 0); | 150 ResetIDs(browser->tab_strip_model(), 0); |
151 } | 151 } |
152 | 152 |
153 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { | 153 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { |
154 // Create another browser. | 154 // Create another browser. |
155 Browser* browser2 = CreateBrowser(browser()->profile()); | 155 Browser* browser2 = CreateBrowser(browser()->profile()); |
156 ResetIDs(browser2->tab_strip_model(), 100); | 156 ResetIDs(browser2->tab_strip_model(), 100); |
157 | 157 |
158 // Resize the two windows so they're right next to each other. | 158 // Resize the two windows so they're right next to each other. |
159 gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow( | 159 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( |
160 browser()->window()->GetNativeWindow()).work_area(); | 160 browser()->window()->GetNativeWindow()).work_area(); |
161 gfx::Size half_size = | 161 gfx::Size half_size = |
162 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); | 162 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); |
163 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); | 163 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); |
164 browser2->window()->SetBounds(gfx::Rect( | 164 browser2->window()->SetBounds(gfx::Rect( |
165 work_area.x() + half_size.width(), work_area.y(), | 165 work_area.x() + half_size.width(), work_area.y(), |
166 half_size.width(), half_size.height())); | 166 half_size.width(), half_size.height())); |
167 return browser2; | 167 return browser2; |
168 } | 168 } |
169 | 169 |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
996 | 996 |
997 // Create another browser. | 997 // Create another browser. |
998 Browser* browser2 = CreateBrowser(browser()->profile()); | 998 Browser* browser2 = CreateBrowser(browser()->profile()); |
999 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 999 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
1000 ResetIDs(browser2->tab_strip_model(), 100); | 1000 ResetIDs(browser2->tab_strip_model(), 100); |
1001 | 1001 |
1002 // Move the second browser to the second display. | 1002 // Move the second browser to the second display. |
1003 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); | 1003 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); |
1004 ASSERT_EQ(2u, roots.size()); | 1004 ASSERT_EQ(2u, roots.size()); |
1005 aura::RootWindow* second_root = roots[1]; | 1005 aura::RootWindow* second_root = roots[1]; |
1006 gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow( | 1006 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( |
oshima
2012/10/10 17:58:23
Testing ash+native environment is going to be chal
scottmg
2012/10/10 19:04:47
Agreed. we'll definitely have to set up more bots
| |
1007 second_root).work_area(); | 1007 second_root).work_area(); |
1008 browser2->window()->SetBounds(work_area); | 1008 browser2->window()->SetBounds(work_area); |
1009 EXPECT_EQ(second_root, | 1009 EXPECT_EQ(second_root, |
1010 browser2->window()->GetNativeWindow()->GetRootWindow()); | 1010 browser2->window()->GetNativeWindow()->GetRootWindow()); |
1011 | 1011 |
1012 // Move to the first tab and drag it enough so that it detaches, but not | 1012 // Move to the first tab and drag it enough so that it detaches, but not |
1013 // enough that it attaches to browser2. | 1013 // enough that it attaches to browser2. |
1014 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1014 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
1015 ASSERT_TRUE(PressInput(tab_0_center)); | 1015 ASSERT_TRUE(PressInput(tab_0_center)); |
1016 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1016 ASSERT_TRUE(DragInputToNotifyWhenDone( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1108 // Add another tab. | 1108 // Add another tab. |
1109 AddTabAndResetBrowser(browser()); | 1109 AddTabAndResetBrowser(browser()); |
1110 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1110 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1111 | 1111 |
1112 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 1112 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
1113 | 1113 |
1114 // Move the second browser to the second display. | 1114 // Move the second browser to the second display. |
1115 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); | 1115 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); |
1116 ASSERT_EQ(2u, roots.size()); | 1116 ASSERT_EQ(2u, roots.size()); |
1117 gfx::Point final_destination = | 1117 gfx::Point final_destination = |
1118 gfx::Screen::GetDisplayNearestWindow(roots[1]).work_area().CenterPoint(); | 1118 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( |
1119 roots[1]).work_area().CenterPoint(); | |
1119 | 1120 |
1120 // Move to the first tab and drag it enough so that it detaches, but not | 1121 // Move to the first tab and drag it enough so that it detaches, but not |
1121 // enough to move to another display. | 1122 // enough to move to another display. |
1122 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1123 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
1123 ASSERT_TRUE(Press(tab_0_dst)); | 1124 ASSERT_TRUE(Press(tab_0_dst)); |
1124 tab_0_dst.Offset(0, GetDetachY(tab_strip)); | 1125 tab_0_dst.Offset(0, GetDetachY(tab_strip)); |
1125 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( | 1126 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( |
1126 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, | 1127 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, |
1127 this, tab_strip, roots[0], final_destination))); | 1128 this, tab_strip, roots[0], final_destination))); |
1128 QuitWhenNotDragging(); | 1129 QuitWhenNotDragging(); |
(...skipping 15 matching lines...) Expand all Loading... | |
1144 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); | 1145 std::vector<aura::RootWindow*> roots(ash::Shell::GetAllRootWindows()); |
1145 ASSERT_EQ(2u, roots.size()); | 1146 ASSERT_EQ(2u, roots.size()); |
1146 | 1147 |
1147 // Add another tab. | 1148 // Add another tab. |
1148 AddTabAndResetBrowser(browser()); | 1149 AddTabAndResetBrowser(browser()); |
1149 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1150 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1150 | 1151 |
1151 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 1152 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
1152 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); | 1153 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); |
1153 | 1154 |
1154 gfx::Rect work_area = | 1155 gfx::Rect work_area = gfx::Screen::GetNativeScreen()-> |
1155 gfx::Screen::GetDisplayNearestWindow(roots[1]).work_area(); | 1156 GetDisplayNearestWindow(roots[1]).work_area(); |
1156 browser()->window()->SetBounds(work_area); | 1157 browser()->window()->SetBounds(work_area); |
1157 EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow()); | 1158 EXPECT_EQ(roots[1], browser()->window()->GetNativeWindow()->GetRootWindow()); |
1158 | 1159 |
1159 // Move the second browser to the display. | 1160 // Move the second browser to the display. |
1160 gfx::Point final_destination = | 1161 gfx::Point final_destination = |
1161 gfx::Screen::GetDisplayNearestWindow(roots[0]).work_area().CenterPoint(); | 1162 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( |
1163 roots[0]).work_area().CenterPoint(); | |
1162 | 1164 |
1163 // Move to the first tab and drag it enough so that it detaches, but not | 1165 // Move to the first tab and drag it enough so that it detaches, but not |
1164 // enough to move to another display. | 1166 // enough to move to another display. |
1165 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1167 gfx::Point tab_0_dst(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
1166 ASSERT_TRUE(Press(tab_0_dst)); | 1168 ASSERT_TRUE(Press(tab_0_dst)); |
1167 tab_0_dst.Offset(0, GetDetachY(tab_strip)); | 1169 tab_0_dst.Offset(0, GetDetachY(tab_strip)); |
1168 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( | 1170 ASSERT_TRUE(DragTabAndExecuteTaskWhenDone( |
1169 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, | 1171 tab_0_dst, base::Bind(&CancelDragTabToWindowInSeparateDisplayStep2, |
1170 this, tab_strip, roots[1], final_destination))); | 1172 this, tab_strip, roots[1], final_destination))); |
1171 QuitWhenNotDragging(); | 1173 QuitWhenNotDragging(); |
(...skipping 15 matching lines...) Expand all Loading... | |
1187 DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1189 DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1188 ::testing::Values("mouse", "touch")); | 1190 ::testing::Values("mouse", "touch")); |
1189 INSTANTIATE_TEST_CASE_P(TabDragging, | 1191 INSTANTIATE_TEST_CASE_P(TabDragging, |
1190 DetachToBrowserTabDragControllerTest, | 1192 DetachToBrowserTabDragControllerTest, |
1191 ::testing::Values("mouse", "touch")); | 1193 ::testing::Values("mouse", "touch")); |
1192 #else | 1194 #else |
1193 INSTANTIATE_TEST_CASE_P(TabDragging, | 1195 INSTANTIATE_TEST_CASE_P(TabDragging, |
1194 DetachToBrowserTabDragControllerTest, | 1196 DetachToBrowserTabDragControllerTest, |
1195 ::testing::Values("mouse")); | 1197 ::testing::Values("mouse")); |
1196 #endif | 1198 #endif |
OLD | NEW |