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

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

Issue 2823873002: Fixed the paint supression to track only render-blocking stylesheets
Patch Set: Fixed stylesheet check Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp b/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
index c08dd6868775330342b4648d95c5aef22ad0fea1..ace6725b9094be58cfa6b76f4aa5bf915a99ccad 100644
--- a/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp
@@ -198,4 +198,42 @@ TEST_F(WebMeaningfulLayoutsTest,
main_resource.Finish();
}
+// A pending stylesheet in the head is render-blocking and will be considered
+// a pending stylesheet if a layout is triggered before it loads.
+TEST_F(WebMeaningfulLayoutsTest, LayoutWithPendingRenderBlockingStylesheet) {
+ SimRequest main_resource("https://example.com/index.html", "text/html");
+ SimRequest style_resource("https://example.com/style.css", "text/css");
+
+ LoadURL("https://example.com/index.html");
+
+ main_resource.Complete(
+ "<html><head>"
+ "<link rel=\"stylesheet\" href=\"style.css\">"
+ "</head><body></body></html>");
+
+ GetDocument().UpdateStyleAndLayoutTreeIgnorePendingStylesheets();
+ EXPECT_TRUE(GetDocument().DidLayoutWithPendingStylesheets());
+
+ style_resource.Complete("");
+}
+
+// A pending stylesheet in the body is not render-blocking and should not
+// be considered a pending stylesheet if a layout is triggered before it loads.
+TEST_F(WebMeaningfulLayoutsTest, LayoutWithPendingScriptBlockingStylesheet) {
+ SimRequest main_resource("https://example.com/index.html", "text/html");
+ SimRequest style_resource("https://example.com/style.css", "text/css");
+
+ LoadURL("https://example.com/index.html");
+
+ main_resource.Complete(
+ "<html><head></head><body>"
+ "<link rel=\"stylesheet\" href=\"style.css\">"
+ "</body></html>");
+
+ GetDocument().UpdateStyleAndLayoutTreeIgnorePendingStylesheets();
+ EXPECT_FALSE(GetDocument().DidLayoutWithPendingStylesheets());
+
+ style_resource.Complete("");
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698