X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fui%2Faura%2Fwindow_unittest.cc;h=2ac87ebe8cd57d29dcf6c44ed6edba9fc116a135;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=37cf5edca783169da05c17d47ac628f9059ab54a;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/ui/aura/window_unittest.cc b/src/ui/aura/window_unittest.cc index 37cf5ed..2ac87eb 100644 --- a/src/ui/aura/window_unittest.cc +++ b/src/ui/aura/window_unittest.cc @@ -20,7 +20,6 @@ #include "ui/aura/client/window_tree_client.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/test/aura_test_utils.h" -#include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/test/window_test_api.h" @@ -39,6 +38,7 @@ #include "ui/events/event_utils.h" #include "ui/events/gestures/gesture_configuration.h" #include "ui/events/keycodes/keyboard_codes.h" +#include "ui/events/test/event_generator.h" #include "ui/gfx/canvas.h" #include "ui/gfx/screen.h" #include "ui/gfx/skia_util.h" @@ -362,12 +362,7 @@ TEST_F(WindowTest, ContainsMouse) { } // Test Window::ConvertPointToWindow() with transform to root_window. -#if defined(USE_OZONE) -// TODO(rjkroege): Add cursor support in ozone: http://crbug.com/252315. -TEST_F(WindowTest, DISABLED_MoveCursorToWithTransformRootWindow) { -#else TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) { -#endif gfx::Transform transform; transform.Translate(100.0, 100.0); transform.Rotate(90.0); @@ -422,12 +417,7 @@ TEST_F(WindowTest, MoveCursorToWithTransformWindow) { // Test Window::ConvertPointToWindow() with complex transforms to both root and // non-root windows. // Test Window::ConvertPointToWindow() with transform to root_window. -#if defined(USE_OZONE) -// TODO(rjkroege): Add cursor support in ozone: http://crbug.com/252315. -TEST_F(WindowTest, DISABLED_MoveCursorToWithComplexTransform) { -#else TEST_F(WindowTest, MoveCursorToWithComplexTransform) { -#endif scoped_ptr w1( CreateTestWindow(SK_ColorWHITE, 1, gfx::Rect(10, 10, 500, 500), root_window())); @@ -781,7 +771,7 @@ TEST_F(WindowTest, CaptureTests) { EXPECT_TRUE(window->HasCapture()); EXPECT_EQ(0, delegate.capture_lost_count()); EXPECT_EQ(0, delegate.capture_changed_event_count()); - EventGenerator generator(root_window(), gfx::Point(50, 50)); + ui::test::EventGenerator generator(root_window(), gfx::Point(50, 50)); generator.PressLeftButton(); EXPECT_EQ(1, delegate.mouse_event_count()); generator.ReleaseLeftButton(); @@ -828,9 +818,9 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { &delegate2, 0, gfx::Rect(50, 50, 50, 50), root_window())); // Press on w1. - ui::TouchEvent press( + ui::TouchEvent press1( ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); - DispatchEventUsingWindowDispatcher(&press); + DispatchEventUsingWindowDispatcher(&press1); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. EXPECT_EQ(2, delegate1.gesture_event_count()); delegate1.ResetCounts(); @@ -842,13 +832,13 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { delegate1.ResetCounts(); delegate2.ResetCounts(); - // Events now go to w2. + // Events are ignored by w2, as it's receiving a partial touch stream. ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime()); DispatchEventUsingWindowDispatcher(&move); EXPECT_EQ(0, delegate1.gesture_event_count()); EXPECT_EQ(0, delegate1.touch_event_count()); EXPECT_EQ(0, delegate2.gesture_event_count()); - EXPECT_EQ(1, delegate2.touch_event_count()); + EXPECT_EQ(0, delegate2.touch_event_count()); ui::TouchEvent release( ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime()); @@ -878,9 +868,11 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { CaptureWindowDelegateImpl delegate; scoped_ptr window(CreateTestWindowWithDelegate( &delegate, 0, gfx::Rect(0, 0, 50, 50), root_window())); + base::TimeDelta time = getTime(); + const int kTimeDelta = 100; ui::TouchEvent press( - ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); + ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); DispatchEventUsingWindowDispatcher(&press); // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. @@ -895,7 +887,8 @@ 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()); + time += base::TimeDelta::FromMilliseconds(kTimeDelta); + ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, time); DispatchEventUsingWindowDispatcher(&move); EXPECT_EQ(1, delegate.touch_event_count()); EXPECT_EQ(3, delegate.gesture_event_count()); @@ -908,15 +901,17 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { delegate.ResetCounts(); // On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE. - ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), 0, getTime()); + time += base::TimeDelta::FromMilliseconds(kTimeDelta); + ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), 0, time); DispatchEventUsingWindowDispatcher(&move2); EXPECT_EQ(1, delegate.touch_event_count()); EXPECT_EQ(1, delegate.gesture_event_count()); delegate.ResetCounts(); // And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END + time += base::TimeDelta::FromMilliseconds(kTimeDelta); ui::TouchEvent release( - ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime()); + ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, time); DispatchEventUsingWindowDispatcher(&release); EXPECT_EQ(1, delegate.touch_event_count()); EXPECT_EQ(2, delegate.gesture_event_count()); @@ -1033,7 +1028,7 @@ TEST_F(WindowTest, ChangeCaptureWhileMouseDown) { EXPECT_TRUE(window->HasCapture()); EXPECT_EQ(0, delegate.capture_lost_count()); EXPECT_EQ(0, delegate.capture_changed_event_count()); - EventGenerator generator(root_window(), gfx::Point(50, 50)); + ui::test::EventGenerator generator(root_window(), gfx::Point(50, 50)); generator.PressLeftButton(); EXPECT_EQ(0, delegate.capture_lost_count()); EXPECT_EQ(0, delegate.capture_changed_event_count()); @@ -1136,7 +1131,7 @@ TEST_F(WindowTest, MouseEnterExit) { CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(70, 70, 50, 50), root_window())); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w1.get()); EXPECT_TRUE(d1.entered()); EXPECT_FALSE(d1.exited()); @@ -1157,7 +1152,7 @@ TEST_F(WindowTest, WindowTreeHostExit) { CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50), root_window())); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w1.get()); EXPECT_TRUE(d1.entered()); EXPECT_FALSE(d1.exited()); @@ -1183,7 +1178,7 @@ TEST_F(WindowTest, MouseEnterExitWithClick) { CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(70, 70, 50, 50), root_window())); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w1.get()); EXPECT_TRUE(d1.entered()); EXPECT_FALSE(d1.exited()); @@ -1209,7 +1204,7 @@ TEST_F(WindowTest, MouseEnterExitWhenDeleteWithCapture) { CreateTestWindowWithDelegate(&delegate, 1, gfx::Rect(10, 10, 50, 50), root_window())); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(window.get()); EXPECT_TRUE(delegate.entered()); EXPECT_FALSE(delegate.exited()); @@ -1237,7 +1232,7 @@ TEST_F(WindowTest, MouseEnterExitWithDelete) { CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50), root_window())); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w1.get()); EXPECT_TRUE(d1.entered()); EXPECT_FALSE(d1.exited()); @@ -1271,7 +1266,7 @@ TEST_F(WindowTest, MouseEnterExitWithHide) { CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50), root_window())); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w1.get()); EXPECT_TRUE(d1.entered()); EXPECT_FALSE(d1.exited()); @@ -1303,7 +1298,7 @@ TEST_F(WindowTest, MouseEnterExitWithParentHide) { MouseEnterExitWindowDelegate d2; Window* w2 = CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(10, 10, 50, 50), w1.get()); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w2); // Enters / exits can be send asynchronously. RunAllPendingInMessageLoop(); @@ -1327,7 +1322,7 @@ TEST_F(WindowTest, MouseEnterExitWithParentDelete) { MouseEnterExitWindowDelegate d2; Window* w2 = CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(10, 10, 50, 50), w1.get()); - test::EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseToCenterOf(w2); // Enters / exits can be send asynchronously. @@ -1618,8 +1613,8 @@ TEST_F(WindowTest, OwnedProperty) { TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { // We cannot short-circuit animations in this test. - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_ptr w1( CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), root_window())); @@ -2018,7 +2013,7 @@ TEST_F(WindowTest, VisibilityClientIsVisible) { TEST_F(WindowTest, MouseEventsOnWindowChange) { gfx::Size size = host()->GetBounds().size(); - EventGenerator generator(root_window()); + ui::test::EventGenerator generator(root_window()); generator.MoveMouseTo(50, 50); EventCountDelegate d1; @@ -2237,8 +2232,8 @@ TEST_F(WindowTest, RootWindowSetWhenReparenting) { parent1.AddChild(&child); // We need animations to start in order to observe the bounds changes. - ui::ScopedAnimationDurationScaleMode animation_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ui::ScopedLayerAnimationSettings settings1(child.layer()->GetAnimator()); settings1.SetTransitionDuration(base::TimeDelta::FromMilliseconds(100)); gfx::Rect new_bounds(gfx::Rect(35, 35, 50, 50)); @@ -2352,8 +2347,8 @@ TEST_F(WindowTest, DelegateNotifiedAsBoundsChange) { BoundsChangeDelegate delegate; // We cannot short-circuit animations in this test. - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_ptr window( CreateTestWindowWithDelegate(&delegate, 1, @@ -2387,8 +2382,8 @@ TEST_F(WindowTest, DelegateNotifiedAsBoundsChangeInHiddenLayer) { BoundsChangeDelegate delegate; // We cannot short-circuit animations in this test. - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_ptr window( CreateTestWindowWithDelegate(&delegate, 1, @@ -3390,8 +3385,8 @@ class TestLayerAnimationObserver : public ui::LayerAnimationObserver { } TEST_F(WindowTest, WindowDestroyCompletesAnimations) { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_refptr animator = ui::LayerAnimator::CreateImplicitAnimator(); TestLayerAnimationObserver observer;