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

Unified Diff: Source/web/tests/DocumentLoadingRenderingTest.cpp

Issue 1316403004: Ensure that we trigger deferred frame commits. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Trigger BeginFrame from resumeTreeViewCommits Created 5 years, 3 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 | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/sim/SimLayerTreeView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/DocumentLoadingRenderingTest.cpp
diff --git a/Source/web/tests/DocumentLoadingRenderingTest.cpp b/Source/web/tests/DocumentLoadingRenderingTest.cpp
index 0f64c43a4e6c29fb8d459d5e6c755a7a834b3812..fae191b38175c3994175cb935eb665b993c74fff 100644
--- a/Source/web/tests/DocumentLoadingRenderingTest.cpp
+++ b/Source/web/tests/DocumentLoadingRenderingTest.cpp
@@ -5,6 +5,7 @@
#include "config.h"
#include "core/dom/Document.h"
+#include "core/page/Page.h"
#include "web/WebLocalFrameImpl.h"
#include "web/tests/FrameTestHelpers.h"
#include "web/tests/sim/SimLayerTreeView.h"
@@ -37,6 +38,8 @@ protected:
m_webViewHelper.webViewImpl()->mainFrameImpl()->loadRequest(request);
}
+ Document& document() { return *toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame())->document(); }
+
SimNetwork m_network;
SimLayerTreeView m_layerTreeView;
SimWebViewClient m_webViewClient;
@@ -160,4 +163,41 @@ TEST_F(DocumentLoadingRenderingTest, ShouldResumeCommitsAfterParsingSvg)
EXPECT_FALSE(m_layerTreeView.deferCommits());
}
+TEST_F(DocumentLoadingRenderingTest, ShouldScheduleFrameAfterSheetsLoaded)
+{
+ SimRequest mainResource("https://example.com/test.html", "text/html");
+ SimRequest firstCssResource("https://example.com/first.css", "text/css");
+ SimRequest secondCssResource("https://example.com/second.css", "text/css");
+
+ loadURL("https://example.com/test.html");
+
+ mainResource.start();
+
+ // Load a stylesheet.
+ mainResource.write("<!DOCTYPE html><link id=link rel=stylesheet href=first.css>");
+ EXPECT_TRUE(m_layerTreeView.deferCommits());
+
+ firstCssResource.start();
+ firstCssResource.write("body { color: red; }");
+ mainResource.write("<body>");
+ firstCssResource.finish();
+
+ // Sheet finished and there's a body so resume.
+ EXPECT_FALSE(m_layerTreeView.deferCommits());
+
+ mainResource.finish();
+ m_layerTreeView.clearNeedsAnimate();
+
+ // Replace the stylesheet by changing href.
+ Element* element = document().getElementById("link");
+ EXPECT_NE(nullptr, element);
+ element->setAttribute(HTMLNames::hrefAttr, "second.css");
+ EXPECT_FALSE(m_layerTreeView.needsAnimate());
+
+ secondCssResource.start();
+ secondCssResource.write("body { color: red; }");
+ secondCssResource.finish();
+ EXPECT_TRUE(m_layerTreeView.needsAnimate());
+}
+
} // namespace blink
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/sim/SimLayerTreeView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698