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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« 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