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

Side by Side Diff: content/browser/renderer_host/input/touch_action_filter_unittest.cc

Issue 250923004: Synthesize ctrl-wheel events on touchpad pinch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ensure scales never coalesce to 0 or Infinity Created 6 years, 7 months 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 | Annotate | Revision Log
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/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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698