Bug 1037019 - Remove the mTouchActionPropertyEnabled flag in APZC and flip the pref directly in the tests. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 11 Jul 2014 08:25:13 -0400
changeset 193583 9c78e399333bf703e71a74bf27cf320d5786e746
parent 193582 c109e4bd68acd46d02a33a97f04b2f0ad85dc371
child 193584 59467641b84df7f5a2c432a7e2ba2a9f33b66a87
push idunknown
push userunknown
push dateunknown
reviewersbotond
bugs1037019
milestone33.0a1
Bug 1037019 - Remove the mTouchActionPropertyEnabled flag in APZC and flip the pref directly in the tests. r=botond
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
gfx/tests/gtest/TestAsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -709,17 +709,16 @@ AsyncPanZoomController::AsyncPanZoomCont
                                                GeckoContentController* aGeckoContentController,
                                                GestureBehavior aGestures)
   :  mLayersId(aLayersId),
      mPaintThrottler(GetFrameTime()),
      mGeckoContentController(aGeckoContentController),
      mRefPtrMonitor("RefPtrMonitor"),
      mSharingFrameMetricsAcrossProcesses(false),
      mMonitor("AsyncPanZoomController"),
-     mTouchActionPropertyEnabled(gfxPrefs::TouchActionEnabled()),
      mState(NOTHING),
      mContentResponseTimeoutTask(nullptr),
      mX(MOZ_THIS_IN_INITIALIZER_LIST()),
      mY(MOZ_THIS_IN_INITIALIZER_LIST()),
      mPanDirRestricted(false),
      mZoomConstraints(false, false, MIN_ZOOM, MAX_ZOOM),
      mLastSampleTime(GetFrameTime()),
      mLastAsyncScrollTime(GetFrameTime()),
