Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / ash / drag_drop / drag_drop_tracker_unittest.cc
index 1c485b3..24c5e89 100644 (file)
@@ -8,9 +8,9 @@
 #include "ash/shell_window_ids.h"
 #include "ash/test/ash_test_base.h"
 #include "base/memory/scoped_ptr.h"
-#include "ui/aura/root_window.h"
 #include "ui/aura/test/test_windows.h"
 #include "ui/aura/window.h"
+#include "ui/aura/window_event_dispatcher.h"
 
 namespace ash {
 namespace test {
@@ -19,7 +19,6 @@ class DragDropTrackerTest : public test::AshTestBase {
  public:
   virtual void SetUp() OVERRIDE {
     AshTestBase::SetUp();
-    UpdateDisplay("200x200,300x300");
   }
 
   aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
@@ -31,12 +30,12 @@ class DragDropTrackerTest : public test::AshTestBase {
   }
 
   static aura::Window* GetTarget(const gfx::Point& location) {
-    scoped_ptr<internal::DragDropTracker> tracker(
-        new internal::DragDropTracker(Shell::GetPrimaryRootWindow(),
-                                      NULL));
+    scoped_ptr<DragDropTracker> tracker(
+        new DragDropTracker(Shell::GetPrimaryRootWindow(), NULL));
     ui::MouseEvent e(ui::ET_MOUSE_DRAGGED,
                      location,
                      location,
+                     ui::EF_NONE,
                      ui::EF_NONE);
     aura::Window* target = tracker->GetTarget(e);
     return target;
@@ -44,24 +43,19 @@ class DragDropTrackerTest : public test::AshTestBase {
 
   static ui::LocatedEvent* ConvertEvent(aura::Window* target,
                                            const ui::MouseEvent& event) {
-    scoped_ptr<internal::DragDropTracker> tracker(
-        new internal::DragDropTracker(Shell::GetPrimaryRootWindow(),
-                                      NULL));
+    scoped_ptr<DragDropTracker> tracker(
+        new DragDropTracker(Shell::GetPrimaryRootWindow(), NULL));
     ui::LocatedEvent* converted = tracker->ConvertEvent(target, event);
     return converted;
   }
 };
 
-// TODO(mazda): Remove this once ash/wm/coordinate_conversion.h supports
-// non-X11 platforms.
-#if defined(USE_X11)
-#define MAYBE_GetTarget GetTarget
-#else
-#define MAYBE_GetTarget DISABLED_GetTarget
-#endif
+TEST_F(DragDropTrackerTest, GetTarget) {
+  if (!SupportsMultipleDisplays())
+    return;
 
-TEST_F(DragDropTrackerTest, MAYBE_GetTarget) {
-  Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+  UpdateDisplay("200x200,300x300");
+  aura::Window::Windows root_windows = Shell::GetAllRootWindows();
   EXPECT_EQ(2U, root_windows.size());
 
   scoped_ptr<aura::Window> window0(
@@ -119,16 +113,12 @@ TEST_F(DragDropTrackerTest, MAYBE_GetTarget) {
   EXPECT_NE(window1.get(), GetTarget(gfx::Point(50, 50)));
 }
 
-// TODO(mazda): Remove this once ash/wm/coordinate_conversion.h supports
-// non-X11 platforms.
-#if defined(USE_X11)
-#define MAYBE_ConvertEvent ConvertEvent
-#else
-#define MAYBE_ConvertEvent DISABLED_ConvertEvent
-#endif
+TEST_F(DragDropTrackerTest, ConvertEvent) {
+  if (!SupportsMultipleDisplays())
+    return;
 
-TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
-  Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+  UpdateDisplay("200x200,300x300");
+  aura::Window::Windows root_windows = Shell::GetAllRootWindows();
   EXPECT_EQ(2U, root_windows.size());
 
   scoped_ptr<aura::Window> window0(
@@ -147,6 +137,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
   ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED,
                             gfx::Point(50, 50),
                             gfx::Point(50, 50),
+                            ui::EF_NONE,
                             ui::EF_NONE);
   scoped_ptr<ui::LocatedEvent> converted00(ConvertEvent(window0.get(),
                                                         original00));
@@ -160,6 +151,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
   ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED,
                             gfx::Point(350, 150),
                             gfx::Point(350, 150),
+                            ui::EF_NONE,
                             ui::EF_NONE);
   scoped_ptr<ui::LocatedEvent> converted01(ConvertEvent(window1.get(),
                                                         original01));
@@ -176,6 +168,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
   ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED,
                             gfx::Point(-150, 50),
                             gfx::Point(-150, 50),
+                            ui::EF_NONE,
                             ui::EF_NONE);
   scoped_ptr<ui::LocatedEvent> converted10(ConvertEvent(window0.get(),
                                                         original10));
@@ -189,6 +182,7 @@ TEST_F(DragDropTrackerTest, MAYBE_ConvertEvent) {
   ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED,
                             gfx::Point(150, 150),
                             gfx::Point(150, 150),
+                            ui::EF_NONE,
                             ui::EF_NONE);
   scoped_ptr<ui::LocatedEvent> converted11(ConvertEvent(window1.get(),
                                                            original11));