Commit f4085374 authored by jonross@chromium.org's avatar jonross@chromium.org

Enable Tab Dragging Tests with Linux and Ash

Enable a Shell for tests that exist in Linux with Ash.

TEST=TabDragControllerInteractiveUiTest
BUG=330429

Review URL: https://codereview.chromium.org/301613002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274311 0039d316-1c4b-4281-b951-d872f2087c98
parent cf178fb7
......@@ -4,6 +4,8 @@
#include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h"
#include <algorithm>
#include "ash/wm/window_state.h"
#include "base/bind.h"
#include "base/callback.h"
......@@ -46,7 +48,6 @@
#include "ash/shell.h"
#include "ash/test/cursor_manager_test_api.h"
#include "ash/wm/coordinate_conversion.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "ui/aura/client/screen_position_client.h"
......@@ -332,7 +333,6 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest, GestureEndShouldEndDragTest) {
ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0);
tab_strip->MaybeStartDrag(tab1, gesture_begin,
tab_strip->GetSelectionModel());
//tab_strip->tab_at(1)->OnGestureEvent(&gesture_begin);
EXPECT_TRUE(TabDragController::IsActive());
ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(),
......@@ -352,7 +352,7 @@ class DetachToBrowserTabDragControllerTest
DetachToBrowserTabDragControllerTest() {}
virtual void SetUpOnMainThread() OVERRIDE {
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_.reset(new aura::test::EventGenerator(
ash::Shell::GetPrimaryRootWindow()));
#endif
......@@ -367,7 +367,7 @@ class DetachToBrowserTabDragControllerTest
void SetEventGeneratorRootWindow(const gfx::Point& point) {
if (input_source() == INPUT_SOURCE_MOUSE)
return;
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_.reset(new aura::test::EventGenerator(
new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point))));
#endif
......@@ -381,7 +381,7 @@ class DetachToBrowserTabDragControllerTest
ui_test_utils::SendMouseEventsSync(
ui_controls::LEFT, ui_controls::DOWN);
}
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_->set_current_location(location);
event_generator_->PressTouch();
#else
......@@ -393,7 +393,7 @@ class DetachToBrowserTabDragControllerTest
bool PressInput2() {
// Second touch input is only used for touch sequence tests.
EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source());
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_->set_current_location(
event_generator_->current_location());
event_generator_->PressTouchId(1);
......@@ -406,7 +406,7 @@ class DetachToBrowserTabDragControllerTest
bool DragInputTo(const gfx::Point& location) {
if (input_source() == INPUT_SOURCE_MOUSE)
return ui_test_utils::SendMouseMoveSync(location);
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_->MoveTouch(location);
#else
NOTREACHED();
......@@ -417,7 +417,7 @@ class DetachToBrowserTabDragControllerTest
bool DragInputToAsync(const gfx::Point& location) {
if (input_source() == INPUT_SOURCE_MOUSE)
return ui_controls::SendMouseMove(location.x(), location.y());
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_->MoveTouch(location);
#else
NOTREACHED();
......@@ -430,7 +430,7 @@ class DetachToBrowserTabDragControllerTest
const base::Closure& task) {
if (input_source() == INPUT_SOURCE_MOUSE)
return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
base::MessageLoop::current()->PostTask(FROM_HERE, task);
event_generator_->MoveTouch(gfx::Point(x, y));
#else
......@@ -445,7 +445,7 @@ class DetachToBrowserTabDragControllerTest
base::TimeDelta delay) {
if (input_source() == INPUT_SOURCE_MOUSE)
return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay);
event_generator_->MoveTouch(gfx::Point(x, y));
#else
......@@ -459,7 +459,7 @@ class DetachToBrowserTabDragControllerTest
const base::Closure& task) {
if (input_source() == INPUT_SOURCE_MOUSE)
return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
base::MessageLoop::current()->PostTask(FROM_HERE, task);
event_generator_->MoveTouchId(gfx::Point(x, y), 1);
#else
......@@ -473,7 +473,7 @@ class DetachToBrowserTabDragControllerTest
return ui_test_utils::SendMouseEventsSync(
ui_controls::LEFT, ui_controls::UP);
}
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_->ReleaseTouch();
#else
NOTREACHED();
......@@ -486,7 +486,7 @@ class DetachToBrowserTabDragControllerTest
return ui_test_utils::SendMouseEventsSync(
ui_controls::LEFT, ui_controls::UP);
}
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
event_generator_->ReleaseTouchId(1);
#else
NOTREACHED();
......@@ -521,7 +521,7 @@ class DetachToBrowserTabDragControllerTest
Browser* browser() const { return InProcessBrowserTest::browser(); }
private:
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
scoped_ptr<aura::test::EventGenerator> event_generator_;
#endif
......@@ -636,7 +636,7 @@ void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) {
ASSERT_TRUE(test->ReleaseInput());
}
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
bool IsWindowPositionManaged(aura::Window* window) {
return ash::wm::GetWindowState(window)->window_position_managed();
}
......@@ -903,7 +903,7 @@ void DeleteSourceDetachedStep2(WebContents* tab,
} // namespace
#if defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached
......@@ -953,7 +953,7 @@ void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) {
} // namespace
#if defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached
......@@ -1326,7 +1326,7 @@ void CancelOnNewTabWhenDraggingStep2(
} // namespace
#if defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging
......@@ -1361,8 +1361,9 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
}
}
#if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash)
#if defined(OS_CHROMEOS)
// TODO(sky,sad): A number of tests below are disabled as they fail due to
// resize locks with a real compositor. crbug.com/331924
namespace {
void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test,
......@@ -1389,16 +1390,9 @@ void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test,
} // namespace
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragInMaximizedWindow DISABLED_DragInMaximizedWindow
#else
#define MAYBE_DragInMaximizedWindow DragInMaximizedWindow
#endif
// Creates a browser with two tabs, maximizes it, drags the tab out.
IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
MAYBE_DragInMaximizedWindow) {
DISABLED_DragInMaximizedWindow) {
AddTabAndResetBrowser(browser());
browser()->window()->Maximize();
......@@ -1482,18 +1476,9 @@ void DragSingleTabToSeparateWindowInSecondDisplayStep2(
} // namespace
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \
DISABLED_DragSingleTabToSeparateWindowInSecondDisplay
#else
#define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \
DragSingleTabToSeparateWindowInSecondDisplay
#endif
// Drags from browser to a second display and releases input.
IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
MAYBE_DragSingleTabToSeparateWindowInSecondDisplay) {
DISABLED_DragSingleTabToSeparateWindowInSecondDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -1564,17 +1549,9 @@ void DragTabToWindowInSeparateDisplayStep2(
} // namespace
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragTabToWindowInSeparateDisplay \
DISABLED_DragTabToWindowInSeparateDisplay
#else
#define MAYBE_DragTabToWindowInSeparateDisplay DragTabToWindowInSeparateDisplay
#endif
// Drags from browser to another browser on a second display and releases input.
IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
MAYBE_DragTabToWindowInSeparateDisplay) {
DISABLED_DragTabToWindowInSeparateDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -1622,17 +1599,9 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
EXPECT_FALSE(browser2->window()->IsMaximized());
}
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragTabToWindowOnSecondDisplay \
DISABLED_DragTabToWindowOnSecondDisplay
#else
#define MAYBE_DragTabToWindowOnSecondDisplay DragTabToWindowOnSecondDisplay
#endif
// Drags from browser to another browser on a second display and releases input.
IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
MAYBE_DragTabToWindowOnSecondDisplay) {
DISABLED_DragTabToWindowOnSecondDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -1692,19 +1661,10 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
EXPECT_FALSE(browser2->window()->IsMaximized());
}
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay \
DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay
#else
#define MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay \
DragMaxTabToNonMaxWindowInSeparateDisplay
#endif
// Drags from a maximized browser to another non-maximized browser on a second
// display and releases input.
IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay) {
DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
browser()->window()->Maximize();
......@@ -1717,7 +1677,7 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
aura::Window* second_root = roots[1];
gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
second_root).work_area();
work_area.Inset(20,20,20,60);
work_area.Inset(20, 20, 20, 60);
Browser::CreateParams params(browser()->profile(),
browser()->host_desktop_type());
params.initial_show_state = ui::SHOW_STATE_NORMAL;
......@@ -1768,17 +1728,10 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
EXPECT_FALSE(browser2->window()->IsMaximized());
}
// Immersive fullscreen is Ash only. However, Windows Ash does not support
// multiple displays.
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay \
DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay
// Drags from a restored browser to an immersive fullscreen browser on a
// second display and releases input.
IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay) {
DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -1851,7 +1804,6 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
EXPECT_FALSE(immersive_controller2->IsRevealed());
EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
}
#endif // OS_CHROMEOS
// Subclass of DetachToBrowserTabDragControllerTest that
// creates multiple displays with different device scale factors.
......@@ -1931,17 +1883,10 @@ void CursorDeviceScaleFactorStep(
} // namespace
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_CursorDeviceScaleFactor DISABLED_CursorDeviceScaleFactor
#else
#define MAYBE_CursorDeviceScaleFactor CursorDeviceScaleFactor
#endif
// Verifies cursor's device scale factor is updated when a tab is moved across
// displays with different device scale factors (http://crbug.com/154183).
IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest,
MAYBE_CursorDeviceScaleFactor) {
DISABLED_CursorDeviceScaleFactor) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -2032,19 +1977,10 @@ void CancelDragTabToWindowInSeparateDisplayStep2(
} // namespace
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_CancelDragTabToWindowIn2ndDisplay \
DISABLED_CancelDragTabToWindowIn2ndDisplay
#else
#define MAYBE_CancelDragTabToWindowIn2ndDisplay \
CancelDragTabToWindowIn2ndDisplay
#endif
// Drags from browser to a second display and releases input.
IN_PROC_BROWSER_TEST_F(
DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
MAYBE_CancelDragTabToWindowIn2ndDisplay) {
DISABLED_CancelDragTabToWindowIn2ndDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -2079,19 +2015,10 @@ IN_PROC_BROWSER_TEST_F(
ui_controls::LEFT, ui_controls::UP));
}
#if defined(OS_CHROMEOS) || defined(OS_LINUX)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_CancelDragTabToWindowIn1stDisplay \
DISABLED_CancelDragTabToWindowIn1stDisplay
#else
#define MAYBE_CancelDragTabToWindowIn1stDisplay \
CancelDragTabToWindowIn1stDisplay
#endif
// Drags from browser from a second display to primary and releases input.
IN_PROC_BROWSER_TEST_F(
DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
MAYBE_CancelDragTabToWindowIn1stDisplay) {
DISABLED_CancelDragTabToWindowIn1stDisplay) {
aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
ASSERT_EQ(2u, roots.size());
......@@ -2147,16 +2074,9 @@ void PressSecondFingerWhileDetachedStep2(
} // namespace
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_PressSecondFingerWhileDetached DISABLED_PressSecondFingerWhileDetached
#else
#define MAYBE_PressSecondFingerWhileDetached PressSecondFingerWhileDetached
#endif
// Detaches a tab and while detached presses a second finger.
IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch,
MAYBE_PressSecondFingerWhileDetached) {
DISABLED_PressSecondFingerWhileDetached) {
gfx::Rect bounds(browser()->window()->GetBounds());
// Add another tab.
AddTabAndResetBrowser(browser());
......@@ -2209,18 +2129,9 @@ void DetachToDockedWindowNextStep(
} // namespace
#if defined(OS_CHROMEOS)
// TODO(sky,sad): Disabled as it fails due to resize locks with a real
// compositor. crbug.com/331924
#define MAYBE_DetachToDockedWindowFromMaximizedWindow \
DISABLED_DetachToDockedWindowFromMaximizedWindow
#else
#define MAYBE_DetachToDockedWindowFromMaximizedWindow \
DetachToDockedWindowFromMaximizedWindow
#endif
// Drags from browser to separate window, docks that window and releases mouse.
IN_PROC_BROWSER_TEST_F(DetachToBrowserTabDragControllerTest,
MAYBE_DetachToDockedWindowFromMaximizedWindow) {
IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
DISABLED_DetachToDockedWindowFromMaximizedWindow) {
// Maximize the initial browser window.
browser()->window()->Maximize();
ASSERT_TRUE(browser()->window()->IsMaximized());
......@@ -2294,7 +2205,7 @@ INSTANTIATE_TEST_CASE_P(TabDragging,
INSTANTIATE_TEST_CASE_P(TabDragging,
DetachToBrowserTabDragControllerTestTouch,
::testing::Values("touch"));
#elif defined(USE_ASH) && !defined(OS_LINUX) // TODO(linux_ash)
#elif defined(USE_ASH)
INSTANTIATE_TEST_CASE_P(TabDragging,
DetachToBrowserTabDragControllerTest,
::testing::Values("mouse"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment