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

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

Issue 2272773002: Use intersection observer to control frame throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust OOPIF expectations Created 4 years, 4 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/FrameThrottlingTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
index 13d13fee9221ed14ec03c2e1e5677a53c04f525c..e0f29b1427440a77d4e35fa2c1e83ab19058fb4c 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -450,7 +450,8 @@ TEST(RemoteFrameThrottlingTest, ThrottledLocalRoot)
frameView->frame().securityContext()->setSecurityOrigin(SecurityOrigin::createUnique());
frameView->updateAllLifecyclePhases();
testing::runPendingTasks();
- EXPECT_TRUE(frameView->canThrottleRendering());
+ // TODO(skyostil): Intersection observers don't work for remote frames (crbug.com/615156).
+ EXPECT_FALSE(frameView->canThrottleRendering());
Document* frameDocument = frameView->frame().document();
EXPECT_EQ(DocumentLifecycle::PaintClean, frameDocument->lifecycle().state());
@@ -462,10 +463,11 @@ TEST(RemoteFrameThrottlingTest, ThrottledLocalRoot)
// Update the lifecycle again. The frame's lifecycle should not advance
// because of throttling even though it is the local root.
+ // TODO(skyostil): Intersection observers don't work for remote frames (crbug.com/615156).
DocumentLifecycle::AllowThrottlingScope throttlingScope(frameDocument->lifecycle());
frameView->updateAllLifecyclePhases();
testing::runPendingTasks();
- EXPECT_EQ(DocumentLifecycle::VisualUpdatePending, frameDocument->lifecycle().state());
+ EXPECT_EQ(DocumentLifecycle::PaintClean, frameDocument->lifecycle().state());
webView->close();
}
@@ -768,14 +770,31 @@ TEST_F(FrameThrottlingTest, ThrottleSubtreeAtomically)
// should immediately become throttled. This simulates the case where a task
// such as BeginMainFrame runs in the middle of dispatching intersection
// observer notifications.
- frameElement->contentDocument()->view()->notifyRenderThrottlingObserversForTesting();
+ frameElement->contentDocument()->view()->updateRenderThrottlingStatusForTesting();
EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRendering());
// Both frames should still be throttled after the second notification.
- childFrameElement->contentDocument()->view()->notifyRenderThrottlingObserversForTesting();
+ childFrameElement->contentDocument()->view()->updateRenderThrottlingStatusForTesting();
+ EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
+ EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRendering());
+
+ // Move the frame back on screen but don't update throttling yet.
+ frameElement->setAttribute(styleAttr, "transform: translateY(0px)");
+ compositor().beginFrame();
EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRendering());
+
+ // Update throttling for the child. It should remain throttled because the
+ // parent is still throttled.
+ childFrameElement->contentDocument()->view()->updateRenderThrottlingStatusForTesting();
+ EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
+ EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRendering());
+
+ // Updating throttling on the parent should unthrottle both frames.
+ frameElement->contentDocument()->view()->updateRenderThrottlingStatusForTesting();
+ EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
+ EXPECT_FALSE(childFrameElement->contentDocument()->view()->canThrottleRendering());
}
TEST_F(FrameThrottlingTest, SkipPaintingLayersInThrottledFrames)

Powered by Google App Engine
This is Rietveld 408576698