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

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

Issue 1747803003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix include. Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/window_finder_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/callback.h" 12 #include "base/callback.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
23 #include "chrome/browser/platform_util.h"
23 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_commands.h" 25 #include "chrome/browser/ui/browser_commands.h"
25 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/browser_tabstrip.h" 27 #include "chrome/browser/ui/browser_tabstrip.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/browser/ui/views/frame/browser_view.h" 29 #include "chrome/browser/ui/views/frame/browser_view.h"
29 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" 30 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h"
30 #include "chrome/browser/ui/views/tabs/tab.h" 31 #include "chrome/browser/ui/views/tabs/tab.h"
31 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h" 32 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
32 #include "chrome/browser/ui/views/tabs/tab_strip.h" 33 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { 184 Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() {
184 // Create another browser. 185 // Create another browser.
185 Browser* browser2 = CreateBrowser(browser()->profile()); 186 Browser* browser2 = CreateBrowser(browser()->profile());
186 ResetIDs(browser2->tab_strip_model(), 100); 187 ResetIDs(browser2->tab_strip_model(), 100);
187 188
188 // Resize the two windows so they're right next to each other. 189 // Resize the two windows so they're right next to each other.
189 gfx::Rect work_area = 190 gfx::Rect work_area =
190 display::Screen::GetScreen() 191 display::Screen::GetScreen()
191 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) 192 ->GetDisplayNearestWindow(platform_util::GetViewForWindow(
193 browser()->window()->GetNativeWindow()))
192 .work_area(); 194 .work_area();
193 gfx::Size half_size = 195 gfx::Size half_size =
194 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); 196 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
195 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); 197 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size));
196 browser2->window()->SetBounds(gfx::Rect( 198 browser2->window()->SetBounds(gfx::Rect(
197 work_area.x() + half_size.width(), work_area.y(), 199 work_area.x() + half_size.width(), work_area.y(),
198 half_size.width(), half_size.height())); 200 half_size.width(), half_size.height()));
199 return browser2; 201 return browser2;
200 } 202 }
201 203
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 251 }
250 252
251 private: 253 private:
252 aura::Window* root_window_; 254 aura::Window* root_window_;
253 255
254 DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate); 256 DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate);
255 }; 257 };
256 258
257 #endif 259 #endif
258 260
259 #if !defined(OS_CHROMEOS) 261 #if !defined(OS_CHROMEOS) && defined(USE_AURA)
260 262
261 // Following classes verify a crash scenario. Specifically on Windows when focus 263 // Following classes verify a crash scenario. Specifically on Windows when focus
262 // changes it can trigger capture being lost. This was causing a crash in tab 264 // changes it can trigger capture being lost. This was causing a crash in tab
263 // dragging as it wasn't set up to handle this scenario. These classes 265 // dragging as it wasn't set up to handle this scenario. These classes
264 // synthesize this scenario. 266 // synthesize this scenario.
265 267
266 // Allows making ClearNativeFocus() invoke ReleaseCapture(). 268 // Allows making ClearNativeFocus() invoke ReleaseCapture().
267 class TestDesktopBrowserFrameAura : public DesktopBrowserFrameAura { 269 class TestDesktopBrowserFrameAura : public DesktopBrowserFrameAura {
268 public: 270 public:
269 TestDesktopBrowserFrameAura( 271 TestDesktopBrowserFrameAura(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 : public TabDragControllerTest, 369 : public TabDragControllerTest,
368 public ::testing::WithParamInterface<const char*> { 370 public ::testing::WithParamInterface<const char*> {
369 public: 371 public:
370 DetachToBrowserTabDragControllerTest() {} 372 DetachToBrowserTabDragControllerTest() {}
371 373
372 void SetUpOnMainThread() override { 374 void SetUpOnMainThread() override {
373 #if defined(OS_CHROMEOS) 375 #if defined(OS_CHROMEOS)
374 event_generator_.reset( 376 event_generator_.reset(
375 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow())); 377 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow()));
376 #endif 378 #endif
379 #if defined(OS_MACOSX)
380 // Currently MacViews' browser windows are shown in the background and could
381 // be obscured by other windows if there are any. This should be fixed in
382 // order to be consistent with other platforms.
383 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
384 #endif // OS_MACOSX
377 } 385 }
378 386
379 InputSource input_source() const { 387 InputSource input_source() const {
380 return strstr(GetParam(), "mouse") ? 388 return strstr(GetParam(), "mouse") ?
381 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; 389 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH;
382 } 390 }
383 391
384 // Set root window from a point in screen coordinates 392 // Set root window from a point in screen coordinates
385 void SetEventGeneratorRootWindow(const gfx::Point& point) { 393 void SetEventGeneratorRootWindow(const gfx::Point& point) {
386 if (input_source() == INPUT_SOURCE_MOUSE) 394 if (input_source() == INPUT_SOURCE_MOUSE)
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // Both windows should not be maximized 853 // Both windows should not be maximized
846 EXPECT_FALSE(browser()->window()->IsMaximized()); 854 EXPECT_FALSE(browser()->window()->IsMaximized());
847 EXPECT_FALSE(new_browser->window()->IsMaximized()); 855 EXPECT_FALSE(new_browser->window()->IsMaximized());
848 856
849 // The tab strip should no longer have capture because the drag was ended and 857 // The tab strip should no longer have capture because the drag was ended and
850 // mouse/touch was released. 858 // mouse/touch was released.
851 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture()); 859 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
852 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); 860 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
853 } 861 }
854 862
855 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 863 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX)
856 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 864 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
857 // compositor. crbug.com/331924 865 // compositor. crbug.com/331924
866 // TODO(tapted,mblsha): Disabled as the Mac IsMaximized() behavior is not
867 // consistent with other platforms. crbug.com/603562
858 #define MAYBE_DetachFromFullsizeWindow DISABLED_DetachFromFullsizeWindow 868 #define MAYBE_DetachFromFullsizeWindow DISABLED_DetachFromFullsizeWindow
859 #else 869 #else
860 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow 870 #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow
861 #endif 871 #endif
862 // Tests that a tab can be dragged from a browser window that is resized to full 872 // Tests that a tab can be dragged from a browser window that is resized to full
863 // screen. 873 // screen.
864 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 874 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
865 MAYBE_DetachFromFullsizeWindow) { 875 MAYBE_DetachFromFullsizeWindow) {
866 // Resize the browser window so that it is as big as the work area. 876 // Resize the browser window so that it is as big as the work area.
867 gfx::Rect work_area = 877 gfx::Rect work_area =
868 display::Screen::GetScreen() 878 display::Screen::GetScreen()
869 ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) 879 ->GetDisplayNearestWindow(platform_util::GetViewForWindow(
880 browser()->window()->GetNativeWindow()))
870 .work_area(); 881 .work_area();
871 browser()->window()->SetBounds(work_area); 882 browser()->window()->SetBounds(work_area);
872 const gfx::Rect initial_bounds(browser()->window()->GetBounds()); 883 const gfx::Rect initial_bounds(browser()->window()->GetBounds());
873 // Add another tab. 884 // Add another tab.
874 AddTabAndResetBrowser(browser()); 885 AddTabAndResetBrowser(browser());
875 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 886 TabStrip* tab_strip = GetTabStripForBrowser(browser());
876 887
877 // Move to the first tab and drag it enough so that it detaches. 888 // 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))); 889 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
879 ASSERT_TRUE(PressInput(tab_0_center)); 890 ASSERT_TRUE(PressInput(tab_0_center));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 // Only second window should be maximized. 924 // Only second window should be maximized.
914 EXPECT_FALSE(browser()->window()->IsMaximized()); 925 EXPECT_FALSE(browser()->window()->IsMaximized());
915 EXPECT_TRUE(new_browser->window()->IsMaximized()); 926 EXPECT_TRUE(new_browser->window()->IsMaximized());
916 927
917 // The tab strip should no longer have capture because the drag was ended and 928 // The tab strip should no longer have capture because the drag was ended and
918 // mouse/touch was released. 929 // mouse/touch was released.
919 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture()); 930 EXPECT_FALSE(tab_strip->GetWidget()->HasCapture());
920 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); 931 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
921 } 932 }
922 933
923 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 934 #if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX)
924 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 935 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
925 // compositor. crbug.com/331924 936 // compositor. crbug.com/331924
937 // TODO(tapted,mblsha): Disabled as the Mac IsMaximized() behavior is not
938 // consistent with other platforms. crbug.com/603562
926 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ 939 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \
927 DISABLED_DetachToOwnWindowFromMaximizedWindow 940 DISABLED_DetachToOwnWindowFromMaximizedWindow
928 #else 941 #else
929 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ 942 #define MAYBE_DetachToOwnWindowFromMaximizedWindow \
930 DetachToOwnWindowFromMaximizedWindow 943 DetachToOwnWindowFromMaximizedWindow
931 #endif 944 #endif
932 // Drags from browser to a separate window and releases mouse. 945 // Drags from browser to a separate window and releases mouse.
933 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 946 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
934 MAYBE_DetachToOwnWindowFromMaximizedWindow) { 947 MAYBE_DetachToOwnWindowFromMaximizedWindow) {
935 // Maximize the initial browser window. 948 // Maximize the initial browser window.
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 #else 1288 #else
1276 #define MAYBE_DragAll DragAll 1289 #define MAYBE_DragAll DragAll
1277 #endif 1290 #endif
1278 // Selects multiple tabs and starts dragging the window. 1291 // Selects multiple tabs and starts dragging the window.
1279 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, MAYBE_DragAll) { 1292 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, MAYBE_DragAll) {
1280 // Add another tab. 1293 // Add another tab.
1281 AddTabAndResetBrowser(browser()); 1294 AddTabAndResetBrowser(browser());
1282 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1295 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1283 browser()->tab_strip_model()->AddTabAtToSelection(0); 1296 browser()->tab_strip_model()->AddTabAtToSelection(0);
1284 browser()->tab_strip_model()->AddTabAtToSelection(1); 1297 browser()->tab_strip_model()->AddTabAtToSelection(1);
1298 const gfx::Rect initial_bounds = browser()->window()->GetBounds();
1285 1299
1286 // Move to the first tab and drag it enough so that it would normally 1300 // Move to the first tab and drag it enough so that it would normally
1287 // detach. 1301 // detach.
1288 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1302 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1289 ASSERT_TRUE(PressInput(tab_0_center)); 1303 ASSERT_TRUE(PressInput(tab_0_center));
1290 ASSERT_TRUE(DragInputToNotifyWhenDone( 1304 ASSERT_TRUE(DragInputToNotifyWhenDone(
1291 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 1305 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
1292 base::Bind(&DragAllStep2, this, browser_list))); 1306 base::Bind(&DragAllStep2, this, browser_list)));
1293 QuitWhenNotDragging(); 1307 QuitWhenNotDragging();
1294 1308
1295 // Should not be dragging. 1309 // Should not be dragging.
1296 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1310 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1297 ASSERT_FALSE(TabDragController::IsActive()); 1311 ASSERT_FALSE(TabDragController::IsActive());
1298 1312
1299 // And there should only be one window. 1313 // And there should only be one window.
1300 EXPECT_EQ(1u, browser_list->size()); 1314 EXPECT_EQ(1u, browser_list->size());
1301 1315
1302 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 1316 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
1303 1317
1304 EXPECT_FALSE(GetIsDragged(browser())); 1318 EXPECT_FALSE(GetIsDragged(browser()));
1305 1319
1306 // Remaining browser window should not be maximized 1320 // Remaining browser window should not be maximized
1307 EXPECT_FALSE(browser()->window()->IsMaximized()); 1321 EXPECT_FALSE(browser()->window()->IsMaximized());
1322
1323 const gfx::Rect final_bounds = browser()->window()->GetBounds();
1324 // Size unchanged, but it should have moved down.
1325 EXPECT_EQ(initial_bounds.size(), final_bounds.size());
1326 EXPECT_EQ(initial_bounds.origin().x(), final_bounds.origin().x());
1327 // TODO(mblsha): Fails on MacViews because of crbug.com/518740
1328 // EXPECT_EQ(initial_bounds.origin().y() + GetDetachY(tab_strip),
1329 // final_bounds.origin().y());
1308 } 1330 }
1309 1331
1310 namespace { 1332 namespace {
1311 1333
1312 // Invoked from the nested message loop. 1334 // Invoked from the nested message loop.
1313 void DragAllToSeparateWindowStep2(DetachToBrowserTabDragControllerTest* test, 1335 void DragAllToSeparateWindowStep2(DetachToBrowserTabDragControllerTest* test,
1314 TabStrip* attached_tab_strip, 1336 TabStrip* attached_tab_strip,
1315 TabStrip* target_tab_strip, 1337 TabStrip* target_tab_strip,
1316 const BrowserList* browser_list) { 1338 const BrowserList* browser_list) {
1317 ASSERT_TRUE(attached_tab_strip->IsDragSessionActive()); 1339 ASSERT_TRUE(attached_tab_strip->IsDragSessionActive());
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 1595
1574 namespace { 1596 namespace {
1575 1597
1576 // Invoked from the nested message loop. 1598 // Invoked from the nested message loop.
1577 void CancelOnNewTabWhenDraggingStep2( 1599 void CancelOnNewTabWhenDraggingStep2(
1578 DetachToBrowserTabDragControllerTest* test, 1600 DetachToBrowserTabDragControllerTest* test,
1579 const BrowserList* browser_list) { 1601 const BrowserList* browser_list) {
1580 ASSERT_TRUE(TabDragController::IsActive()); 1602 ASSERT_TRUE(TabDragController::IsActive());
1581 ASSERT_EQ(2u, browser_list->size()); 1603 ASSERT_EQ(2u, browser_list->size());
1582 1604
1583 // Add another tab. This should trigger exiting the nested loop. Add at the
1584 // to exercise past crash when model/tabstrip got out of sync (474082).
1585 content::WindowedNotificationObserver observer(
1586 content::NOTIFICATION_LOAD_STOP,
1587 content::NotificationService::AllSources());
1588 chrome::AddTabAt(browser_list->GetLastActive(), GURL(url::kAboutBlankURL), 1605 chrome::AddTabAt(browser_list->GetLastActive(), GURL(url::kAboutBlankURL),
1589 0, false); 1606 0, false);
1590 observer.Wait();
1591 } 1607 }
1592 1608
1593 } // namespace 1609 } // namespace
1594 1610
1595 #if defined(OS_CHROMEOS) || defined(OS_LINUX) 1611 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
1596 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 1612 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1597 // compositor. crbug.com/331924 1613 // compositor. crbug.com/331924
1598 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging 1614 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging
1599 #else 1615 #else
1600 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging 1616 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging
1601 #endif 1617 #endif
1602 // Adds another tab, detaches into separate window, adds another tab and 1618 // Adds another tab, detaches into separate window, adds another tab and
1603 // verifies the run loop ends. 1619 // verifies the run loop ends.
1604 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 1620 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
1605 MAYBE_CancelOnNewTabWhenDragging) { 1621 MAYBE_CancelOnNewTabWhenDragging) {
1606 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1622 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1607 1623
1608 // Add another tab to browser(). 1624 // Add another tab to browser().
1609 AddTabAndResetBrowser(browser()); 1625 AddTabAndResetBrowser(browser());
1610 1626
1611 // Move to the first tab and drag it enough so that it detaches. 1627 // Move to the first tab and drag it enough so that it detaches.
1612 gfx::Point tab_0_center( 1628 gfx::Point tab_0_center(
1613 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1629 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1614 ASSERT_TRUE(PressInput(tab_0_center)); 1630 ASSERT_TRUE(PressInput(tab_0_center));
1631
1632 // Add another tab. This should trigger exiting the nested loop. Add at the
1633 // beginning to exercise past crash when model/tabstrip got out of sync.
1634 // crbug.com/474082
1635 content::WindowedNotificationObserver observer(
1636 content::NOTIFICATION_LOAD_STOP,
1637 content::NotificationService::AllSources());
1615 ASSERT_TRUE(DragInputToNotifyWhenDone( 1638 ASSERT_TRUE(DragInputToNotifyWhenDone(
1616 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 1639 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
1617 base::Bind(&CancelOnNewTabWhenDraggingStep2, this, browser_list))); 1640 base::Bind(&CancelOnNewTabWhenDraggingStep2, this, browser_list)));
1618 QuitWhenNotDragging(); 1641 observer.Wait();
1619 1642
1620 // Should be two windows and not dragging. 1643 // Should be two windows and not dragging.
1644 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1621 ASSERT_FALSE(TabDragController::IsActive()); 1645 ASSERT_FALSE(TabDragController::IsActive());
1622 ASSERT_EQ(2u, browser_list->size()); 1646 ASSERT_EQ(2u, browser_list->size());
1623 for (auto* browser : *BrowserList::GetInstance()) { 1647 for (auto* browser : *BrowserList::GetInstance()) {
1624 EXPECT_FALSE(GetIsDragged(browser)); 1648 EXPECT_FALSE(GetIsDragged(browser));
1625 // Should not be maximized 1649 // Should not be maximized
1626 EXPECT_FALSE(browser->window()->IsMaximized()); 1650 EXPECT_FALSE(browser->window()->IsMaximized());
1627 } 1651 }
1628 } 1652 }
1629 1653
1630 #if defined(OS_CHROMEOS) 1654 #if defined(OS_CHROMEOS)
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 ui_controls::DOWN); 2218 ui_controls::DOWN);
2195 } 2219 }
2196 2220
2197 bool DragTabAndExecuteTaskWhenDone(const gfx::Point& position, 2221 bool DragTabAndExecuteTaskWhenDone(const gfx::Point& position,
2198 const base::Closure& task) { 2222 const base::Closure& task) {
2199 return ui_controls::SendMouseMoveNotifyWhenDone( 2223 return ui_controls::SendMouseMoveNotifyWhenDone(
2200 position.x(), position.y(), task); 2224 position.x(), position.y(), task);
2201 } 2225 }
2202 2226
2203 void QuitWhenNotDragging() { 2227 void QuitWhenNotDragging() {
2228 DCHECK(TabDragController::IsActive());
2204 test::QuitWhenNotDraggingImpl(); 2229 test::QuitWhenNotDraggingImpl();
2205 base::MessageLoop::current()->Run(); 2230 base::MessageLoop::current()->Run();
2206 } 2231 }
2207 2232
2208 private: 2233 private:
2209 DISALLOW_COPY_AND_ASSIGN( 2234 DISALLOW_COPY_AND_ASSIGN(
2210 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest); 2235 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest);
2211 }; 2236 };
2212 2237
2213 // Invoked from the nested message loop. 2238 // Invoked from the nested message loop.
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 DetachToBrowserTabDragControllerTest, 2496 DetachToBrowserTabDragControllerTest,
2472 ::testing::Values("mouse", "touch")); 2497 ::testing::Values("mouse", "touch"));
2473 INSTANTIATE_TEST_CASE_P(TabDragging, 2498 INSTANTIATE_TEST_CASE_P(TabDragging,
2474 DetachToBrowserTabDragControllerTestTouch, 2499 DetachToBrowserTabDragControllerTestTouch,
2475 ::testing::Values("touch")); 2500 ::testing::Values("touch"));
2476 #else 2501 #else
2477 INSTANTIATE_TEST_CASE_P(TabDragging, 2502 INSTANTIATE_TEST_CASE_P(TabDragging,
2478 DetachToBrowserTabDragControllerTest, 2503 DetachToBrowserTabDragControllerTest,
2479 ::testing::Values("mouse")); 2504 ::testing::Values("mouse"));
2480 #endif 2505 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/window_finder_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698