| 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
|
|
|