Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ui / aura / window_unittest.cc
index ba97593..e3e81b2 100644 (file)
@@ -372,7 +372,7 @@ TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) {
   transform.Rotate(90.0);
   transform.Scale(2.0, 5.0);
   dispatcher()->host()->SetTransform(transform);
-  dispatcher()->MoveCursorTo(gfx::Point(10, 10));
+  dispatcher()->host()->MoveCursorTo(gfx::Point(10, 10));
 #if !defined(OS_WIN)
   gfx::Point mouse_location;
   EXPECT_TRUE(dispatcher()->host()->QueryMouseLocation(&mouse_location));
@@ -482,23 +482,6 @@ TEST_F(WindowTest, HitTest) {
   EXPECT_TRUE(w1.HitTest(gfx::Point(1, 1)));
   EXPECT_FALSE(w1.HitTest(gfx::Point(-1, -1)));
 
-  // We can expand the bounds slightly to track events outside our border.
-  w1.SetHitTestBoundsOverrideOuter(gfx::Insets(-1, -1, -1, -1),
-                                   gfx::Insets(-5, -5, -5, -5));
-  EXPECT_TRUE(w1.HitTest(gfx::Point(-1, -1)));
-  EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2)));
-
-  ui::TouchEvent pressed(
-      ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&pressed);
-  EXPECT_TRUE(w1.HitTest(gfx::Point(-2, -2)));
-  EXPECT_TRUE(w1.HitTest(gfx::Point(-5, -5)));
-  EXPECT_FALSE(w1.HitTest(gfx::Point(-5, -6)));
-  ui::TouchEvent released(
-      ui::ET_TOUCH_RELEASED, gfx::Point(50, 50), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&released);
-  EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2)));
-
   // TODO(beng): clip Window to parent.
 }
 
@@ -847,7 +830,7 @@ TEST_F(WindowTest, CaptureTests) {
 
   ui::TouchEvent touchev(
       ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&touchev);
+  DispatchEventUsingWindowDispatcher(&touchev);
   EXPECT_EQ(1, delegate.touch_event_count());
   delegate.ResetCounts();
 
@@ -863,7 +846,7 @@ TEST_F(WindowTest, CaptureTests) {
 
   ui::TouchEvent touchev2(
       ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&touchev2);
+  DispatchEventUsingWindowDispatcher(&touchev2);
   EXPECT_EQ(0, delegate.touch_event_count());
 
   // Removing the capture window from parent should reset the capture window
@@ -886,7 +869,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
   // Press on w1.
   ui::TouchEvent press(
       ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+  DispatchEventUsingWindowDispatcher(&press);
   // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
   EXPECT_EQ(2, delegate1.gesture_event_count());
   delegate1.ResetCounts();
@@ -900,7 +883,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
 
   // Events now go to w2.
   ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+  DispatchEventUsingWindowDispatcher(&move);
   EXPECT_EQ(0, delegate1.gesture_event_count());
   EXPECT_EQ(0, delegate1.touch_event_count());
   EXPECT_EQ(0, delegate2.gesture_event_count());
@@ -908,14 +891,14 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
 
   ui::TouchEvent release(
       ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+  DispatchEventUsingWindowDispatcher(&release);
   EXPECT_EQ(0, delegate1.gesture_event_count());
   EXPECT_EQ(0, delegate2.gesture_event_count());
 
   // A new press is captured by w2.
   ui::TouchEvent press2(
       ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press2);
+  DispatchEventUsingWindowDispatcher(&press2);
   EXPECT_EQ(0, delegate1.gesture_event_count());
   // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
   EXPECT_EQ(2, delegate2.gesture_event_count());
@@ -937,7 +920,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
 
   ui::TouchEvent press(
       ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+  DispatchEventUsingWindowDispatcher(&press);
 
   // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
   EXPECT_EQ(2, delegate.gesture_event_count());
@@ -952,7 +935,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
   // On move We will get TOUCH_MOVED, GESTURE_TAP_CANCEL,
   // GESTURE_SCROLL_START and GESTURE_SCROLL_UPDATE.
   ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move);
+  DispatchEventUsingWindowDispatcher(&move);
   EXPECT_EQ(1, delegate.touch_event_count());
   EXPECT_EQ(3, delegate.gesture_event_count());
   delegate.ResetCounts();
@@ -965,7 +948,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
 
   // On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE.
   ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&move2);
+  DispatchEventUsingWindowDispatcher(&move2);
   EXPECT_EQ(1, delegate.touch_event_count());
   EXPECT_EQ(1, delegate.gesture_event_count());
   delegate.ResetCounts();
@@ -973,7 +956,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
   // And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END
   ui::TouchEvent release(
       ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release);
+  DispatchEventUsingWindowDispatcher(&release);
   EXPECT_EQ(1, delegate.touch_event_count());
   EXPECT_EQ(2, delegate.gesture_event_count());
 }
@@ -986,7 +969,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
   scoped_ptr<Window> w1(CreateTestWindowWithDelegate(
       &d1, 0, gfx::Rect(0, 0, 20, 20), root_window()));
   ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&p1);
+  DispatchEventUsingWindowDispatcher(&p1);
   // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
   EXPECT_EQ(1, d1.touch_event_count());
   EXPECT_EQ(2, d1.gesture_event_count());
@@ -997,7 +980,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
   scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
       &d2, 0, gfx::Rect(40, 0, 40, 20), root_window()));
   ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&p2);
+  DispatchEventUsingWindowDispatcher(&p2);
   EXPECT_EQ(0, d1.touch_event_count());
   EXPECT_EQ(0, d1.gesture_event_count());
   // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window.
@@ -1033,7 +1016,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
   // Move touch id originally associated with |w2|. Since capture was transfered
   // from 2 to 3 only |w3| should get the event.
   ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&m3);
+  DispatchEventUsingWindowDispatcher(&m3);
   EXPECT_EQ(0, d1.touch_event_count());
   EXPECT_EQ(0, d1.gesture_event_count());
   EXPECT_EQ(0, d2.touch_event_count());
@@ -1056,7 +1039,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
 
   // And when we move the touch again, |w3| still gets the events.
   ui::TouchEvent m4(ui::ET_TOUCH_MOVED, gfx::Point(120, 105), 1, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&m4);
+  DispatchEventUsingWindowDispatcher(&m4);
   EXPECT_EQ(0, d1.touch_event_count());
   EXPECT_EQ(0, d1.gesture_event_count());
   EXPECT_EQ(0, d2.touch_event_count());
@@ -1221,7 +1204,7 @@ TEST_F(WindowTest, WindowTreeHostExit) {
 
   ui::MouseEvent exit_event(
       ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0, 0);
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostMouseEvent(&exit_event);
+  DispatchEventUsingWindowDispatcher(&exit_event);
   EXPECT_FALSE(d1.entered());
   EXPECT_TRUE(d1.exited());
 }
@@ -1580,7 +1563,7 @@ TEST_F(WindowTest, TransformGesture) {
 
   ui::TouchEvent press(
       ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime());
-  dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press);
+  DispatchEventUsingWindowDispatcher(&press);
   EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
 }