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

Side by Side Diff: content/common/input/input_param_traits_unittest.cc

Issue 1884883005: Prepare SyntheticPointerAction to handle touch actions for multiple fingers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests for mouse and change type of params_list Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/input/input_param_traits.h" 5 #include "content/common/input/input_param_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "content/common/input/input_event.h" 10 #include "content/common/input/input_event.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const SyntheticPointerActionParams* b) { 82 const SyntheticPointerActionParams* b) {
83 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type); 83 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type);
84 EXPECT_EQ(a->pointer_action_type(), b->pointer_action_type()); 84 EXPECT_EQ(a->pointer_action_type(), b->pointer_action_type());
85 if (a->pointer_action_type() == 85 if (a->pointer_action_type() ==
86 SyntheticPointerActionParams::PointerActionType::PRESS || 86 SyntheticPointerActionParams::PointerActionType::PRESS ||
87 a->pointer_action_type() == 87 a->pointer_action_type() ==
88 SyntheticPointerActionParams::PointerActionType::MOVE) { 88 SyntheticPointerActionParams::PointerActionType::MOVE) {
89 EXPECT_EQ(a->position(), b->position()); 89 EXPECT_EQ(a->position(), b->position());
90 } 90 }
91 if (a->pointer_action_type() != 91 if (a->pointer_action_type() !=
92 SyntheticPointerActionParams::PointerActionType::PROCESS) { 92 SyntheticPointerActionParams::PointerActionType::PROCESS &&
93 a->pointer_action_type() !=
94 SyntheticPointerActionParams::PointerActionType::FINISH) {
93 EXPECT_EQ(a->index(), b->index()); 95 EXPECT_EQ(a->index(), b->index());
94 } 96 }
95 } 97 }
96 98
97 static void Compare(const SyntheticGesturePacket* a, 99 static void Compare(const SyntheticGesturePacket* a,
98 const SyntheticGesturePacket* b) { 100 const SyntheticGesturePacket* b) {
99 ASSERT_EQ(!!a, !!b); 101 ASSERT_EQ(!!a, !!b);
100 if (!a) return; 102 if (!a) return;
101 ASSERT_EQ(!!a->gesture_params(), !!b->gesture_params()); 103 ASSERT_EQ(!!a->gesture_params(), !!b->gesture_params());
102 if (!a->gesture_params()) return; 104 if (!a->gesture_params()) return;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 new SyntheticPointerActionParams( 305 new SyntheticPointerActionParams(
304 SyntheticPointerActionParams::PointerActionType::PROCESS)); 306 SyntheticPointerActionParams::PointerActionType::PROCESS));
305 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 307 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
306 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION, 308 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION,
307 gesture_params->GetGestureType()); 309 gesture_params->GetGestureType());
308 SyntheticGesturePacket packet_in; 310 SyntheticGesturePacket packet_in;
309 packet_in.set_gesture_params(std::move(gesture_params)); 311 packet_in.set_gesture_params(std::move(gesture_params));
310 Verify(packet_in); 312 Verify(packet_in);
311 } 313 }
312 314
315 TEST_F(InputParamTraitsTest, SyntheticPointerActionParamsFinish) {
316 std::unique_ptr<SyntheticPointerActionParams> gesture_params(
317 new SyntheticPointerActionParams(
318 SyntheticPointerActionParams::PointerActionType::FINISH));
319 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
320 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION,
321 gesture_params->GetGestureType());
322 SyntheticGesturePacket packet_in;
323 packet_in.set_gesture_params(std::move(gesture_params));
324 Verify(packet_in);
325 }
326
313 } // namespace 327 } // namespace
314 } // namespace content 328 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698