| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 7 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 8 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 8 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 9 #include "content/browser/renderer_host/input/synthetic_pointer_action.h" | 9 #include "content/browser/renderer_host/input/synthetic_pointer_action.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_touch_pointer.h" | 10 #include "content/browser/renderer_host/input/synthetic_touch_driver.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 #include "ui/gfx/geometry/point.h" | 13 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/geometry/point_f.h" | 14 #include "ui/gfx/geometry/point_f.h" |
| 15 | 15 |
| 16 using blink::WebInputEvent; | 16 using blink::WebInputEvent; |
| 17 using blink::WebTouchEvent; | 17 using blink::WebTouchEvent; |
| 18 using blink::WebMouseEvent; | 18 using blink::WebMouseEvent; |
| 19 using blink::WebTouchPoint; | 19 using blink::WebTouchPoint; |
| 20 | 20 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 private: | 113 private: |
| 114 gfx::PointF position_; | 114 gfx::PointF position_; |
| 115 int clickCount_; | 115 int clickCount_; |
| 116 WebMouseEvent::Button button_; | 116 WebMouseEvent::Button button_; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 class SyntheticPointerActionTest : public testing::Test { | 119 class SyntheticPointerActionTest : public testing::Test { |
| 120 public: | 120 public: |
| 121 SyntheticPointerActionTest() { | 121 SyntheticPointerActionTest() { |
| 122 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); | 122 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); |
| 123 std::fill(index_map_.begin(), index_map_.end(), -1); | |
| 124 num_success_ = 0; | 123 num_success_ = 0; |
| 125 num_failure_ = 0; | 124 num_failure_ = 0; |
| 126 } | 125 } |
| 127 ~SyntheticPointerActionTest() override {} | 126 ~SyntheticPointerActionTest() override {} |
| 128 | 127 |
| 129 protected: | 128 protected: |
| 130 template <typename MockGestureTarget> | 129 template <typename MockGestureTarget> |
| 131 void CreateSyntheticPointerActionTarget() { | 130 void CreateSyntheticPointerActionTarget() { |
| 132 target_.reset(new MockGestureTarget()); | 131 target_.reset(new MockGestureTarget()); |
| 133 synthetic_pointer_ = SyntheticPointer::Create( | 132 synthetic_pointer_driver_ = SyntheticPointerDriver::Create( |
| 134 target_->GetDefaultSyntheticGestureSourceType()); | 133 target_->GetDefaultSyntheticGestureSourceType()); |
| 135 } | 134 } |
| 136 | 135 |
| 137 void ForwardSyntheticPointerAction() { | 136 void ForwardSyntheticPointerAction() { |
| 138 pointer_action_.reset(new SyntheticPointerAction( | 137 pointer_action_.reset(new SyntheticPointerAction( |
| 139 std::move(action_param_list_), synthetic_pointer_.get(), &index_map_)); | 138 std::move(action_param_list_), synthetic_pointer_driver_.get())); |
| 140 | 139 |
| 141 SyntheticGesture::Result result = pointer_action_->ForwardInputEvents( | 140 SyntheticGesture::Result result = pointer_action_->ForwardInputEvents( |
| 142 base::TimeTicks::Now(), target_.get()); | 141 base::TimeTicks::Now(), target_.get()); |
| 143 | 142 |
| 144 if (result == SyntheticGesture::GESTURE_FINISHED) | 143 if (result == SyntheticGesture::GESTURE_FINISHED) |
| 145 num_success_++; | 144 num_success_++; |
| 146 else | 145 else |
| 147 num_failure_++; | 146 num_failure_++; |
| 148 } | 147 } |
| 149 | 148 |
| 149 int GetPointIndex(int index) const { |
| 150 return synthetic_pointer_driver_->GetPointIndex(index); |
| 151 } |
| 152 |
| 150 int num_success_; | 153 int num_success_; |
| 151 int num_failure_; | 154 int num_failure_; |
| 152 std::unique_ptr<MockSyntheticPointerActionTarget> target_; | 155 std::unique_ptr<MockSyntheticPointerActionTarget> target_; |
| 153 std::unique_ptr<SyntheticGesture> pointer_action_; | 156 std::unique_ptr<SyntheticGesture> pointer_action_; |
| 154 std::unique_ptr<SyntheticPointer> synthetic_pointer_; | 157 std::unique_ptr<SyntheticPointerDriver> synthetic_pointer_driver_; |
| 155 std::unique_ptr<std::vector<SyntheticPointerActionParams>> action_param_list_; | 158 std::unique_ptr<std::vector<SyntheticPointerActionParams>> action_param_list_; |
| 156 SyntheticPointerAction::IndexMap index_map_; | |
| 157 }; | 159 }; |
| 158 | 160 |
| 159 TEST_F(SyntheticPointerActionTest, PointerTouchAction) { | 161 TEST_F(SyntheticPointerActionTest, PointerTouchAction) { |
| 160 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); | 162 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); |
| 161 | 163 |
| 162 // Send a touch press for one finger. | 164 // Send a touch press for one finger. |
| 163 SyntheticPointerActionParams params0 = SyntheticPointerActionParams( | 165 SyntheticPointerActionParams params0 = SyntheticPointerActionParams( |
| 164 SyntheticPointerActionParams::PointerActionType::PRESS); | 166 SyntheticPointerActionParams::PointerActionType::PRESS); |
| 165 params0.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 167 params0.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| 166 params0.set_index(0); | 168 params0.set_index(0); |
| 167 params0.set_position(gfx::PointF(54, 89)); | 169 params0.set_position(gfx::PointF(54, 89)); |
| 168 action_param_list_->push_back(params0); | 170 action_param_list_->push_back(params0); |
| 169 ForwardSyntheticPointerAction(); | 171 ForwardSyntheticPointerAction(); |
| 170 | 172 |
| 171 MockSyntheticPointerTouchActionTarget* pointer_touch_target = | 173 MockSyntheticPointerTouchActionTarget* pointer_touch_target = |
| 172 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); | 174 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); |
| 173 EXPECT_EQ(1, num_success_); | 175 EXPECT_EQ(1, num_success_); |
| 174 EXPECT_EQ(0, num_failure_); | 176 EXPECT_EQ(0, num_failure_); |
| 175 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); | 177 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); |
| 176 EXPECT_EQ(pointer_touch_target->indexes(0), 0); | 178 EXPECT_EQ(pointer_touch_target->indexes(0), 0); |
| 177 EXPECT_EQ(index_map_[0], 0); | 179 EXPECT_EQ(GetPointIndex(0), 0); |
| 178 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); | 180 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); |
| 179 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); | 181 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); |
| 180 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); | 182 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); |
| 181 | 183 |
| 182 // Send a touch move for the first finger and a touch press for the second | 184 // Send a touch move for the first finger and a touch press for the second |
| 183 // finger. | 185 // finger. |
| 184 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); | 186 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); |
| 185 params0.set_pointer_action_type( | 187 params0.set_pointer_action_type( |
| 186 SyntheticPointerActionParams::PointerActionType::MOVE); | 188 SyntheticPointerActionParams::PointerActionType::MOVE); |
| 187 params0.set_position(gfx::PointF(133, 156)); | 189 params0.set_position(gfx::PointF(133, 156)); |
| 188 SyntheticPointerActionParams params1 = SyntheticPointerActionParams( | 190 SyntheticPointerActionParams params1 = SyntheticPointerActionParams( |
| 189 SyntheticPointerActionParams::PointerActionType::PRESS); | 191 SyntheticPointerActionParams::PointerActionType::PRESS); |
| 190 params1.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 192 params1.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| 191 params1.set_index(1); | 193 params1.set_index(1); |
| 192 params1.set_position(gfx::PointF(79, 132)); | 194 params1.set_position(gfx::PointF(79, 132)); |
| 193 action_param_list_->push_back(params0); | 195 action_param_list_->push_back(params0); |
| 194 action_param_list_->push_back(params1); | 196 action_param_list_->push_back(params1); |
| 195 ForwardSyntheticPointerAction(); | 197 ForwardSyntheticPointerAction(); |
| 196 | 198 |
| 197 EXPECT_EQ(2, num_success_); | 199 EXPECT_EQ(2, num_success_); |
| 198 EXPECT_EQ(0, num_failure_); | 200 EXPECT_EQ(0, num_failure_); |
| 199 // The type of the SyntheticWebTouchEvent is the action of the last finger. | 201 // The type of the SyntheticWebTouchEvent is the action of the last finger. |
| 200 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); | 202 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); |
| 201 EXPECT_EQ(pointer_touch_target->indexes(0), 0); | 203 EXPECT_EQ(pointer_touch_target->indexes(0), 0); |
| 202 EXPECT_EQ(index_map_[0], 0); | 204 EXPECT_EQ(GetPointIndex(0), 0); |
| 203 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(133, 156)); | 205 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(133, 156)); |
| 204 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StateMoved); | 206 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StateMoved); |
| 205 EXPECT_EQ(pointer_touch_target->indexes(1), 1); | 207 EXPECT_EQ(pointer_touch_target->indexes(1), 1); |
| 206 EXPECT_EQ(index_map_[1], 1); | 208 EXPECT_EQ(GetPointIndex(1), 1); |
| 207 EXPECT_EQ(pointer_touch_target->positions(1), gfx::PointF(79, 132)); | 209 EXPECT_EQ(pointer_touch_target->positions(1), gfx::PointF(79, 132)); |
| 208 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed); | 210 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StatePressed); |
| 209 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); | 211 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); |
| 210 | 212 |
| 211 // Send a touch move for the second finger. | 213 // Send a touch move for the second finger. |
| 212 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); | 214 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); |
| 213 params1.set_pointer_action_type( | 215 params1.set_pointer_action_type( |
| 214 SyntheticPointerActionParams::PointerActionType::MOVE); | 216 SyntheticPointerActionParams::PointerActionType::MOVE); |
| 215 params1.set_position(gfx::PointF(87, 253)); | 217 params1.set_position(gfx::PointF(87, 253)); |
| 216 action_param_list_->push_back(params1); | 218 action_param_list_->push_back(params1); |
| 217 ForwardSyntheticPointerAction(); | 219 ForwardSyntheticPointerAction(); |
| 218 | 220 |
| 219 EXPECT_EQ(3, num_success_); | 221 EXPECT_EQ(3, num_success_); |
| 220 EXPECT_EQ(0, num_failure_); | 222 EXPECT_EQ(0, num_failure_); |
| 221 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove); | 223 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchMove); |
| 222 EXPECT_EQ(pointer_touch_target->indexes(1), 1); | 224 EXPECT_EQ(pointer_touch_target->indexes(1), 1); |
| 223 EXPECT_EQ(index_map_[1], 1); | 225 EXPECT_EQ(GetPointIndex(1), 1); |
| 224 EXPECT_EQ(pointer_touch_target->positions(1), gfx::PointF(87, 253)); | 226 EXPECT_EQ(pointer_touch_target->positions(1), gfx::PointF(87, 253)); |
| 225 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved); | 227 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateMoved); |
| 226 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); | 228 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); |
| 227 | 229 |
| 228 // Send touch releases for both fingers. | 230 // Send touch releases for both fingers. |
| 229 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); | 231 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); |
| 230 params0.set_pointer_action_type( | 232 params0.set_pointer_action_type( |
| 231 SyntheticPointerActionParams::PointerActionType::RELEASE); | 233 SyntheticPointerActionParams::PointerActionType::RELEASE); |
| 232 params1.set_pointer_action_type( | 234 params1.set_pointer_action_type( |
| 233 SyntheticPointerActionParams::PointerActionType::RELEASE); | 235 SyntheticPointerActionParams::PointerActionType::RELEASE); |
| 234 action_param_list_->push_back(params0); | 236 action_param_list_->push_back(params0); |
| 235 action_param_list_->push_back(params1); | 237 action_param_list_->push_back(params1); |
| 236 ForwardSyntheticPointerAction(); | 238 ForwardSyntheticPointerAction(); |
| 237 | 239 |
| 238 EXPECT_EQ(4, num_success_); | 240 EXPECT_EQ(4, num_success_); |
| 239 EXPECT_EQ(0, num_failure_); | 241 EXPECT_EQ(0, num_failure_); |
| 240 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd); | 242 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchEnd); |
| 241 EXPECT_EQ(pointer_touch_target->indexes(0), 0); | 243 EXPECT_EQ(pointer_touch_target->indexes(0), 0); |
| 242 EXPECT_EQ(index_map_[0], -1); | 244 EXPECT_EQ(GetPointIndex(0), -1); |
| 243 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StateReleased); | 245 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StateReleased); |
| 244 EXPECT_EQ(pointer_touch_target->indexes(1), 1); | 246 EXPECT_EQ(pointer_touch_target->indexes(1), 1); |
| 245 EXPECT_EQ(index_map_[1], -1); | 247 EXPECT_EQ(GetPointIndex(1), -1); |
| 246 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased); | 248 EXPECT_EQ(pointer_touch_target->states(1), WebTouchPoint::StateReleased); |
| 247 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); | 249 ASSERT_EQ(pointer_touch_target->touch_length(), 2U); |
| 248 } | 250 } |
| 249 | 251 |
| 250 TEST_F(SyntheticPointerActionTest, PointerTouchActionIndexInvalid) { | 252 TEST_F(SyntheticPointerActionTest, PointerTouchActionIndexInvalid) { |
| 251 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); | 253 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); |
| 252 | 254 |
| 253 // Users sent a wrong index for the touch action. | 255 // Users sent a wrong index for the touch action. |
| 254 SyntheticPointerActionParams params0 = SyntheticPointerActionParams( | 256 SyntheticPointerActionParams params0 = SyntheticPointerActionParams( |
| 255 SyntheticPointerActionParams::PointerActionType::PRESS); | 257 SyntheticPointerActionParams::PointerActionType::PRESS); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 266 params0.set_index(0); | 268 params0.set_index(0); |
| 267 action_param_list_->push_back(params0); | 269 action_param_list_->push_back(params0); |
| 268 ForwardSyntheticPointerAction(); | 270 ForwardSyntheticPointerAction(); |
| 269 | 271 |
| 270 MockSyntheticPointerTouchActionTarget* pointer_touch_target = | 272 MockSyntheticPointerTouchActionTarget* pointer_touch_target = |
| 271 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); | 273 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); |
| 272 EXPECT_EQ(1, num_success_); | 274 EXPECT_EQ(1, num_success_); |
| 273 EXPECT_EQ(1, num_failure_); | 275 EXPECT_EQ(1, num_failure_); |
| 274 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); | 276 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); |
| 275 EXPECT_EQ(pointer_touch_target->indexes(0), 0); | 277 EXPECT_EQ(pointer_touch_target->indexes(0), 0); |
| 276 EXPECT_EQ(index_map_[0], 0); | 278 EXPECT_EQ(GetPointIndex(0), 0); |
| 277 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); | 279 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); |
| 278 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); | 280 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); |
| 279 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); | 281 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); |
| 280 } | 282 } |
| 281 | 283 |
| 282 TEST_F(SyntheticPointerActionTest, PointerTouchActionSourceTypeInvalid) { | 284 TEST_F(SyntheticPointerActionTest, PointerTouchActionSourceTypeInvalid) { |
| 283 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); | 285 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); |
| 284 | 286 |
| 285 // Users' gesture source type does not match with the touch action. | 287 // Users' gesture source type does not match with the touch action. |
| 286 SyntheticPointerActionParams params0 = SyntheticPointerActionParams( | 288 SyntheticPointerActionParams params0 = SyntheticPointerActionParams( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 298 params0.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 300 params0.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| 299 action_param_list_->push_back(params0); | 301 action_param_list_->push_back(params0); |
| 300 ForwardSyntheticPointerAction(); | 302 ForwardSyntheticPointerAction(); |
| 301 | 303 |
| 302 MockSyntheticPointerTouchActionTarget* pointer_touch_target = | 304 MockSyntheticPointerTouchActionTarget* pointer_touch_target = |
| 303 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); | 305 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); |
| 304 EXPECT_EQ(1, num_success_); | 306 EXPECT_EQ(1, num_success_); |
| 305 EXPECT_EQ(1, num_failure_); | 307 EXPECT_EQ(1, num_failure_); |
| 306 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); | 308 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); |
| 307 EXPECT_EQ(pointer_touch_target->indexes(0), 0); | 309 EXPECT_EQ(pointer_touch_target->indexes(0), 0); |
| 308 EXPECT_EQ(index_map_[0], 0); | 310 EXPECT_EQ(GetPointIndex(0), 0); |
| 309 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); | 311 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); |
| 310 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); | 312 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); |
| 311 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); | 313 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); |
| 312 } | 314 } |
| 313 | 315 |
| 314 TEST_F(SyntheticPointerActionTest, PointerTouchActionTypeInvalid) { | 316 TEST_F(SyntheticPointerActionTest, PointerTouchActionTypeInvalid) { |
| 315 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); | 317 CreateSyntheticPointerActionTarget<MockSyntheticPointerTouchActionTarget>(); |
| 316 | 318 |
| 317 // Cannot send a touch move or touch release without sending a touch press | 319 // Cannot send a touch move or touch release without sending a touch press |
| 318 // first. | 320 // first. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 342 SyntheticPointerActionParams::PointerActionType::PRESS); | 344 SyntheticPointerActionParams::PointerActionType::PRESS); |
| 343 action_param_list_->push_back(params0); | 345 action_param_list_->push_back(params0); |
| 344 ForwardSyntheticPointerAction(); | 346 ForwardSyntheticPointerAction(); |
| 345 | 347 |
| 346 MockSyntheticPointerTouchActionTarget* pointer_touch_target = | 348 MockSyntheticPointerTouchActionTarget* pointer_touch_target = |
| 347 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); | 349 static_cast<MockSyntheticPointerTouchActionTarget*>(target_.get()); |
| 348 EXPECT_EQ(1, num_success_); | 350 EXPECT_EQ(1, num_success_); |
| 349 EXPECT_EQ(2, num_failure_); | 351 EXPECT_EQ(2, num_failure_); |
| 350 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); | 352 EXPECT_EQ(pointer_touch_target->type(), WebInputEvent::TouchStart); |
| 351 EXPECT_EQ(pointer_touch_target->indexes(0), 0); | 353 EXPECT_EQ(pointer_touch_target->indexes(0), 0); |
| 352 EXPECT_EQ(index_map_[0], 0); | 354 EXPECT_EQ(GetPointIndex(0), 0); |
| 353 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); | 355 EXPECT_EQ(pointer_touch_target->positions(0), gfx::PointF(54, 89)); |
| 354 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); | 356 EXPECT_EQ(pointer_touch_target->states(0), WebTouchPoint::StatePressed); |
| 355 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); | 357 ASSERT_EQ(pointer_touch_target->touch_length(), 1U); |
| 356 | 358 |
| 357 // Cannot send a touch press again without releasing the finger. | 359 // Cannot send a touch press again without releasing the finger. |
| 358 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); | 360 action_param_list_.reset(new std::vector<SyntheticPointerActionParams>()); |
| 359 params0.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 361 params0.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
| 360 params0.set_index(0); | 362 params0.set_index(0); |
| 361 params0.set_pointer_action_type( | 363 params0.set_pointer_action_type( |
| 362 SyntheticPointerActionParams::PointerActionType::PRESS); | 364 SyntheticPointerActionParams::PointerActionType::PRESS); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 action_param_list_->push_back(params); | 516 action_param_list_->push_back(params); |
| 515 ForwardSyntheticPointerAction(); | 517 ForwardSyntheticPointerAction(); |
| 516 | 518 |
| 517 EXPECT_EQ(2, num_success_); | 519 EXPECT_EQ(2, num_success_); |
| 518 EXPECT_EQ(2, num_failure_); | 520 EXPECT_EQ(2, num_failure_); |
| 519 } | 521 } |
| 520 | 522 |
| 521 } // namespace | 523 } // namespace |
| 522 | 524 |
| 523 } // namespace content | 525 } // namespace content |
| OLD | NEW |