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

Unified Diff: content/browser/renderer_host/input/touch_action_filter_unittest.cc

Issue 1422513006: Simplify TouchAction enum to be a simple bit flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix computed style / layout tests and CR feedback Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/input/touch_action_filter.cc ('k') | content/common/input/touch_action.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/touch_action_filter_unittest.cc
diff --git a/content/browser/renderer_host/input/touch_action_filter_unittest.cc b/content/browser/renderer_host/input/touch_action_filter_unittest.cc
index c435d1e67e81fdbbd23ecdb97aea833b2e2d43ff..a114b79f7db599f7bf9899f52db435f616e0720d 100644
--- a/content/browser/renderer_host/input/touch_action_filter_unittest.cc
+++ b/content/browser/renderer_host/input/touch_action_filter_unittest.cc
@@ -299,7 +299,7 @@ TEST(TouchActionFilterTest, PanXY) {
{
// Scrolls hinted in the X axis are permitted and unmodified.
filter.ResetTouchAction();
- filter.OnSetTouchAction(TOUCH_ACTION_PAN_X_Y);
+ filter.OnSetTouchAction(TOUCH_ACTION_PAN);
WebGestureEvent scroll_begin =
SyntheticWebGestureEventBuilder::BuildScrollBegin(-7, 6);
EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin));
@@ -321,7 +321,7 @@ TEST(TouchActionFilterTest, PanXY) {
{
// Scrolls hinted in the Y axis are permitted and unmodified.
filter.ResetTouchAction();
- filter.OnSetTouchAction(TOUCH_ACTION_PAN_X_Y);
+ filter.OnSetTouchAction(TOUCH_ACTION_PAN);
WebGestureEvent scroll_begin =
SyntheticWebGestureEventBuilder::BuildScrollBegin(-6, 7);
EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin));
@@ -342,25 +342,17 @@ TEST(TouchActionFilterTest, PanXY) {
filter.ResetTouchAction();
}
-TEST(TouchActionFilterTest, Intersect) {
- EXPECT_EQ(TOUCH_ACTION_NONE,
- TouchActionFilter::Intersect(TOUCH_ACTION_NONE, TOUCH_ACTION_AUTO));
- EXPECT_EQ(TOUCH_ACTION_NONE,
- TouchActionFilter::Intersect(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE));
- EXPECT_EQ(TOUCH_ACTION_PAN_X,
- TouchActionFilter::Intersect(TOUCH_ACTION_AUTO, TOUCH_ACTION_PAN_X));
- EXPECT_EQ(TOUCH_ACTION_PAN_Y,
- TouchActionFilter::Intersect(TOUCH_ACTION_PAN_Y, TOUCH_ACTION_AUTO));
+TEST(TouchActionFilterTest, BitMath) {
+ // Verify that the simple flag mixing properties we depend on are now
+ // trivially true.
+ EXPECT_EQ(TOUCH_ACTION_NONE, TOUCH_ACTION_NONE & TOUCH_ACTION_AUTO);
+ EXPECT_EQ(TOUCH_ACTION_NONE, TOUCH_ACTION_PAN_Y & TOUCH_ACTION_PAN_X);
+ EXPECT_EQ(TOUCH_ACTION_PAN, TOUCH_ACTION_AUTO & TOUCH_ACTION_PAN);
+ EXPECT_EQ(TOUCH_ACTION_MANIPULATION,
+ TOUCH_ACTION_AUTO & ~TOUCH_ACTION_DOUBLE_TAP_ZOOM);
+ EXPECT_EQ(TOUCH_ACTION_PAN_X, TOUCH_ACTION_PAN_LEFT | TOUCH_ACTION_PAN_RIGHT);
EXPECT_EQ(TOUCH_ACTION_AUTO,
- TouchActionFilter::Intersect(TOUCH_ACTION_AUTO, TOUCH_ACTION_AUTO));
- EXPECT_EQ(TOUCH_ACTION_PAN_X,
- TouchActionFilter::Intersect(TOUCH_ACTION_PAN_X_Y, TOUCH_ACTION_PAN_X));
- EXPECT_EQ(TOUCH_ACTION_PAN_Y,
- TouchActionFilter::Intersect(TOUCH_ACTION_PAN_Y, TOUCH_ACTION_PAN_X_Y));
- EXPECT_EQ(TOUCH_ACTION_PAN_X_Y,
- TouchActionFilter::Intersect(TOUCH_ACTION_PAN_X_Y, TOUCH_ACTION_AUTO));
- EXPECT_EQ(TOUCH_ACTION_NONE,
- TouchActionFilter::Intersect(TOUCH_ACTION_PAN_X, TOUCH_ACTION_PAN_Y));
+ TOUCH_ACTION_MANIPULATION | TOUCH_ACTION_DOUBLE_TAP_ZOOM);
}
TEST(TouchActionFilterTest, MultiTouch) {
@@ -391,7 +383,7 @@ TEST(TouchActionFilterTest, MultiTouch) {
filter.ResetTouchAction();
filter.OnSetTouchAction(TOUCH_ACTION_PAN_X);
filter.OnSetTouchAction(TOUCH_ACTION_PAN_Y);
- filter.OnSetTouchAction(TOUCH_ACTION_PAN_X_Y);
+ filter.OnSetTouchAction(TOUCH_ACTION_PAN);
EXPECT_TRUE(filter.FilterGestureEvent(&scroll_begin));
EXPECT_TRUE(filter.FilterGestureEvent(&scroll_update));
EXPECT_TRUE(filter.FilterGestureEvent(&scroll_end));
@@ -433,7 +425,7 @@ TEST(TouchActionFilterTest, Pinch) {
// Pinch is not allowed with touch-action: pan-x pan-y.
filter.ResetTouchAction();
- filter.OnSetTouchAction(TOUCH_ACTION_PAN_X_Y);
+ filter.OnSetTouchAction(TOUCH_ACTION_PAN);
EXPECT_FALSE(filter.FilterGestureEvent(&scroll_begin));
EXPECT_TRUE(filter.FilterGestureEvent(&pinch_begin));
EXPECT_TRUE(filter.FilterGestureEvent(&pinch_update));
« no previous file with comments | « content/browser/renderer_host/input/touch_action_filter.cc ('k') | content/common/input/touch_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698