Commit 171e2ebe authored by weidongg's avatar weidongg Committed by Commit bot

Fix an interactive ui test

* Remove touch drag for a series of tests about tab dragging to the second display as, up to now, there's no use case.

* Each display has its own UI controller in the test, but, in ozone build, they do not share the state of mouse (down, up). When the mouse is moved to the second display, the UI controller for it does know that the mouse is down in first display. That's why the tab cannot be dragged to the second display only in ozone build. Simple solution is to move the mouse state variable outside of UI controller class.

BUG=626769

Review-Url: https://codereview.chromium.org/2836073003
Cr-Commit-Position: refs/heads/master@{#468048}
parent 85666c1b
......@@ -1794,7 +1794,7 @@ void DragSingleTabToSeparateWindowInSecondDisplayStep2(
// Drags from browser to a second display and releases input.
IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
DISABLED_DragSingleTabToSeparateWindowInSecondDisplay) {
DragSingleTabToSeparateWindowInSecondDisplay) {
// Add another tab.
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
......@@ -1822,16 +1822,12 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
ASSERT_FALSE(tab_strip2->IsDragSessionActive());
// This other browser should be on the second screen (with mouse drag)
// With the touch input the browser cannot be dragged from one screen
// to another and the window stays on the first screen.
if (input_source() == INPUT_SOURCE_MOUSE) {
aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
ASSERT_EQ(2u, roots.size());
aura::Window* second_root = roots[1];
EXPECT_EQ(second_root,
new_browser->window()->GetNativeWindow()->GetRootWindow());
}
// This other browser should be on the second screen with mouse drag.
aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
ASSERT_EQ(2u, roots.size());
aura::Window* second_root = roots[1];
EXPECT_EQ(second_root,
new_browser->window()->GetNativeWindow()->GetRootWindow());
EXPECT_EQ("0", IDString(new_browser->tab_strip_model()));
EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
......@@ -2453,9 +2449,11 @@ IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch,
#endif // OS_CHROMEOS
#if defined(USE_ASH)
// There are no use case for touch drag to move across displays right now.
// Removes touch input here until we have that case.
INSTANTIATE_TEST_CASE_P(TabDragging,
DetachToBrowserInSeparateDisplayTabDragControllerTest,
::testing::Values("mouse", "touch"));
::testing::Values("mouse"));
INSTANTIATE_TEST_CASE_P(TabDragging,
DifferentDeviceScaleFactorDisplayTabDragControllerTest,
::testing::Values("mouse"));
......
......@@ -21,6 +21,9 @@ namespace aura {
namespace test {
namespace {
// Mask of the mouse buttons currently down.
unsigned g_button_down_mask = 0;
class UIControlsOzone : public ui_controls::UIControlsAura {
public:
UIControlsOzone(WindowTreeHost* host) : host_(host) {}
......@@ -42,7 +45,7 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
bool alt,
bool command,
const base::Closure& closure) override {
int flags = button_down_mask_;
int flags = g_button_down_mask;
if (control) {
flags |= ui::EF_CONTROL_DOWN;
......@@ -111,12 +114,12 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
ui::EventType event_type;
if (button_down_mask_)
if (g_button_down_mask)
event_type = ui::ET_MOUSE_DRAGGED;
else
event_type = ui::ET_MOUSE_MOVED;
PostMouseEvent(event_type, host_location, button_down_mask_, 0);
PostMouseEvent(event_type, host_location, g_button_down_mask, 0);
RunClosureAfterAllPendingUIEvents(closure);
return true;
......@@ -157,14 +160,14 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
}
if (state & ui_controls::DOWN) {
button_down_mask_ |= flag;
g_button_down_mask |= flag;
PostMouseEvent(ui::ET_MOUSE_PRESSED, host_location,
button_down_mask_ | flag, flag);
g_button_down_mask | flag, flag);
}
if (state & ui_controls::UP) {
button_down_mask_ &= ~flag;
g_button_down_mask &= ~flag;
PostMouseEvent(ui::ET_MOUSE_RELEASED, host_location,
button_down_mask_ | flag, flag);
g_button_down_mask | flag, flag);
}
RunClosureAfterAllPendingUIEvents(closure);
......@@ -229,9 +232,6 @@ class UIControlsOzone : public ui_controls::UIControlsAura {
WindowTreeHost* host_;
// Mask of the mouse buttons currently down.
unsigned button_down_mask_ = 0;
DISALLOW_COPY_AND_ASSIGN(UIControlsOzone);
};
......
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