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

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: Fix rebase typo Created 4 years, 2 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 b2e6e095f0f9840e161dccf0f2c46bc41dcfda51..5752b1b118c715fec5eab2283d0edcbdf89aec53 100644
--- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -778,7 +778,7 @@ TEST_F(FrameThrottlingTest, ThrottleSubtreeAtomically) {
// observer notifications.
frameElement->contentDocument()
->view()
- ->notifyRenderThrottlingObserversForTesting();
+ ->updateRenderThrottlingStatusForTesting();
EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
EXPECT_TRUE(
childFrameElement->contentDocument()->view()->canThrottleRendering());
@@ -786,10 +786,34 @@ TEST_F(FrameThrottlingTest, ThrottleSubtreeAtomically) {
// Both frames should still be throttled after the second notification.
childFrameElement->contentDocument()
->view()
- ->notifyRenderThrottlingObserversForTesting();
+ ->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