| 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/browser/renderer_host/input/touch_action_filter.h" | 5 #include "content/browser/renderer_host/input/touch_action_filter.h" |
| 6 #include "content/common/input/synthetic_web_input_event_builders.h" | 6 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 7 #include "content/port/browser/event_with_latency_info.h" | 7 #include "content/port/browser/event_with_latency_info.h" |
| 8 #include "content/port/common/input_event_ack_state.h" | 8 #include "content/port/common/input_event_ack_state.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 | 376 |
| 377 TEST(TouchActionFilterTest, Pinch) { | 377 TEST(TouchActionFilterTest, Pinch) { |
| 378 TouchActionFilter filter; | 378 TouchActionFilter filter; |
| 379 | 379 |
| 380 WebGestureEvent scroll_begin = | 380 WebGestureEvent scroll_begin = |
| 381 SyntheticWebGestureEventBuilder::BuildScrollBegin(2, 3); | 381 SyntheticWebGestureEventBuilder::BuildScrollBegin(2, 3); |
| 382 WebGestureEvent pinch_begin = SyntheticWebGestureEventBuilder::Build( | 382 WebGestureEvent pinch_begin = SyntheticWebGestureEventBuilder::Build( |
| 383 WebInputEvent::GesturePinchBegin, WebGestureEvent::Touchscreen); | 383 WebInputEvent::GesturePinchBegin, WebGestureEvent::Touchscreen); |
| 384 WebGestureEvent pinch_update = | 384 WebGestureEvent pinch_update = |
| 385 SyntheticWebGestureEventBuilder::BuildPinchUpdate(1.2f, 5, 5, 0); | 385 SyntheticWebGestureEventBuilder::BuildPinchUpdate( |
| 386 1.2f, 5, 5, 0, WebGestureEvent::Touchscreen); |
| 386 WebGestureEvent pinch_end = SyntheticWebGestureEventBuilder::Build( | 387 WebGestureEvent pinch_end = SyntheticWebGestureEventBuilder::Build( |
| 387 WebInputEvent::GesturePinchEnd, WebGestureEvent::Touchscreen); | 388 WebInputEvent::GesturePinchEnd, WebGestureEvent::Touchscreen); |
| 388 WebGestureEvent scroll_end = SyntheticWebGestureEventBuilder::Build( | 389 WebGestureEvent scroll_end = SyntheticWebGestureEventBuilder::Build( |
| 389 WebInputEvent::GestureScrollEnd, WebGestureEvent::Touchscreen); | 390 WebInputEvent::GestureScrollEnd, WebGestureEvent::Touchscreen); |
| 390 | 391 |
| 391 // Pinch is allowed with touch-action: auto. | 392 // Pinch is allowed with touch-action: auto. |
| 392 filter.ResetTouchAction(); | 393 filter.ResetTouchAction(); |
| 393 filter.OnSetTouchAction(TOUCH_ACTION_AUTO); | 394 filter.OnSetTouchAction(TOUCH_ACTION_AUTO); |
| 394 EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin)); | 395 EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin)); |
| 395 EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin)); | 396 EXPECT_FALSE(filter.FilterGestureEvent(&pinch_begin)); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 585 |
| 585 filter.ResetTouchAction(); | 586 filter.ResetTouchAction(); |
| 586 filter.OnSetTouchAction(TOUCH_ACTION_NONE); | 587 filter.OnSetTouchAction(TOUCH_ACTION_NONE); |
| 587 EXPECT_FALSE(filter.FilterGestureEvent(&tap)); | 588 EXPECT_FALSE(filter.FilterGestureEvent(&tap)); |
| 588 | 589 |
| 589 filter.ResetTouchAction(); | 590 filter.ResetTouchAction(); |
| 590 EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin)); | 591 EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin)); |
| 591 } | 592 } |
| 592 | 593 |
| 593 } // namespace content | 594 } // namespace content |
| OLD | NEW |