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