| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |