Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: components/exo/pointer_unittest.cc

Issue 1750633002: components/exo: Extend pointer to use v5 protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/exo/pointer_unittest.cc
diff --git a/components/exo/pointer_unittest.cc b/components/exo/pointer_unittest.cc
index 4f8ee500d0b2109890c34371339c79341fcaf673..cec0ec8c1c4cbe6d9a3aaddf00494049bc0d1c3c 100644
--- a/components/exo/pointer_unittest.cc
+++ b/components/exo/pointer_unittest.cc
@@ -30,7 +30,10 @@ class MockPointerDelegate : public PointerDelegate {
MOCK_METHOD1(OnPointerLeave, void(Surface*));
MOCK_METHOD2(OnPointerMotion, void(base::TimeDelta, const gfx::Point&));
MOCK_METHOD3(OnPointerButton, void(base::TimeDelta, int, bool));
- MOCK_METHOD2(OnPointerWheel, void(base::TimeDelta, const gfx::Vector2d&));
+ MOCK_METHOD3(OnPointerScroll,
+ void(base::TimeDelta, const gfx::Vector2dF&, bool));
+ MOCK_METHOD1(OnPointerScrollStop, void(base::TimeDelta));
+ MOCK_METHOD0(OnPointerFrame, void());
};
TEST_F(PointerTest, SetCursor) {
@@ -48,6 +51,7 @@ TEST_F(PointerTest, SetCursor) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
reveman 2016/03/02 04:16:53 nit: Can we use an exact number of expected calls
denniskempin 2016/03/02 20:47:58 Done.
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(surface->GetBoundsInScreen().origin());
@@ -85,6 +89,7 @@ TEST_F(PointerTest, OnPointerEnter) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(surface->GetBoundsInScreen().origin());
@@ -107,6 +112,7 @@ TEST_F(PointerTest, OnPointerLeave) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(surface->GetBoundsInScreen().origin());
@@ -132,6 +138,8 @@ TEST_F(PointerTest, OnPointerMotion) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
+
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(surface->GetBoundsInScreen().origin());
@@ -151,6 +159,8 @@ TEST_F(PointerTest, OnPointerMotion) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(sub_surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
+
EXPECT_CALL(delegate, OnPointerLeave(surface.get()));
EXPECT_CALL(delegate, OnPointerEnter(sub_surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(sub_surface->GetBoundsInScreen().origin());
@@ -178,6 +188,8 @@ TEST_F(PointerTest, OnPointerButton) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
+
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(surface->GetBoundsInScreen().origin());
@@ -191,7 +203,7 @@ TEST_F(PointerTest, OnPointerButton) {
pointer.reset();
}
-TEST_F(PointerTest, OnPointerWheel) {
+TEST_F(PointerTest, OnPointerWheelScroll) {
reveman 2016/03/02 04:16:53 nit: OnPointerScrollDiscrete and maybe move the te
denniskempin 2016/03/02 20:47:58 Done.
scoped_ptr<Surface> surface(new Surface);
scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
gfx::Size buffer_size(10, 10);
@@ -206,17 +218,20 @@ TEST_F(PointerTest, OnPointerWheel) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
+
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(surface->GetBoundsInScreen().origin());
- EXPECT_CALL(delegate, OnPointerWheel(testing::_, gfx::Vector2d(1, 1)));
+ EXPECT_CALL(delegate,
+ OnPointerScroll(testing::_, gfx::Vector2dF(1, 1), true));
generator.MoveMouseWheel(1, 1);
EXPECT_CALL(delegate, OnPointerDestroying(pointer.get()));
pointer.reset();
}
-TEST_F(PointerTest, OnPointerScroll) {
+TEST_F(PointerTest, OnPointerSmoothScroll) {
reveman 2016/03/02 04:16:53 nit: I think we can keep the existing "OnPointerSc
denniskempin 2016/03/02 20:47:58 Done.
scoped_ptr<Surface> surface(new Surface);
scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
gfx::Size buffer_size(10, 10);
@@ -232,10 +247,20 @@ TEST_F(PointerTest, OnPointerScroll) {
EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get()))
.WillRepeatedly(testing::Return(true));
+ EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber());
+
EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::Point(), 0));
generator.MoveMouseTo(location);
- EXPECT_CALL(delegate, OnPointerWheel(testing::_, gfx::Vector2d(1, 1)));
+ { // Expect fling stop followed by scroll and scroll stop
reveman 2016/03/02 04:16:53 nit: move the comment to the line below and add ".
denniskempin 2016/03/02 20:47:58 Done.
+ testing::InSequence sequence;
+
+ EXPECT_CALL(delegate,
+ OnPointerScroll(testing::_, gfx::Vector2dF(0, 0), false));
+ EXPECT_CALL(delegate,
+ OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false));
+ EXPECT_CALL(delegate, OnPointerScrollStop(testing::_));
+ }
generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1);
EXPECT_CALL(delegate, OnPointerDestroying(pointer.get()));

Powered by Google App Engine
This is Rietveld 408576698