Chromium Code Reviews| Index: content/common/input/input_param_traits_unittest.cc |
| diff --git a/content/common/input/input_param_traits_unittest.cc b/content/common/input/input_param_traits_unittest.cc |
| index 0dd2b3d1441a68121d0bf827c3f4693f820ce20e..84d42214893024295f3f9174c3485ab3b63c54ef 100644 |
| --- a/content/common/input/input_param_traits_unittest.cc |
| +++ b/content/common/input/input_param_traits_unittest.cc |
| @@ -10,6 +10,7 @@ |
| #include "content/common/input/input_event.h" |
| #include "content/common/input/synthetic_gesture_params.h" |
| #include "content/common/input/synthetic_pinch_gesture_params.h" |
| +#include "content/common/input/synthetic_pointer_action_params.h" |
| #include "content/common/input/synthetic_smooth_drag_gesture_params.h" |
| #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
| #include "content/common/input_messages.h" |
| @@ -77,6 +78,14 @@ class InputParamTraitsTest : public testing::Test { |
| EXPECT_EQ(a->duration_ms, b->duration_ms); |
| } |
| + static void Compare(const SyntheticPointerActionParams* a, |
| + const SyntheticPointerActionParams* b) { |
| + EXPECT_EQ(a->gesture_source_type, b->gesture_source_type); |
| + EXPECT_EQ(a->position(), b->position()); |
|
tdresser
2016/03/23 15:09:25
Won't this fail for some types, due to the asserti
samuong
2016/03/29 20:51:25
Not sure if I'm talking about the same issue as Ti
tdresser
2016/03/30 13:52:22
That's separate from what I'm referring to (there
lanwei
2016/03/30 21:02:53
I checked the definition of EXPECT_EQ, it uses Poi
lanwei
2016/03/30 21:02:53
Thanks for catching this, I added the constraint w
tdresser
2016/03/31 12:25:31
The fact that we didn't catch this in any automate
|
| + EXPECT_EQ(a->index(), b->index()); |
| + EXPECT_EQ(a->pointer_action_type(), b->pointer_action_type()); |
| + } |
| + |
| static void Compare(const SyntheticGesturePacket* a, |
| const SyntheticGesturePacket* b) { |
| ASSERT_EQ(!!a, !!b); |
| @@ -102,6 +111,10 @@ class InputParamTraitsTest : public testing::Test { |
| Compare(SyntheticTapGestureParams::Cast(a->gesture_params()), |
| SyntheticTapGestureParams::Cast(b->gesture_params())); |
| break; |
| + case SyntheticGestureParams::POINTER_ACTION: |
| + Compare(SyntheticPointerActionParams::Cast(a->gesture_params()), |
| + SyntheticPointerActionParams::Cast(b->gesture_params())); |
| + break; |
| } |
| } |
| @@ -250,5 +263,19 @@ TEST_F(InputParamTraitsTest, SyntheticTapGestureParams) { |
| Verify(packet_in); |
| } |
| +TEST_F(InputParamTraitsTest, SyntheticPointerActionParams) { |
| + scoped_ptr<SyntheticPointerActionParams> gesture_params( |
| + new SyntheticPointerActionParams( |
| + SyntheticPointerActionParams::PointerActionType::MOVE)); |
| + gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| + gesture_params->set_position(gfx::PointF(356, 287)); |
| + gesture_params->set_index(0); |
| + ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION, |
| + gesture_params->GetGestureType()); |
| + SyntheticGesturePacket packet_in; |
| + packet_in.set_gesture_params(std::move(gesture_params)); |
| + Verify(packet_in); |
| +} |
| + |
| } // namespace |
| } // namespace content |