Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / views / test / ui_controls_factory_desktop_aurax11.cc
index a7982bf..7e52286 100644 (file)
@@ -16,6 +16,7 @@
 #include "ui/aura/env.h"
 #include "ui/aura/test/aura_test_utils.h"
 #include "ui/aura/test/ui_controls_factory_aura.h"
+#include "ui/aura/test/x11_event_sender.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/base/test/ui_controls_aura.h"
 #include "ui/base/x/x11_util.h"
@@ -68,29 +69,26 @@ class UIControlsDesktopX11 : public UIControlsAura {
     XStoreName(x_display_, x_window_, "Chromium UIControlsDesktopX11 Window");
   }
 
-  virtual ~UIControlsDesktopX11() {
-    XDestroyWindow(x_display_, x_window_);
-  }
+  ~UIControlsDesktopX11() override { XDestroyWindow(x_display_, x_window_); }
 
-  virtual bool SendKeyPress(gfx::NativeWindow window,
-                            ui::KeyboardCode key,
-                            bool control,
-                            bool shift,
-                            bool alt,
-                            bool command) OVERRIDE {
+  bool SendKeyPress(gfx::NativeWindow window,
+                    ui::KeyboardCode key,
+                    bool control,
+                    bool shift,
+                    bool alt,
+                    bool command) override {
     DCHECK(!command);  // No command key on Aura
     return SendKeyPressNotifyWhenDone(
         window, key, control, shift, alt, command, base::Closure());
   }
 
-  virtual bool SendKeyPressNotifyWhenDone(
-      gfx::NativeWindow window,
-      ui::KeyboardCode key,
-      bool control,
-      bool shift,
-      bool alt,
-      bool command,
-      const base::Closure& closure) OVERRIDE {
+  bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
+                                  ui::KeyboardCode key,
+                                  bool control,
+                                  bool shift,
+                                  bool alt,
+                                  bool command,
+                                  const base::Closure& closure) override {
     DCHECK(!command);  // No command key on Aura
 
     aura::WindowTreeHost* host = window->GetHost();
@@ -107,11 +105,11 @@ class UIControlsDesktopX11 : public UIControlsAura {
     xevent.xkey.keycode =
         XKeysymToKeycode(x_display_,
                          ui::XKeysymForWindowsKeyCode(key, shift));
-    host->PostNativeEvent(&xevent);
+    aura::test::PostEventToWindowTreeHost(xevent, host);
 
     // Send key release events.
     xevent.xkey.type = KeyRelease;
-    host->PostNativeEvent(&xevent);
+    aura::test::PostEventToWindowTreeHost(xevent, host);
     if (alt)
       UnmaskAndSetKeycodeThenSend(host, &xevent, Mod1Mask, XK_Alt_L);
     if (shift)
@@ -124,13 +122,12 @@ class UIControlsDesktopX11 : public UIControlsAura {
     return true;
   }
 
-  virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE {
+  bool SendMouseMove(long screen_x, long screen_y) override {
     return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure());
   }
-  virtual bool SendMouseMoveNotifyWhenDone(
-      long screen_x,
-      long screen_y,
-      const base::Closure& closure) OVERRIDE {
+  bool SendMouseMoveNotifyWhenDone(long screen_x,
+                                   long screen_y,
+                                   const base::Closure& closure) override {
     gfx::Point screen_location(screen_x, screen_y);
     gfx::Point root_location = screen_location;
     aura::Window* root_window = RootWindowForPoint(screen_location);
@@ -160,18 +157,17 @@ class UIControlsDesktopX11 : public UIControlsAura {
       xmotion->state = button_down_mask;
       xmotion->same_screen = True;
       // RootWindow will take care of other necessary fields.
-      host->PostNativeEvent(&xevent);
+      aura::test::PostEventToWindowTreeHost(xevent, host);
     }
     RunClosureAfterAllPendingUIEvents(closure);
     return true;
   }
-  virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE {
+  bool SendMouseEvents(MouseButton type, int state) override {
     return SendMouseEventsNotifyWhenDone(type, state, base::Closure());
   }
-  virtual bool SendMouseEventsNotifyWhenDone(
-      MouseButton type,
-      int state,
-      const base::Closure& closure) OVERRIDE {
+  bool SendMouseEventsNotifyWhenDone(MouseButton type,
+                                     int state,
+                                     const base::Closure& closure) override {
     XEvent xevent = {0};
     XButtonEvent* xbutton = &xevent.xbutton;
     gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location();
@@ -200,22 +196,22 @@ class UIControlsDesktopX11 : public UIControlsAura {
     // RootWindow will take care of other necessary fields.
     if (state & DOWN) {
       xevent.xbutton.type = ButtonPress;
-      root_window->GetHost()->PostNativeEvent(&xevent);
+      aura::test::PostEventToWindowTreeHost(xevent, root_window->GetHost());
       button_down_mask |= xbutton->state;
     }
     if (state & UP) {
       xevent.xbutton.type = ButtonRelease;
-      root_window->GetHost()->PostNativeEvent(&xevent);
+      aura::test::PostEventToWindowTreeHost(xevent, root_window->GetHost());
       button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state;
     }
     RunClosureAfterAllPendingUIEvents(closure);
     return true;
   }
-  virtual bool SendMouseClick(MouseButton type) OVERRIDE {
+  bool SendMouseClick(MouseButton type) override {
     return SendMouseEvents(type, UP | DOWN);
   }
-  virtual void RunClosureAfterAllPendingUIEvents(
-      const base::Closure& closure) OVERRIDE {
+  void RunClosureAfterAllPendingUIEvents(
+      const base::Closure& closure) override {
     if (closure.is_null())
       return;
     static XEvent* marker_event = NULL;
@@ -256,7 +252,7 @@ class UIControlsDesktopX11 : public UIControlsAura {
                                  KeySym keysym,
                                  unsigned int mask) {
     xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym);
-    host->PostNativeEvent(xevent);
+    aura::test::PostEventToWindowTreeHost(*xevent, host);
     xevent->xkey.state |= mask;
   }
 
@@ -266,7 +262,7 @@ class UIControlsDesktopX11 : public UIControlsAura {
                                    KeySym keysym) {
     xevent->xkey.state ^= mask;
     xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym);
-    host->PostNativeEvent(xevent);
+    aura::test::PostEventToWindowTreeHost(*xevent, host);
   }
 
   // Our X11 state.