Bug 996457 - Make apzc's LongPressPreventDefault test consider the touch action property. r=kats

This commit is contained in:
Maksim Lebedev 2014-04-21 11:30:15 -04:00
parent b3091b5932
commit 6a9480940b

View File

@ -813,7 +813,8 @@ DoLongPressTest(bool aShouldUseTouchAction, uint32_t aBehavior) {
apzc->Destroy();
}
TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
void
DoLongPressPreventDefaultTest(bool aShouldUseTouchAction, 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.
@ -830,6 +831,8 @@ TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
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);
@ -840,6 +843,11 @@ TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
nsEventStatus status = ApzcDown(apzc, touchX, touchStartY, time);
EXPECT_EQ(nsEventStatus_eConsumeNoDefault, status);
// SetAllowedTouchBehavior() must be called after sending touch-start.
nsTArray<uint32_t> allowedTouchBehaviors;
allowedTouchBehaviors.AppendElement(aBehavior);
apzc->SetAllowedTouchBehavior(allowedTouchBehaviors);
MockFunction<void(std::string checkPointName)> check;
{
@ -895,12 +903,21 @@ TEST_F(AsyncPanZoomControllerTester, LongPress) {
DoLongPressTest(false, mozilla::layers::AllowedTouchBehavior::NONE);
}
TEST_F(AsyncPanZoomControllerTester, LongPressPanAndZoom) {
TEST_F(AsyncPanZoomControllerTester, LongPressWithTouchAction) {
DoLongPressTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
| mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
| mozilla::layers::AllowedTouchBehavior::ZOOM);
}
TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
DoLongPressPreventDefaultTest(false, mozilla::layers::AllowedTouchBehavior::NONE);
}
TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefaultWithTouchAction) {
DoLongPressPreventDefaultTest(true, mozilla::layers::AllowedTouchBehavior::HORIZONTAL_PAN
| mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN
| mozilla::layers::AllowedTouchBehavior::ZOOM);
}
// Layer tree for HitTesting1
static already_AddRefed<mozilla::layers::Layer>