diff options
Diffstat (limited to 'ui/aura/window_unittest.cc')
-rw-r--r-- | ui/aura/window_unittest.cc | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 941684f..af8a470 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -13,7 +13,6 @@ #include "ui/aura/client/capture_client.h" #include "ui/aura/client/stacking_client.h" #include "ui/aura/client/visibility_client.h" -#include "ui/aura/event.h" #include "ui/aura/layout_manager.h" #include "ui/aura/root_window.h" #include "ui/aura/root_window_host.h" @@ -25,6 +24,7 @@ #include "ui/aura/window_delegate.h" #include "ui/aura/window_observer.h" #include "ui/aura/window_property.h" +#include "ui/base/event.h" #include "ui/base/gestures/gesture_configuration.h" #include "ui/base/hit_test.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -164,17 +164,18 @@ class CaptureWindowDelegateImpl : public TestWindowDelegate { int touch_event_count() const { return touch_event_count_; } int gesture_event_count() const { return gesture_event_count_; } - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) capture_changed_event_count_++; mouse_event_count_++; return false; } - virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE { + virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { touch_event_count_++; return ui::TOUCH_STATUS_UNKNOWN; } - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE { gesture_event_count_++; return ui::GESTURE_STATUS_UNKNOWN; } @@ -216,7 +217,8 @@ class GestureTrackPositionDelegate : public TestWindowDelegate { public: GestureTrackPositionDelegate() {} - virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE { + virtual ui::GestureStatus OnGestureEvent( + ui::GestureEventImpl* event) OVERRIDE { position_ = event->location(); return ui::GESTURE_STATUS_CONSUMED; } @@ -294,7 +296,7 @@ TEST_F(WindowTest, ConvertPointToWindow) { scoped_ptr<Window> w1(CreateTestWindowWithId(1, NULL)); gfx::Point reference_point(100, 100); gfx::Point test_point = reference_point; - Window::ConvertPointToWindow(NULL, w1.get(), &test_point); + Window::ConvertPointToTarget(NULL, w1.get(), &test_point); EXPECT_EQ(reference_point, test_point); } @@ -753,7 +755,8 @@ TEST_F(WindowTest, CaptureTests) { EXPECT_EQ(2, delegate.mouse_event_count()); delegate.ResetCounts(); - TouchEvent touchev(ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime()); + ui::TouchEventImpl touchev( + ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev); EXPECT_EQ(1, delegate.touch_event_count()); delegate.ResetCounts(); @@ -768,7 +771,8 @@ TEST_F(WindowTest, CaptureTests) { generator.PressLeftButton(); EXPECT_EQ(1, delegate.mouse_event_count()); - TouchEvent touchev2(ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime()); + ui::TouchEventImpl touchev2( + ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2); EXPECT_EQ(1, delegate.touch_event_count()); @@ -790,8 +794,8 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { &delegate2, 0, gfx::Rect(20, 20, 20, 20), NULL)); // Press on w1. - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. EXPECT_EQ(2, delegate1.gesture_event_count()); @@ -806,24 +810,23 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { delegate1.ResetCounts(); delegate2.ResetCounts(); - TouchEvent move(ui::ET_TOUCH_MOVED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move); // This touch id is now ignored, no scroll fired. EXPECT_EQ(0, delegate1.gesture_event_count()); EXPECT_EQ(0, delegate2.gesture_event_count()); - TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl release( + ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_EQ(0, delegate1.gesture_event_count()); EXPECT_EQ(0, delegate2.gesture_event_count()); // A new press is captured by w2. - TouchEvent press2(ui::ET_TOUCH_PRESSED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl press2( + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2); EXPECT_EQ(0, delegate1.gesture_event_count()); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. @@ -835,8 +838,8 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { scoped_ptr<Window> window(CreateTestWindowWithDelegate( &delegate, 0, gfx::Rect(0, 0, 20, 20), NULL)); - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. @@ -849,9 +852,9 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { // The move event should still create a gesture, as this touch was // on the window which was captured. - TouchEvent release(ui::ET_TOUCH_RELEASED, - gfx::Point(10, 10), 0, getTime() + - base::TimeDelta::FromMilliseconds(50)); + ui::TouchEventImpl release(ui::ET_TOUCH_RELEASED, + gfx::Point(10, 10), 0, getTime() + + base::TimeDelta::FromMilliseconds(50)); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); EXPECT_EQ(2, delegate.gesture_event_count()); } @@ -862,7 +865,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) { CaptureWindowDelegateImpl d1; scoped_ptr<Window> w1(CreateTestWindowWithDelegate( &d1, 0, gfx::Rect(0, 0, 20, 20), NULL)); - TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); + ui::TouchEventImpl p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p1); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. EXPECT_EQ(2, d1.gesture_event_count()); @@ -872,7 +875,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) { CaptureWindowDelegateImpl d2; scoped_ptr<Window> w2(CreateTestWindowWithDelegate( &d2, 0, gfx::Rect(40, 0, 40, 20), NULL)); - TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime()); + ui::TouchEventImpl p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2); EXPECT_EQ(0, d1.gesture_event_count()); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window. @@ -898,7 +901,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. - TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime()); + ui::TouchEventImpl m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m3); EXPECT_EQ(0, d1.gesture_event_count()); EXPECT_EQ(0, d2.gesture_event_count()); @@ -986,7 +989,7 @@ class MouseEnterExitWindowDelegate : public TestWindowDelegate { public: MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} - virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE { + virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { switch (event->type()) { case ui::ET_MOUSE_ENTERED: entered_ = true; @@ -1310,8 +1313,8 @@ TEST_F(WindowTest, TransformGesture) { transform.ConcatTranslate(size.height(), 0); root_window()->SetTransform(transform); - TouchEvent press(ui::ET_TOUCH_PRESSED, - gfx::Point(size.height() - 10, 10), 0, getTime()); + ui::TouchEventImpl press( + ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime()); root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); } |