Chromium Code Reviews| Index: content/shell/renderer/test_runner/event_sender.cc |
| diff --git a/content/shell/renderer/test_runner/event_sender.cc b/content/shell/renderer/test_runner/event_sender.cc |
| index e02fe0cef1c2ca25679949bc5cd748cdb726e9ee..ed033bf2266df66f6fbbf512ab5445ee2f97daff 100644 |
| --- a/content/shell/renderer/test_runner/event_sender.cc |
| +++ b/content/shell/renderer/test_runner/event_sender.cc |
| @@ -376,8 +376,9 @@ class EventSenderBindings : public gin::Wrappable<EventSenderBindings> { |
| void SetPageScaleFactorLimits(gin::Arguments* args); |
| void ClearTouchPoints(); |
| void ReleaseTouchPoint(unsigned index); |
| - void UpdateTouchPoint(unsigned index, double x, double y); |
| + void UpdateTouchPoint(gin::Arguments* args); |
| void CancelTouchPoint(unsigned index); |
| + void SetTouchPointTilt(unsigned index, float tils, float tiltDirection); |
| void SetTouchModifier(const std::string& key_name, bool set_mask); |
| void SetTouchCancelable(bool cancelable); |
| void DumpFilenameBeingDragged(); |
| @@ -508,6 +509,7 @@ EventSenderBindings::GetObjectTemplateBuilder(v8::Isolate* isolate) { |
| .SetMethod("releaseTouchPoint", &EventSenderBindings::ReleaseTouchPoint) |
| .SetMethod("updateTouchPoint", &EventSenderBindings::UpdateTouchPoint) |
| .SetMethod("cancelTouchPoint", &EventSenderBindings::CancelTouchPoint) |
| + .SetMethod("setTouchPointTilt", &EventSenderBindings::SetTouchPointTilt) |
| .SetMethod("setTouchModifier", &EventSenderBindings::SetTouchModifier) |
| .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) |
| .SetMethod("dumpFilenameBeingDragged", |
| @@ -686,9 +688,9 @@ void EventSenderBindings::ReleaseTouchPoint(unsigned index) { |
| sender_->ReleaseTouchPoint(index); |
| } |
| -void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) { |
| +void EventSenderBindings::UpdateTouchPoint(gin::Arguments* args) { |
| if (sender_) |
| - sender_->UpdateTouchPoint(index, static_cast<float>(x), static_cast<float>(y)); |
| + sender_->UpdateTouchPoint(args); |
| } |
| void EventSenderBindings::CancelTouchPoint(unsigned index) { |
| @@ -696,6 +698,13 @@ void EventSenderBindings::CancelTouchPoint(unsigned index) { |
| sender_->CancelTouchPoint(index); |
| } |
| +void EventSenderBindings::SetTouchPointTilt(unsigned index, |
| + float tilt, |
| + float tiltDirection) { |
| + if (sender_) |
| + sender_->SetTouchPointTilt(index, tilt, tiltDirection); |
| +} |
| + |
| void EventSenderBindings::SetTouchModifier(const std::string& key_name, |
| bool set_mask) { |
| if (sender_) |
| @@ -1535,7 +1544,16 @@ void EventSender::ReleaseTouchPoint(unsigned index) { |
| touch_point->state = WebTouchPoint::StateReleased; |
| } |
| -void EventSender::UpdateTouchPoint(unsigned index, float x, float y) { |
| +void EventSender::UpdateTouchPoint(gin::Arguments* args) { |
| + unsigned index; |
| + float x; |
| + float y; |
| + |
| + if (!args->GetNext(&index) || !args->GetNext(&x) || !args->GetNext(&y)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + |
| if (index >= touch_points_.size()) { |
| ThrowTouchPointError(); |
| return; |
| @@ -1545,6 +1563,20 @@ void EventSender::UpdateTouchPoint(unsigned index, float x, float y) { |
| touch_point->state = WebTouchPoint::StateMoved; |
| touch_point->position = WebFloatPoint(x, y); |
| touch_point->screenPosition = touch_point->position; |
| + |
| + if (!args->PeekNext().IsEmpty()) { |
|
Rick Byers
2015/03/05 15:01:02
Is there a good reason to allow tilt to be set two
d.pikalov
2015/03/09 13:39:50
Done.
|
| + if (!args->GetNext(&touch_point->tilt)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + } |
| + |
| + if (!args->PeekNext().IsEmpty()) { |
| + if (!args->GetNext(&touch_point->tiltDirection)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + } |
| } |
| void EventSender::CancelTouchPoint(unsigned index) { |
| @@ -1557,6 +1589,20 @@ void EventSender::CancelTouchPoint(unsigned index) { |
| touch_point->state = WebTouchPoint::StateCancelled; |
| } |
| +void EventSender::SetTouchPointTilt(unsigned index, |
| + float tilt, |
| + float tiltDirection) { |
| + if (index >= touch_points_.size()) { |
| + ThrowTouchPointError(); |
| + return; |
| + } |
| + |
| + WebTouchPoint* touch_point = &touch_points_[index]; |
| + touch_point->tilt = tilt; |
| + touch_point->tiltDirection = tiltDirection; |
| + touch_point->state = WebTouchPoint::StateMoved; |
| +} |
| + |
| void EventSender::SetTouchModifier(const std::string& key_name, |
| bool set_mask) { |
| int mask = 0; |
| @@ -1721,6 +1767,20 @@ void EventSender::AddTouchPoint(gin::Arguments* args) { |
| touch_point.radiusY = static_cast<float>(radius_y); |
| } |
| + if (!args->PeekNext().IsEmpty()) { |
| + if (!args->GetNext(&touch_point.tilt)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + } |
| + |
| + if (!args->PeekNext().IsEmpty()) { |
| + if (!args->GetNext(&touch_point.tiltDirection)) { |
| + args->ThrowError(); |
| + return; |
| + } |
| + } |
| + |
| int lowest_id = 0; |
| for (size_t i = 0; i < touch_points_.size(); i++) { |
| if (touch_points_[i].id == lowest_id) |