Chromium Code Reviews| Index: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc |
| diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc |
| index bec924f538d65571b25309b3b421de2a538ab6e6..0b04ef0b789637c7e58bd441b93f55437616e08c 100644 |
| --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc |
| +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc |
| @@ -17,6 +17,7 @@ |
| #include "base/strings/string_number_conversions.h" |
| #include "build/build_config.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| +#include "chrome/browser/platform_util.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_commands.h" |
| #include "chrome/browser/ui/browser_list.h" |
| @@ -185,7 +186,8 @@ Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { |
| // Resize the two windows so they're right next to each other. |
| gfx::Rect work_area = |
| display::Screen::GetScreen() |
| - ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) |
| + ->GetDisplayNearestWindow(platform_util::GetViewForWindow( |
| + browser()->window()->GetNativeWindow())) |
| .work_area(); |
| gfx::Size half_size = |
| gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); |
| @@ -253,7 +255,7 @@ class ScreenEventGeneratorDelegate |
| #endif |
| -#if !defined(OS_CHROMEOS) |
| +#if !defined(OS_CHROMEOS) && defined(USE_AURA) |
| // Following classes verify a crash scenario. Specifically on Windows when focus |
| // changes it can trigger capture being lost. This was causing a crash in tab |
| @@ -376,6 +378,12 @@ class DetachToBrowserTabDragControllerTest |
| event_generator_.reset( |
| new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow())); |
| #endif |
| +#if defined(OS_MACOSX) |
| + // Currently MacViews' browser windows are shown in the background and could |
| + // be obscured by other windows if there are any. This should be fixed in |
| + // order to be consistent with other platforms. |
| + EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| +#endif // OS_MACOSX |
| } |
| InputSource input_source() const { |
| @@ -853,9 +861,11 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); |
| } |
| -#if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| +#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) |
| // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| // compositor. crbug.com/331924 |
| +// TODO(tapted,mblsha): Disabled as the Mac IsMaximized() behavior is not |
| +// consistent with other platforms. crbug.com/603562 |
| #define MAYBE_DetachFromFullsizeWindow DISABLED_DetachFromFullsizeWindow |
| #else |
| #define MAYBE_DetachFromFullsizeWindow DetachFromFullsizeWindow |
| @@ -867,7 +877,8 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| // Resize the browser window so that it is as big as the work area. |
| gfx::Rect work_area = |
| display::Screen::GetScreen() |
| - ->GetDisplayNearestWindow(browser()->window()->GetNativeWindow()) |
| + ->GetDisplayNearestWindow(platform_util::GetViewForWindow( |
| + browser()->window()->GetNativeWindow())) |
| .work_area(); |
| browser()->window()->SetBounds(work_area); |
| const gfx::Rect initial_bounds(browser()->window()->GetBounds()); |
| @@ -921,9 +932,11 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); |
| } |
| -#if defined(OS_CHROMEOS) || defined(OS_LINUX) |
| +#if defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) |
| // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
| // compositor. crbug.com/331924 |
| +// TODO(tapted,mblsha): Disabled as the Mac IsMaximized() behavior is not |
| +// consistent with other platforms. crbug.com/603562 |
| #define MAYBE_DetachToOwnWindowFromMaximizedWindow \ |
| DISABLED_DetachToOwnWindowFromMaximizedWindow |
| #else |
| @@ -1283,6 +1296,7 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, MAYBE_DragAll) { |
| TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
| browser()->tab_strip_model()->AddTabAtToSelection(0); |
| browser()->tab_strip_model()->AddTabAtToSelection(1); |
| + const gfx::Rect initial_bounds = browser()->window()->GetBounds(); |
| // Move to the first tab and drag it enough so that it would normally |
| // detach. |
| @@ -1306,6 +1320,14 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, MAYBE_DragAll) { |
| // Remaining browser window should not be maximized |
| EXPECT_FALSE(browser()->window()->IsMaximized()); |
| + |
| + const gfx::Rect final_bounds = browser()->window()->GetBounds(); |
| + // Size unchanged, but it should have moved down. |
| + EXPECT_EQ(initial_bounds.size(), final_bounds.size()); |
| + EXPECT_EQ(initial_bounds.origin().x(), final_bounds.origin().x()); |
| + // FIXME(mblsha): Fails on MacViews because of crbug.com/518740 |
|
sky
2016/06/17 15:15:17
FIXME->TODO
themblsha
2016/06/17 15:26:39
Done.
|
| + // EXPECT_EQ(initial_bounds.origin().y() + GetDetachY(tab_strip), |
| + // final_bounds.origin().y()); |
| } |
| namespace { |
| @@ -1581,14 +1603,8 @@ void CancelOnNewTabWhenDraggingStep2( |
| ASSERT_TRUE(TabDragController::IsActive()); |
| ASSERT_EQ(2u, browser_list->size()); |
| - // Add another tab. This should trigger exiting the nested loop. Add at the |
| - // to exercise past crash when model/tabstrip got out of sync (474082). |
| - content::WindowedNotificationObserver observer( |
| - content::NOTIFICATION_LOAD_STOP, |
| - content::NotificationService::AllSources()); |
| chrome::AddTabAt(browser_list->GetLastActive(), GURL(url::kAboutBlankURL), |
| 0, false); |
| - observer.Wait(); |
| } |
| } // namespace |
| @@ -1613,12 +1629,20 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
| gfx::Point tab_0_center( |
| GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
| ASSERT_TRUE(PressInput(tab_0_center)); |
| + |
| + // Add another tab. This should trigger exiting the nested loop. Add at the |
| + // beginning to exercise past crash when model/tabstrip got out of sync. |
| + // crbug.com/474082 |
| + content::WindowedNotificationObserver observer( |
| + content::NOTIFICATION_LOAD_STOP, |
| + content::NotificationService::AllSources()); |
| ASSERT_TRUE(DragInputToNotifyWhenDone( |
| tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
| base::Bind(&CancelOnNewTabWhenDraggingStep2, this, browser_list))); |
| - QuitWhenNotDragging(); |
| + observer.Wait(); |
| // Should be two windows and not dragging. |
| + ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
| ASSERT_FALSE(TabDragController::IsActive()); |
| ASSERT_EQ(2u, browser_list->size()); |
| for (auto* browser : *BrowserList::GetInstance()) { |
| @@ -2202,6 +2226,7 @@ class DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest |
| } |
| void QuitWhenNotDragging() { |
| + DCHECK(TabDragController::IsActive()); |
| test::QuitWhenNotDraggingImpl(); |
| base::MessageLoop::current()->Run(); |
| } |