@@ -1006,17 +1005,17 @@ nsEventStatus AsyncPanZoomController::On
     case TOUCHING: {
       float panThreshold = GetTouchStartTolerance();
       UpdateWithTouchAtDevicePoint(aEvent);
 
       if (PanDistance() < panThreshold) {
         return nsEventStatus_eIgnore;
       }
 
-      if (mTouchActionPropertyEnabled &&
+      if (gfxPrefs::TouchActionEnabled() &&
           (GetTouchBehavior(0) & AllowedTouchBehavior::VERTICAL_PAN) &&
           (GetTouchBehavior(0) & AllowedTouchBehavior::HORIZONTAL_PAN)) {
         // User tries to trigger a touch behavior. If allowed touch behavior is vertical pan
         // + horizontal pan (touch-action value is equal to AUTO) we can return ConsumeNoDefault
         // status immediately to trigger cancel event further. It should happen independent of
         // the parent type (whether it is scrolling or not).
         StartPanning(aEvent);
         return nsEventStatus_eConsumeNoDefault;
@@ -1574,17 +1573,17 @@ nsEventStatus AsyncPanZoomController::St
   // When the touch move breaks through the pan threshold, reposition the touch down origin
   // so the page won't jump when we start panning.
   mX.StartTouch(point.x, aEvent.mTime);
   mY.StartTouch(point.y, aEvent.mTime);
 
   double angle = atan2(dy, dx); // range [-pi, pi]
   angle = fabs(angle); // range [0, pi]
 
-  if (mTouchActionPropertyEnabled) {
+  if (gfxPrefs::TouchActionEnabled()) {
     HandlePanningWithTouchAction(angle, GetTouchBehavior(0));
   } else {
     if (GetAxisLockMode() == FREE) {
       SetState(PANNING);
     } else {
       HandlePanning(angle);
     }
   }
@@ -2483,17 +2482,17 @@ void AsyncPanZoomController::ContentRece
 void AsyncPanZoomController::CheckContentResponse() {
   bool canProceedToTouchState = true;
 
   if (mFrameMetrics.mMayHaveTouchListeners ||
       mFrameMetrics.mMayHaveTouchCaret) {
     canProceedToTouchState &= mTouchBlockState.mPreventDefaultSet;
   }
 
-  if (mTouchActionPropertyEnabled) {
+  if (gfxPrefs::TouchActionEnabled()) {
     canProceedToTouchState &= mTouchBlockState.mAllowedTouchBehaviorSet;
   }
 
   if (!canProceedToTouchState) {
     return;
   }
 
   if (mContentResponseTimeoutTask) {
@@ -2522,31 +2521,31 @@ void AsyncPanZoomController::CheckConten
       mTouchQueue.RemoveElementAt(0);
     }
 
     mHandlingTouchQueue = false;
   }
 }
 
 bool AsyncPanZoomController::TouchActionAllowPinchZoom() {
-  if (!mTouchActionPropertyEnabled) {
+  if (!gfxPrefs::TouchActionEnabled()) {
     return true;
   }
   // Pointer events specification implies all touch points to allow zoom
   // to perform it.
   for (size_t i = 0; i < mTouchBlockState.mAllowedTouchBehaviors.Length(); i++) {
     if (!(mTouchBlockState.mAllowedTouchBehaviors[i] & AllowedTouchBehavior::PINCH_ZOOM)) {
       return false;
     }
   }
   return true;
 }
 
 bool AsyncPanZoomController::TouchActionAllowDoubleTapZoom() {
-  if (!mTouchActionPropertyEnabled) {
+  if (!gfxPrefs::TouchActionEnabled()) {
     return true;
   }
   for (size_t i = 0; i < mTouchBlockState.mAllowedTouchBehaviors.Length(); i++) {
     if (!(mTouchBlockState.mAllowedTouchBehaviors[i] & AllowedTouchBehavior::DOUBLE_TAP_ZOOM)) {
       return false;
     }
   }
   return true;
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -707,22 +707,16 @@ protected:
   // Before manipulating |mFrameMetrics| or |mLastContentPaintMetrics|, the
   // monitor should be held. When setting |mState|, either the SetState()
   // function can be used, or the monitor can be held and then |mState| updated.
   // IMPORTANT: See the note about lock ordering at the top of APZCTreeManager.h.
   // This is mutable to allow entering it from 'const' methods; doing otherwise
   // would significantly limit what methods could be 'const'.
   mutable ReentrantMonitor mMonitor;
 
-  // Specifies whether we should use touch-action css property. Initialized from
-  // the preferences. This property (in comparison with the global one) simplifies
-  // testing apzc with (and without) touch-action property enabled concurrently
-  // (e.g. with the gtest framework).
-  bool mTouchActionPropertyEnabled;
-
   // Stores the state of panning and zooming this frame. This is protected by
   // |mMonitor|; that is, it should be held whenever this is updated.
   PanZoomState mState;
 
 private:
   // Metrics of the container layer corresponding to this APZC. This is
   // stored here so that it is accessible from the UI/controller thread.
   // These are the metrics at last content paint, the most recent
--- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp
+++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp
@@ -42,16 +42,29 @@ protected:
 class APZCTreeManagerTester : public ::testing::Test {
 protected:
   virtual void SetUp() {
     gfxPrefs::GetSingleton();
     AsyncPanZoomController::SetThreadAssertionsEnabled(false);
   }
 };
 
+class TouchActionEnabledTester : public AsyncPanZoomControllerTester {
+protected:
+  virtual void SetUp() {
+    AsyncPanZoomControllerTester::SetUp();
+    gfxPrefs::SetTouchActionEnabled(true);
+  }
+
+  virtual void TearDown() {
+    gfxPrefs::SetTouchActionEnabled(false);
+    AsyncPanZoomControllerTester::TearDown();
+  }
+};
+
 class MockContentController : public GeckoContentController {
 public:
   MOCK_METHOD1(RequestContentRepaint, void(const FrameMetrics&));
   MOCK_METHOD2(AcknowledgeScrollUpdate, void(const FrameMetrics::ViewID&, const uint32_t& aScrollGeneration));
   MOCK_METHOD3(HandleDoubleTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
   MOCK_METHOD3(HandleSingleTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
   MOCK_METHOD3(HandleLongTap, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
   MOCK_METHOD3(HandleLongTapUp, void(const CSSPoint&, int32_t, const ScrollableLayerGuid&));
@@ -142,25 +155,16 @@ class TestAPZCContainerLayer : public Co
 class TestAsyncPanZoomController : public AsyncPanZoomController {
 public:
   TestAsyncPanZoomController(uint64_t aLayersId, MockContentController* aMcc,
                              APZCTreeManager* aTreeManager = nullptr,
                              GestureBehavior aBehavior = DEFAULT_GESTURES)
     : AsyncPanZoomController(aLayersId, aTreeManager, aMcc, aBehavior)
   {}
 
-  // Since touch-action-enabled property is global - setting it for each test
-  // separately isn't safe from the concurrency point of view. To make tests
-  // run concurrent and independent from each other we have a member variable
-  // mTouchActionEnabled for each apzc and setter defined here.
-  void SetTouchActionEnabled(const bool touchActionEnabled) {
-    ReentrantMonitorAutoEnter lock(mMonitor);
-    mTouchActionPropertyEnabled = touchActionEnabled;
-  }
-
   void SetFrameMetrics(const FrameMetrics& metrics) {
     ReentrantMonitorAutoEnter lock(mMonitor);
     mFrameMetrics = metrics;
   }
 
   FrameMetrics GetFrameMetrics() {
     ReentrantMonitorAutoEnter lock(mMonitor);
     return mFrameMetrics;
@@ -275,26 +279,25 @@ void ApzcPan(AsyncPanZoomController* apz
   status = apzc->ReceiveInputEvent(mti);
 
   // Since we've explicitly built the overscroll handoff chain before
   // touch-start, we need to explicitly clear it after touch-end.
   aTreeManager->ClearOverscrollHandoffChain();
 }
 
 static
-void DoPanTest(bool aShouldTriggerScroll, bool aShouldUseTouchAction, uint32_t aBehavior)
+void DoPanTest(bool aShouldTriggerScroll, uint32_t aBehavior)
 {
   TimeStamp testStartTime = TimeStamp::Now();
   AsyncPanZoomController::SetFrameTime(testStartTime);
 
   nsRefPtr<MockContentController> mcc = new NiceMock<MockContentController>();
   nsRefPtr<TestAPZCTreeManager> tm = new TestAPZCTreeManager();
   nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(0, mcc, tm);
 
-  apzc->SetTouchActionEnabled(aShouldUseTouchAction);
   apzc->SetFrameMetrics(TestFrameMetrics());
   apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
 
   if (aShouldTriggerScroll) {
     EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(AtLeast(1));
     EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
   } else {
     EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(0);
@@ -446,22 +449,16 @@ void DoPinchTest(bool aUseGestureRecogni
   if (aShouldTriggerPinch) {
     EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(AtLeast(1));
     EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
   } else {
     EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(AtMost(2));
     EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(0);
   }
 
-  if (aAllowedTouchBehaviors) {
-    apzc->SetTouchActionEnabled(true);
-  } else {
-    apzc->SetTouchActionEnabled(false);
-  }
-
   int touchInputId = 0;
   if (aUseGestureRecognizer) {
     ApzcPinchWithTouchMoveInput(apzc, 250, 300, 1.25, touchInputId, aShouldTriggerPinch, aAllowedTouchBehaviors);
   } else {
     ApzcPinchWithPinchInput(apzc, 250, 300, 1.25, aShouldTriggerPinch, aAllowedTouchBehaviors);
   }
 
   fm = apzc->GetFrameMetrics();
@@ -546,56 +543,56 @@ TEST_F(AsyncPanZoomControllerTester, Con
   nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(0, mcc);
   apzc->SetFrameMetrics(TestFrameMetrics());
 }
 
 TEST_F(AsyncPanZoomControllerTester, Pinch_DefaultGestures_NoTouchAction) {
   DoPinchTest(false, true);
 }
 
-TEST_F(AsyncPanZoomControllerTester, Pinch_DefaultGestures_TouchActionNone) {
+TEST_F(TouchActionEnabledTester, Pinch_DefaultGestures_TouchActionNone) {
   nsTArray<uint32_t> behaviors;
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::NONE);
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::NONE);
   DoPinchTest(false, false, &behaviors);
 }
 
-TEST_F(AsyncPanZoomControllerTester, Pinch_DefaultGestures_TouchActionZoom) {
+TEST_F(TouchActionEnabledTester, Pinch_DefaultGestures_TouchActionZoom) {
   nsTArray<uint32_t> behaviors;
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
   DoPinchTest(false, true, &behaviors);
 }
 
-TEST_F(AsyncPanZoomControllerTester, Pinch_DefaultGestures_TouchActionNotAllowZoom) {
+TEST_F(TouchActionEnabledTester, Pinch_DefaultGestures_TouchActionNotAllowZoom) {
   nsTArray<uint32_t> behaviors;
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
   DoPinchTest(false, false, &behaviors);
 }
 
 TEST_F(AsyncPanZoomControllerTester, Pinch_UseGestureDetector_NoTouchAction) {
   DoPinchTest(true, true);
 }
 
-TEST_F(AsyncPanZoomControllerTester, Pinch_UseGestureDetector_TouchActionNone) {
+TEST_F(TouchActionEnabledTester, Pinch_UseGestureDetector_TouchActionNone) {
   nsTArray<uint32_t> behaviors;
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::NONE);
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::NONE);
   DoPinchTest(true, false, &behaviors);
 }
 
-TEST_F(AsyncPanZoomControllerTester, Pinch_UseGestureDetector_TouchActionZoom) {
+TEST_F(TouchActionEnabledTester, Pinch_UseGestureDetector_TouchActionZoom) {
   nsTArray<uint32_t> behaviors;
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
   DoPinchTest(true, true, &behaviors);
 }
 
-TEST_F(AsyncPanZoomControllerTester, Pinch_UseGestureDetector_TouchActionNotAllowZoom) {
+TEST_F(TouchActionEnabledTester, Pinch_UseGestureDetector_TouchActionNotAllowZoom) {
   nsTArray<uint32_t> behaviors;
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
   behaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
   DoPinchTest(true, false, &behaviors);
 }
 
 TEST_F(AsyncPanZoomControllerTester, Overzoom) {
   nsRefPtr<MockContentController> mcc = new NiceMock<MockContentController>();
@@ -740,42 +737,42 @@ TEST_F(AsyncPanZoomControllerTester, Com
   childMetrics.ZoomBy(1.5f);
   childApzc->SetFrameMetrics(childMetrics);
   childApzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut);
   EXPECT_EQ(ViewTransform(LayerPoint(-30, 0), ParentLayerToScreenScale(3)), viewTransformOut);
   EXPECT_EQ(ScreenPoint(135, 90), pointOut);
 }
 
 TEST_F(AsyncPanZoomControllerTester, Pan) {
-  DoPanTest(true, false, mozilla::layers::AllowedTouchBehavior::NONE);
+  DoPanTest(true, mozilla::layers::AllowedTouchBehavior::NONE);
 }
 
 // In the each of the following 4 pan tests we are performing two pan gestures: vertical pan from top
 // to bottom and back - from bottom to top.
 // According to the pointer-events/touch-action spec AUTO and PAN_Y touch-action values allow vertical
 // scrolling while NONE and PAN_X forbid it. The first parameter of DoPanTest method specifies this
 // behavior.
-TEST_F(AsyncPanZoomControllerTester, PanWithTouchActionAuto) {
-  DoPanTest(true, true,
-            mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
+TEST_F(TouchActionEnabledTester, PanWithTouchActionAuto) {
+  DoPanTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
+                  | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
 }
 
-TEST_F(AsyncPanZoomControllerTester, PanWithTouchActionNone) {
-  DoPanTest(false, true, 0);
+TEST_F(TouchActionEnabledTester, PanWithTouchActionNone) {
+  DoPanTest(false, 0);
 }
 
-TEST_F(AsyncPanZoomControllerTester, PanWithTouchActionPanX) {
-  DoPanTest(false, true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN);
+TEST_F(TouchActionEnabledTester, PanWithTouchActionPanX) {
+  DoPanTest(false, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN);
 }
 
-TEST_F(AsyncPanZoomControllerTester, PanWithTouchActionPanY) {
-  DoPanTest(true, true, mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
+TEST_F(TouchActionEnabledTester, PanWithTouchActionPanY) {
+  DoPanTest(true, mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
 }
 
-TEST_F(AsyncPanZoomControllerTester, PanWithPreventDefault) {
+TEST_F(TouchActionEnabledTester, PanWithPreventDefault) {
   TimeStamp testStartTime = TimeStamp::Now();
   AsyncPanZoomController::SetFrameTime(testStartTime);
 
   nsRefPtr<MockContentController> mcc = new NiceMock<MockContentController>();
   nsRefPtr<TestAPZCTreeManager> tm = new TestAPZCTreeManager();
   nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(0, mcc, tm);
 
   FrameMetrics frameMetrics(TestFrameMetrics());
@@ -788,17 +785,16 @@ TEST_F(AsyncPanZoomControllerTester, Pan
   int touchStart = 50;
   int touchEnd = 10;
   ScreenPoint pointOut;
   ViewTransform viewTransformOut;
 
   // Pan down
   nsTArray<uint32_t> allowedTouchBehaviors;
   allowedTouchBehaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN);
-  apzc->SetTouchActionEnabled(true);
   ApzcPan(apzc, tm, time, touchStart, touchEnd, true, true, &allowedTouchBehaviors);
 
   // Send the signal that content has handled and preventDefaulted the touch
   // events. This flushes the event queue.
   apzc->ContentReceivedTouch(true);
 
   apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut);
   EXPECT_EQ(ScreenPoint(), pointOut);
@@ -1037,28 +1033,26 @@ TEST_F(AsyncPanZoomControllerTester, Med
   EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1);
   mcc->RunDelayedTask();
 
   apzc->AssertStateIsReset();
   apzc->Destroy();
 }
 
 void
-DoLongPressTest(bool aShouldUseTouchAction, uint32_t aBehavior) {
+DoLongPressTest(uint32_t aBehavior) {
   nsRefPtr<MockContentControllerDelayed> mcc = new MockContentControllerDelayed();
   nsRefPtr<TestAPZCTreeManager> tm = new TestAPZCTreeManager();
   nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(
     0, mcc, tm, AsyncPanZoomController::USE_GESTURE_DETECTOR);
 
   apzc->SetFrameMetrics(TestFrameMetrics());
   apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
   apzc->UpdateZoomConstraints(ZoomConstraints(false, false, CSSToScreenScale(1.0), CSSToScreenScale(1.0)));
 
-  apzc->SetTouchActionEnabled(aShouldUseTouchAction);
-
   int time = 0;
 
   nsEventStatus status = ApzcDown(apzc, 10, 10, time);
   EXPECT_EQ(nsEventStatus_eConsumeNoDefault, status);
 
   // SetAllowedTouchBehavior() must be called after sending touch-start.
   nsTArray<uint32_t> allowedTouchBehaviors;
   allowedTouchBehaviors.AppendElement(aBehavior);
@@ -1107,35 +1101,33 @@ DoLongPressTest(bool aShouldUseTouchActi
   apzc->ContentReceivedTouch(false);
   check.Call("postHandleLongTapUp");
 
   apzc->AssertStateIsReset();
   apzc->Destroy();
 }
 
 void
-DoLongPressPreventDefaultTest(bool aShouldUseTouchAction, uint32_t aBehavior) {
+DoLongPressPreventDefaultTest(uint32_t aBehavior) {
   // We have to initialize both an integer time and TimeStamp time because
   // TimeStamp doesn't have any ToXXX() functions for converting back to
   // primitives.
   TimeStamp testStartTime = TimeStamp::Now();
   int time = 0;
   AsyncPanZoomController::SetFrameTime(testStartTime);
 
   nsRefPtr<MockContentControllerDelayed> mcc = new MockContentControllerDelayed();
   nsRefPtr<TestAPZCTreeManager> tm = new TestAPZCTreeManager();
   nsRefPtr<TestAsyncPanZoomController> apzc = new TestAsyncPanZoomController(
     0, mcc, tm, AsyncPanZoomController::USE_GESTURE_DETECTOR);
 
   apzc->SetFrameMetrics(TestFrameMetrics());
   apzc->NotifyLayersUpdated(TestFrameMetrics(), true);
   apzc->UpdateZoomConstraints(ZoomConstraints(false, false, CSSToScreenScale(1.0), CSSToScreenScale(1.0)));
 
-  apzc->SetTouchActionEnabled(aShouldUseTouchAction);
-
   EXPECT_CALL(*mcc, SendAsyncScrollDOMEvent(_,_,_)).Times(0);
   EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(0);
 
   int touchX = 10,
       touchStartY = 10,
       touchEndY = 50;
 
   nsEventStatus status = ApzcDown(apzc, touchX, touchStartY, time);
@@ -1195,33 +1187,33 @@ DoLongPressPreventDefaultTest(bool aShou
   EXPECT_EQ(ScreenPoint(), pointOut);
   EXPECT_EQ(ViewTransform(), viewTransformOut);
 
   apzc->AssertStateIsReset();
   apzc->Destroy();
 }
 
 TEST_F(AsyncPanZoomControllerTester, LongPress) {
-  DoLongPressTest(false, mozilla::layers::AllowedTouchBehavior::NONE);
+  DoLongPressTest(mozilla::layers::AllowedTouchBehavior::NONE);
 }
 
-TEST_F(AsyncPanZoomControllerTester, LongPressWithTouchAction) {
-  DoLongPressTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
-                      | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
-                      | mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
+TEST_F(TouchActionEnabledTester, LongPressWithTouchAction) {
+  DoLongPressTest(mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
+                  | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
+                  | mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
 }
 
 TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
-  DoLongPressPreventDefaultTest(false, mozilla::layers::AllowedTouchBehavior::NONE);
+  DoLongPressPreventDefaultTest(mozilla::layers::AllowedTouchBehavior::NONE);
 }
 
-TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefaultWithTouchAction) {
-  DoLongPressPreventDefaultTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
-                                    | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
-                                    | mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
+TEST_F(TouchActionEnabledTester, LongPressPreventDefaultWithTouchAction) {
+  DoLongPressPreventDefaultTest(mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
+                                | mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
+                                | mozilla::layers::AllowedTouchBehavior::PINCH_ZOOM);
 }
 
 // Layer tree for HitTesting1
 static already_AddRefed<mozilla::layers::Layer>
 CreateTestLayerTree1(nsRefPtr<LayerManager>& aLayerManager, nsTArray<nsRefPtr<Layer> >& aLayers) {
   const char* layerTreeSyntax = "c(ttcc)";
   // LayerID                     0 1234
   nsIntRegion layerVisibleRegion[] = {