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

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

Issue 2676923002: End-to-end prototype of compositor scrolling with slimming paint v2 (Closed)
Patch Set: Add SPV2 test of didScroll callback Created 3 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/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index d123a03ceffb17247de312433aaba890b5e7b4b9..2abd2a8c1af70d901d9ac20f07b6a769fa4dc000 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -6748,7 +6748,21 @@ class TestScrolledFrameClient : public FrameTestHelpers::TestWebFrameClient {
bool m_didScrollFrame;
};
-TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) {
+// TODO(pdr): Merge WebFrameTestForSpv1AndSpv2 and ParameterizedWebFrameTest so
+// more tests run with both (and neither) slimming paint v2 and root layer
+// scrolling.
+typedef bool TestParamSlimmingPaintV2;
+class WebFrameTestForSpv1AndSpv2
+ : public ::testing::WithParamInterface<TestParamSlimmingPaintV2>,
+ private ScopedSlimmingPaintV2ForTest,
+ public WebFrameTest {
+ public:
+ WebFrameTestForSpv1AndSpv2() : ScopedSlimmingPaintV2ForTest(GetParam()) {}
+};
+
+INSTANTIATE_TEST_CASE_P(All, WebFrameTestForSpv1AndSpv2, ::testing::Bool());
+
+TEST_P(WebFrameTestForSpv1AndSpv2, CompositorScrollIsUserScrollLongPage) {
registerMockedHttpURLLoad("long_scroll.html");
TestScrolledFrameClient client;
@@ -6770,7 +6784,8 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) {
// Do a compositor scroll, verify that this is counted as a user scroll.
frameViewLayer->platformLayer()->setScrollPositionDouble(
WebDoublePoint(0, 1));
- frameViewLayer->didScroll();
+ auto* scrollableArea = frameImpl->frameView()->layoutViewportScrollableArea();
+ scrollableArea->didScroll(gfx::ScrollOffset(0, 1));
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
WebFloatSize(), 1.7f, 0);
EXPECT_TRUE(client.wasFrameScrolled());
@@ -6782,7 +6797,7 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) {
// The page scale 1.0f and scroll.
frameViewLayer->platformLayer()->setScrollPositionDouble(
WebDoublePoint(0, 2));
- frameViewLayer->didScroll();
+ scrollableArea->didScroll(gfx::ScrollOffset(0, 2));
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
WebFloatSize(), 1.0f, 0);
EXPECT_TRUE(client.wasFrameScrolled());
@@ -6791,7 +6806,7 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) {
initialScrollState.wasScrolledByUser = false;
// No scroll event if there is no scroll delta.
- frameViewLayer->didScroll();
+ scrollableArea->didScroll(gfx::ScrollOffset(0, 2));
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
WebFloatSize(), 1.0f, 0);
EXPECT_FALSE(client.wasFrameScrolled());
@@ -6801,7 +6816,7 @@ TEST_F(WebFrameTest, CompositorScrollIsUserScrollLongPage) {
// Non zero page scale and scroll.
frameViewLayer->platformLayer()->setScrollPositionDouble(
WebDoublePoint(9, 15));
- frameViewLayer->didScroll();
+ scrollableArea->didScroll(gfx::ScrollOffset(9, 15));
webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
WebFloatSize(), 0.6f, 0);
EXPECT_TRUE(client.wasFrameScrolled());

Powered by Google App Engine
This is Rietveld 408576698