Bug 1109677 - Ensure tests that use SetMayHaveTouchListeners work with event-regions enabled. r=botond

This commit is contained in:
Kartikaya Gupta 2014-12-14 21:37:51 -05:00
Родитель fa6d33ef79
Коммит 430339dfea
1 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

@ -135,6 +135,7 @@ public:
TestAPZCTreeManager* aTreeManager,
GestureBehavior aBehavior = DEFAULT_GESTURES)
: AsyncPanZoomController(aLayersId, aTreeManager, aTreeManager->GetInputQueue(), aMcc, aBehavior)
, mWaitForMainThread(false)
{}
nsEventStatus ReceiveInputEvent(const InputData& aEvent, ScrollableLayerGuid* aDummy, uint64_t* aOutInputBlockId) {
@ -146,13 +147,18 @@ public:
}
nsEventStatus ReceiveInputEvent(const InputData& aEvent, uint64_t* aOutInputBlockId) {
return GetInputQueue()->ReceiveInputEvent(this, true, aEvent, aOutInputBlockId);
return GetInputQueue()->ReceiveInputEvent(this, !mWaitForMainThread, aEvent, aOutInputBlockId);
}
void ContentReceivedInputBlock(uint64_t aInputBlockId, bool aPreventDefault) {
GetInputQueue()->ContentReceivedInputBlock(aInputBlockId, aPreventDefault);
}
void ConfirmTarget(uint64_t aInputBlockId) {
nsRefPtr<AsyncPanZoomController> target = this;
GetInputQueue()->SetConfirmedTargetApzc(aInputBlockId, target);
}
void SetAllowedTouchBehavior(uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aBehaviors) {
GetInputQueue()->SetAllowedTouchBehavior(aInputBlockId, aBehaviors);
}
@ -197,6 +203,13 @@ public:
aOutTransform, aScrollOffset);
return ret;
}
void SetWaitForMainThread() {
mWaitForMainThread = true;
}
private:
bool mWaitForMainThread;
};
AsyncPanZoomController*
@ -247,7 +260,7 @@ protected:
void SetMayHaveTouchListeners()
{
apzc->GetFrameMetrics().SetMayHaveTouchListeners(true);
apzc->SetWaitForMainThread();
}
void MakeApzcZoomable()
@ -2228,7 +2241,7 @@ TEST_F(APZOverscrollHandoffTester, DeferredInputEventProcessing) {
// Enable touch-listeners so that we can separate the queueing of input
// events from them being processed.
childApzc->GetFrameMetrics().SetMayHaveTouchListeners(true);
childApzc->SetWaitForMainThread();
// Queue input events for a pan.
int time = 0;
@ -2237,6 +2250,7 @@ TEST_F(APZOverscrollHandoffTester, DeferredInputEventProcessing) {
// Allow the pan to be processed.
childApzc->ContentReceivedInputBlock(blockId, false);
childApzc->ConfirmTarget(blockId);
// Make sure overscroll was handed off correctly.
EXPECT_EQ(50, childApzc->GetFrameMetrics().GetScrollOffset().y);
@ -2256,7 +2270,7 @@ TEST_F(APZOverscrollHandoffTester, LayerStructureChangesWhileEventsArePending) {
// Enable touch-listeners so that we can separate the queueing of input
// events from them being processed.
childApzc->GetFrameMetrics().SetMayHaveTouchListeners(true);
childApzc->SetWaitForMainThread();
// Queue input events for a pan.
int time = 0;
@ -2267,7 +2281,7 @@ TEST_F(APZOverscrollHandoffTester, LayerStructureChangesWhileEventsArePending) {
// between the child and the root.
CreateOverscrollHandoffLayerTree2();
nsRefPtr<Layer> middle = layers[1];
childApzc->GetFrameMetrics().SetMayHaveTouchListeners(true);
childApzc->SetWaitForMainThread();
TestAsyncPanZoomController* middleApzc = ApzcOf(middle);
// Queue input events for another pan.
@ -2276,6 +2290,7 @@ TEST_F(APZOverscrollHandoffTester, LayerStructureChangesWhileEventsArePending) {
// Allow the first pan to be processed.
childApzc->ContentReceivedInputBlock(blockId, false);
childApzc->ConfirmTarget(blockId);
// Make sure things have scrolled according to the handoff chain in
// place at the time the touch-start of the first pan was queued.
@ -2285,6 +2300,7 @@ TEST_F(APZOverscrollHandoffTester, LayerStructureChangesWhileEventsArePending) {
// Allow the second pan to be processed.
childApzc->ContentReceivedInputBlock(secondBlockId, false);
childApzc->ConfirmTarget(secondBlockId);
// Make sure things have scrolled according to the handoff chain in
// place at the time the touch-start of the second pan was queued.