summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/chrome_tests.gypi3
-rw-r--r--chrome/test/base/view_event_test_base.cc2
-rw-r--r--ui/aura/test/ui_controls_factory_aurax11.cc31
-rw-r--r--ui/views/test/ui_controls_factory_desktop_aurax11.cc41
4 files changed, 49 insertions, 28 deletions
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index fb4c8bc..fc8d852 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -339,9 +339,6 @@
'browser/ui/omnibox/omnibox_view_browsertest.cc',
'browser/extensions/api/tabs/tabs_interactive_test.cc',
'browser/ui/views/keyboard_access_browsertest.cc',
- # TODO(port): These tests crash in
- # UIControlsDesktopX11::SendMouseEvents().
- #'browser/ui/views/omnibox/omnibox_view_views_browsertest.cc',
],
}],
['use_ash==1', {
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc
index a4f7af0..8f51ef7 100644
--- a/chrome/test/base/view_event_test_base.cc
+++ b/chrome/test/base/view_event_test_base.cc
@@ -30,6 +30,7 @@
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/aura_test_helper.h"
+#include "ui/aura/window_tree_host.h"
#include "ui/views/corewm/wm_state.h"
#endif
@@ -126,6 +127,7 @@ void ViewEventTestBase::SetUp() {
shell_delegate->test_session_state_delegate()
->SetActiveUserSessionStarted(true);
context = ash::Shell::GetPrimaryRootWindow();
+ context->GetDispatcher()->host()->Show();
#endif // !OS_WIN
aura::Env::CreateInstance();
#elif defined(USE_AURA)
diff --git a/ui/aura/test/ui_controls_factory_aurax11.cc b/ui/aura/test/ui_controls_factory_aurax11.cc
index dffea4a..d505e36 100644
--- a/ui/aura/test/ui_controls_factory_aurax11.cc
+++ b/ui/aura/test/ui_controls_factory_aurax11.cc
@@ -141,23 +141,32 @@ class UIControlsX11 : public UIControlsAura {
long screen_x,
long screen_y,
const base::Closure& closure) OVERRIDE {
- gfx::Point root_point(screen_x, screen_y);
+ gfx::Point root_location(screen_x, screen_y);
aura::client::ScreenPositionClient* screen_position_client =
aura::client::GetScreenPositionClient(root_window_->window());
if (screen_position_client) {
screen_position_client->ConvertPointFromScreen(root_window_->window(),
- &root_point);
+ &root_location);
}
+ gfx::Point root_current_location;
+ root_window_->host()->QueryMouseLocation(&root_current_location);
+ root_window_->host()->ConvertPointFromHost(&root_current_location);
- XEvent xevent = {0};
- XMotionEvent* xmotion = &xevent.xmotion;
- xmotion->type = MotionNotify;
- xmotion->x = root_point.x();
- xmotion->y = root_point.y();
- xmotion->state = button_down_mask;
- xmotion->same_screen = True;
- // RootWindow will take care of other necessary fields.
- root_window_->host()->PostNativeEvent(&xevent);
+ if (root_location != root_current_location && button_down_mask == 0) {
+ // Move the cursor because EnterNotify/LeaveNotify are generated with the
+ // current mouse position as a result of XGrabPointer()
+ root_window_->window()->MoveCursorTo(root_location);
+ } else {
+ XEvent xevent = {0};
+ XMotionEvent* xmotion = &xevent.xmotion;
+ xmotion->type = MotionNotify;
+ xmotion->x = root_location.x();
+ xmotion->y = root_location.y();
+ xmotion->state = button_down_mask;
+ xmotion->same_screen = True;
+ // RootWindow will take care of other necessary fields.
+ root_window_->host()->PostNativeEvent(&xevent);
+ }
RunClosureAfterAllPendingUIEvents(closure);
return true;
}
diff --git a/ui/views/test/ui_controls_factory_desktop_aurax11.cc b/ui/views/test/ui_controls_factory_desktop_aurax11.cc
index db6ff96..23a7922 100644
--- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc
+++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc
@@ -165,24 +165,37 @@ class UIControlsDesktopX11 : public UIControlsAura {
long screen_x,
long screen_y,
const base::Closure& closure) OVERRIDE {
- gfx::Point screen_point(screen_x, screen_y);
- gfx::Point root_point = screen_point;
- aura::Window* root_window = RootWindowForPoint(screen_point);
+ gfx::Point screen_location(screen_x, screen_y);
+ gfx::Point root_location = screen_location;
+ aura::Window* root_window = RootWindowForPoint(screen_location);
aura::client::ScreenPositionClient* screen_position_client =
aura::client::GetScreenPositionClient(root_window);
- if (screen_position_client)
- screen_position_client->ConvertPointFromScreen(root_window, &root_point);
+ if (screen_position_client) {
+ screen_position_client->ConvertPointFromScreen(root_window,
+ &root_location);
+ }
- XEvent xevent = {0};
- XMotionEvent* xmotion = &xevent.xmotion;
- xmotion->type = MotionNotify;
- xmotion->x = root_point.x();
- xmotion->y = root_point.y();
- xmotion->state = button_down_mask;
- xmotion->same_screen = True;
- // RootWindow will take care of other necessary fields.
- root_window->GetDispatcher()->host()->PostNativeEvent(&xevent);
+ aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher();
+ gfx::Point root_current_location;
+ dispatcher->host()->QueryMouseLocation(&root_current_location);
+ dispatcher->host()->ConvertPointFromHost(&root_current_location);
+
+ if (root_location != root_current_location && button_down_mask == 0) {
+ // Move the cursor because EnterNotify/LeaveNotify are generated with the
+ // current mouse position as a result of XGrabPointer()
+ root_window->MoveCursorTo(root_location);
+ } else {
+ XEvent xevent = {0};
+ XMotionEvent* xmotion = &xevent.xmotion;
+ xmotion->type = MotionNotify;
+ xmotion->x = root_location.x();
+ xmotion->y = root_location.y();
+ xmotion->state = button_down_mask;
+ xmotion->same_screen = True;
+ // RootWindow will take care of other necessary fields.
+ dispatcher->host()->PostNativeEvent(&xevent);
+ }
RunClosureAfterAllPendingUIEvents(closure);
return true;
}