summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/scheduler_integration_tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-09-03 13:32:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-01 14:31:55 +0200
commit21ba0c5d4bf8fba15dddd97cd693bad2358b77fd (patch)
tree91be119f694044dfc1ff9fdc054459e925de9df0 /chromium/third_party/blink/renderer/core/scheduler_integration_tests
parent03c549e0392f92c02536d3f86d5e1d8dfa3435ac (diff)
downloadqtwebengine-chromium-21ba0c5d4bf8fba15dddd97cd693bad2358b77fd.tar.gz
BASELINE: Update Chromium to 92.0.4515.166
Change-Id: I42a050486714e9e54fc271f2a8939223a02ae364
Diffstat (limited to 'chromium/third_party/blink/renderer/core/scheduler_integration_tests')
-rw-r--r--chromium/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc70
1 files changed, 61 insertions, 9 deletions
diff --git a/chromium/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc b/chromium/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc
index b4de682e114..27fa2a8550a 100644
--- a/chromium/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc
+++ b/chromium/third_party/blink/renderer/core/scheduler_integration_tests/frame_throttling_test.cc
@@ -414,7 +414,7 @@ TEST_P(FrameThrottlingTest, ForAllThrottledLocalFrameViews) {
EXPECT_EQ(1u, throttled_count);
}
-TEST_P(FrameThrottlingTest, HiddenCrossOriginZeroByZeroFramesAreNotThrottled) {
+TEST_P(FrameThrottlingTest, HiddenCrossOriginZeroByZeroFramesAreThrottled) {
// Create a document with doubly nested iframes.
SimRequest main_resource("https://example.com/", "text/html");
SimRequest frame_resource("https://example.com/iframe.html", "text/html");
@@ -436,12 +436,27 @@ TEST_P(FrameThrottlingTest, HiddenCrossOriginZeroByZeroFramesAreNotThrottled) {
EXPECT_FALSE(frame_document->View()->CanThrottleRendering());
EXPECT_FALSE(inner_frame_document->View()->CanThrottleRendering());
- // The frame is not throttled because its dimensions are 0x0.
+ // The frame is throttled because its dimensions are 0x0, as per experimental
+ // feature ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes.
frame_element->setAttribute(kStyleAttr, "transform: translateY(480px)");
CompositeFrame();
EXPECT_FALSE(GetDocument().View()->CanThrottleRendering());
+ // When ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes is enabled,
+ // we will throttle the frame.
EXPECT_FALSE(frame_document->View()->CanThrottleRendering());
- EXPECT_FALSE(inner_frame_document->View()->CanThrottleRendering());
+ EXPECT_TRUE(inner_frame_document->View()->CanThrottleRendering());
+ {
+ // Re-test with flag disabled.
+ ScopedThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframesForTest
+ scoped_flag_override(false);
+
+ frame_document->View()->GetLayoutView()->SetNeedsLayout("test");
+ frame_document->View()->ScheduleAnimation();
+ frame_document->View()->GetLayoutView()->Layer()->SetNeedsRepaint();
+ frame_document->View()->ForceUpdateViewportIntersections();
+ CompositeFrame();
+ EXPECT_FALSE(inner_frame_document->View()->CanThrottleRendering());
+ }
}
TEST_P(FrameThrottlingTest, ThrottledLifecycleUpdate) {
@@ -495,6 +510,7 @@ TEST_P(FrameThrottlingTest, UnthrottlingFrameSchedulesAnimation) {
LoadURL("https://example.com/");
main_resource.Complete("<iframe sandbox id=frame></iframe>");
+ CompositeFrame();
auto* frame_element =
To<HTMLIFrameElement>(GetDocument().getElementById("frame"));
@@ -1058,6 +1074,7 @@ TEST_P(FrameThrottlingTest, DumpThrottledFrame) {
main_resource.Complete(
"main <iframe id=frame sandbox=allow-scripts src=iframe.html></iframe>");
frame_resource.Complete("");
+ CompositeFrame();
auto* frame_element =
To<HTMLIFrameElement>(GetDocument().getElementById("frame"));
frame_element->setAttribute(kStyleAttr, "transform: translateY(480px)");
@@ -1411,7 +1428,21 @@ TEST_P(FrameThrottlingTest, DisplayNoneNotThrottled) {
// Setting display:none unthrottles the frame.
frame_element->setAttribute(kStyleAttr, "display: none");
CompositeFrame();
- EXPECT_FALSE(frame_document->View()->CanThrottleRendering());
+ // When ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes is enabled,
+ // we will throttle cross-origin display:none.
+ EXPECT_TRUE(frame_document->View()->CanThrottleRendering());
+ {
+ // Re-test with flag disabled.
+ ScopedThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframesForTest
+ scoped_flag_override(false);
+
+ frame_document->View()->GetLayoutView()->SetNeedsLayout("test");
+ frame_document->View()->ScheduleAnimation();
+ frame_document->View()->GetLayoutView()->Layer()->SetNeedsRepaint();
+ frame_document->View()->ForceUpdateViewportIntersections();
+ CompositeFrame();
+ EXPECT_FALSE(frame_document->View()->CanThrottleRendering());
+ }
}
TEST_P(FrameThrottlingTest, DisplayNoneChildrenRemainThrottled) {
@@ -1438,14 +1469,35 @@ TEST_P(FrameThrottlingTest, DisplayNoneChildrenRemainThrottled) {
EXPECT_TRUE(
child_frame_element->contentDocument()->View()->CanThrottleRendering());
- // Setting display:none for the parent frame unthrottles the parent but not
- // the child. This behavior matches Safari.
+ // Setting display:none for the parent frame throttles the parent and also
+ // the child. This behavior differs from Safari.
frame_element->setAttribute(kStyleAttr, "display: none");
CompositeFrame();
- EXPECT_FALSE(
- frame_element->contentDocument()->View()->CanThrottleRendering());
+ // When ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes is enabled,
+ // the cross-origin, display:none frame will be throttled.
+ EXPECT_TRUE(frame_element->contentDocument()->View()->CanThrottleRendering());
EXPECT_TRUE(
child_frame_element->contentDocument()->View()->CanThrottleRendering());
+ {
+ // Re-test with flag disabled.
+ ScopedThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframesForTest
+ scoped_flag_override(false);
+
+ frame_element->contentDocument()->View()->GetLayoutView()->SetNeedsLayout(
+ "test");
+ frame_element->contentDocument()->View()->ScheduleAnimation();
+ frame_element->contentDocument()
+ ->View()
+ ->GetLayoutView()
+ ->Layer()
+ ->SetNeedsRepaint();
+ frame_element->contentDocument()
+ ->View()
+ ->ForceUpdateViewportIntersections();
+ CompositeFrame();
+ EXPECT_FALSE(
+ frame_element->contentDocument()->View()->CanThrottleRendering());
+ }
}
TEST_P(FrameThrottlingTest, RebuildCompositedLayerTreeOnLayerRemoval) {
@@ -1538,7 +1590,7 @@ TEST_P(FrameThrottlingTest, LifecycleUpdateAfterUnthrottledCompositingUpdate) {
frame_document->getElementById("div")->setAttribute(kStyleAttr,
"will-change: transform");
- GetDocument().View()->UpdateLifecycleToCompositingCleanPlusScrolling(
+ GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint(
DocumentUpdateReason::kTest);
// Then do a full lifecycle with throttling enabled. This should not crash.