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

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

Issue 2478423002: Rename SyntheticPointer to SyntheticPointerDriver (Closed)
Patch Set: rename Created 4 years, 1 month 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 "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const SyntheticPointerActionParams* b) { 83 const SyntheticPointerActionParams* b) {
84 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type); 84 EXPECT_EQ(a->gesture_source_type, b->gesture_source_type);
85 EXPECT_EQ(a->pointer_action_type(), b->pointer_action_type()); 85 EXPECT_EQ(a->pointer_action_type(), b->pointer_action_type());
86 if (a->pointer_action_type() == 86 if (a->pointer_action_type() ==
87 SyntheticPointerActionParams::PointerActionType::PRESS || 87 SyntheticPointerActionParams::PointerActionType::PRESS ||
88 a->pointer_action_type() == 88 a->pointer_action_type() ==
89 SyntheticPointerActionParams::PointerActionType::MOVE) { 89 SyntheticPointerActionParams::PointerActionType::MOVE) {
90 EXPECT_EQ(a->position(), b->position()); 90 EXPECT_EQ(a->position(), b->position());
91 } 91 }
92 if (a->pointer_action_type() != 92 if (a->pointer_action_type() !=
93 SyntheticPointerActionParams::PointerActionType::PROCESS &&
94 a->pointer_action_type() !=
95 SyntheticPointerActionParams::PointerActionType::FINISH) { 93 SyntheticPointerActionParams::PointerActionType::FINISH) {
96 EXPECT_EQ(a->index(), b->index()); 94 EXPECT_EQ(a->index(), b->index());
97 } 95 }
98 } 96 }
99 97
100 static void Compare(const SyntheticGesturePacket* a, 98 static void Compare(const SyntheticGesturePacket* a,
101 const SyntheticGesturePacket* b) { 99 const SyntheticGesturePacket* b) {
102 ASSERT_EQ(!!a, !!b); 100 ASSERT_EQ(!!a, !!b);
103 if (!a) return; 101 if (!a) return;
104 ASSERT_EQ(!!a->gesture_params(), !!b->gesture_params()); 102 ASSERT_EQ(!!a->gesture_params(), !!b->gesture_params());
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION, 295 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION,
298 gesture_params->GetGestureType()); 296 gesture_params->GetGestureType());
299 SyntheticGesturePacket packet_in; 297 SyntheticGesturePacket packet_in;
300 packet_in.set_gesture_params(std::move(gesture_params)); 298 packet_in.set_gesture_params(std::move(gesture_params));
301 Verify(packet_in); 299 Verify(packet_in);
302 } 300 }
303 301
304 TEST_F(InputParamTraitsTest, SyntheticPointerActionParamsProcess) { 302 TEST_F(InputParamTraitsTest, SyntheticPointerActionParamsProcess) {
305 std::unique_ptr<SyntheticPointerActionParams> gesture_params = 303 std::unique_ptr<SyntheticPointerActionParams> gesture_params =
306 base::MakeUnique<SyntheticPointerActionParams>( 304 base::MakeUnique<SyntheticPointerActionParams>(
307 SyntheticPointerActionParams::PointerActionType::PROCESS); 305 SyntheticPointerActionParams::PointerActionType::IDLE);
308 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 306 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
307 gesture_params->set_index(0);
309 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION, 308 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION,
310 gesture_params->GetGestureType()); 309 gesture_params->GetGestureType());
311 SyntheticGesturePacket packet_in; 310 SyntheticGesturePacket packet_in;
312 packet_in.set_gesture_params(std::move(gesture_params)); 311 packet_in.set_gesture_params(std::move(gesture_params));
313 Verify(packet_in); 312 Verify(packet_in);
314 } 313 }
315 314
316 TEST_F(InputParamTraitsTest, SyntheticPointerActionParamsFinish) { 315 TEST_F(InputParamTraitsTest, SyntheticPointerActionParamsFinish) {
317 std::unique_ptr<SyntheticPointerActionParams> gesture_params = 316 std::unique_ptr<SyntheticPointerActionParams> gesture_params =
318 base::MakeUnique<SyntheticPointerActionParams>( 317 base::MakeUnique<SyntheticPointerActionParams>(
319 SyntheticPointerActionParams::PointerActionType::FINISH); 318 SyntheticPointerActionParams::PointerActionType::FINISH);
320 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 319 gesture_params->gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
321 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION, 320 ASSERT_EQ(SyntheticGestureParams::POINTER_ACTION,
322 gesture_params->GetGestureType()); 321 gesture_params->GetGestureType());
323 SyntheticGesturePacket packet_in; 322 SyntheticGesturePacket packet_in;
324 packet_in.set_gesture_params(std::move(gesture_params)); 323 packet_in.set_gesture_params(std::move(gesture_params));
325 Verify(packet_in); 324 Verify(packet_in);
326 } 325 }
327 326
328 } // namespace 327 } // namespace
329 } // namespace content 328 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698