| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "platform/testing/UnitTestHelpers.h" | 6 #include "platform/testing/UnitTestHelpers.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "web/tests/sim/SimCompositor.h" | 8 #include "web/tests/sim/SimCompositor.h" |
| 9 #include "web/tests/sim/SimDisplayItemList.h" | 9 #include "web/tests/sim/SimDisplayItemList.h" |
| 10 #include "web/tests/sim/SimRequest.h" | 10 #include "web/tests/sim/SimRequest.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 svg_resource.Write( | 191 svg_resource.Write( |
| 192 "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"65536\" " | 192 "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"65536\" " |
| 193 "width=\"65536\"></svg>"); | 193 "width=\"65536\"></svg>"); |
| 194 svg_resource.Finish(); | 194 svg_resource.Finish(); |
| 195 Compositor().BeginFrame(); | 195 Compositor().BeginFrame(); |
| 196 EXPECT_EQ(1, WebViewClient().VisuallyNonEmptyLayoutCount()); | 196 EXPECT_EQ(1, WebViewClient().VisuallyNonEmptyLayoutCount()); |
| 197 | 197 |
| 198 main_resource.Finish(); | 198 main_resource.Finish(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 // A pending stylesheet in the head is render-blocking and will be considered |
| 202 // a pending stylesheet if a layout is triggered before it loads. |
| 203 TEST_F(WebMeaningfulLayoutsTest, LayoutWithPendingRenderBlockingStylesheet) { |
| 204 SimRequest main_resource("https://example.com/index.html", "text/html"); |
| 205 SimRequest style_resource("https://example.com/style.css", "text/css"); |
| 206 |
| 207 LoadURL("https://example.com/index.html"); |
| 208 |
| 209 main_resource.Complete( |
| 210 "<html><head>" |
| 211 "<link rel=\"stylesheet\" href=\"style.css\">" |
| 212 "</head><body></body></html>"); |
| 213 |
| 214 GetDocument().UpdateStyleAndLayoutTreeIgnorePendingStylesheets(); |
| 215 EXPECT_TRUE(GetDocument().DidLayoutWithPendingStylesheets()); |
| 216 |
| 217 style_resource.Complete(""); |
| 218 } |
| 219 |
| 220 // A pending stylesheet in the body is not render-blocking and should not |
| 221 // be considered a pending stylesheet if a layout is triggered before it loads. |
| 222 TEST_F(WebMeaningfulLayoutsTest, LayoutWithPendingScriptBlockingStylesheet) { |
| 223 SimRequest main_resource("https://example.com/index.html", "text/html"); |
| 224 SimRequest style_resource("https://example.com/style.css", "text/css"); |
| 225 |
| 226 LoadURL("https://example.com/index.html"); |
| 227 |
| 228 main_resource.Complete( |
| 229 "<html><head></head><body>" |
| 230 "<link rel=\"stylesheet\" href=\"style.css\">" |
| 231 "</body></html>"); |
| 232 |
| 233 GetDocument().UpdateStyleAndLayoutTreeIgnorePendingStylesheets(); |
| 234 EXPECT_FALSE(GetDocument().DidLayoutWithPendingStylesheets()); |
| 235 |
| 236 style_resource.Complete(""); |
| 237 } |
| 238 |
| 201 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |