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

Unified Diff: content/common/input/input_param_traits_unittest.cc

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes in synthetic_gesture_controller_unittest.cc Created 4 years, 9 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: 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

Powered by Google App Engine
This is Rietveld 408576698