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

Unified Diff: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp

Issue 1577263004: Communicate whether passive event listeners exist to cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners
Patch Set: Rebase Created 4 years, 10 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
Index: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index 84c605e535bc4e18c5b69a84191e127d791c017f..e113df1fddcb0facc4b4c6fd45a3ca38378be852 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -126,7 +126,8 @@ TEST_F(ScrollingCoordinatorTest, fastScrollingByDefault)
WebLayer* rootScrollLayer = getRootScrollLayer();
ASSERT_TRUE(rootScrollLayer->scrollable());
ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread());
- ASSERT_FALSE(webLayerTreeView()->haveWheelEventHandlers());
+ ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::Touch));
+ ASSERT_EQ(WebEventListenerProperties::Nothing, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::MouseWheel));
}
TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting)
@@ -306,13 +307,58 @@ TEST_F(ScrollingCoordinatorTest, fastScrollingForFixedPosition)
}
}
+TEST_F(ScrollingCoordinatorTest, touchEventHandler)
+{
+ registerMockedHttpURLLoad("touch-event-handler.html");
+ navigateTo(m_baseURL + "touch-event-handler.html");
+ forceFullCompositingUpdate();
+
+ ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::Touch));
+}
+
+TEST_F(ScrollingCoordinatorTest, touchEventHandlerPassive)
+{
+ registerMockedHttpURLLoad("touch-event-handler-passive.html");
+ navigateTo(m_baseURL + "touch-event-handler-passive.html");
+ forceFullCompositingUpdate();
+
+ ASSERT_EQ(WebEventListenerProperties::Passive, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::Touch));
+}
+
+TEST_F(ScrollingCoordinatorTest, touchEventHandlerBoth)
+{
+ registerMockedHttpURLLoad("touch-event-handler-both.html");
+ navigateTo(m_baseURL + "touch-event-handler-both.html");
+ forceFullCompositingUpdate();
+
+ ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::Touch));
+}
+
TEST_F(ScrollingCoordinatorTest, wheelEventHandler)
{
registerMockedHttpURLLoad("wheel-event-handler.html");
navigateTo(m_baseURL + "wheel-event-handler.html");
forceFullCompositingUpdate();
- ASSERT_TRUE(webLayerTreeView()->haveWheelEventHandlers());
+ ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::MouseWheel));
+}
+
+TEST_F(ScrollingCoordinatorTest, wheelEventHandlerPassive)
+{
+ registerMockedHttpURLLoad("wheel-event-handler-passive.html");
+ navigateTo(m_baseURL + "wheel-event-handler-passive.html");
+ forceFullCompositingUpdate();
+
+ ASSERT_EQ(WebEventListenerProperties::Passive, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::MouseWheel));
+}
+
+TEST_F(ScrollingCoordinatorTest, wheelEventHandlerBoth)
+{
+ registerMockedHttpURLLoad("wheel-event-handler-both.html");
+ navigateTo(m_baseURL + "wheel-event-handler-both.html");
+ forceFullCompositingUpdate();
+
+ ASSERT_EQ(WebEventListenerProperties::Blocking, webLayerTreeView()->eventListenerProperties(WebEventListenerClass::MouseWheel));
}
TEST_F(ScrollingCoordinatorTest, scrollEventHandler)

Powered by Google App Engine
This is Rietveld 408576698