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

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

Issue 1313013005: Add a test that we resume commits after inserting the body. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: dcheng@ review Created 5 years, 4 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
new file mode 100644
index 0000000000000000000000000000000000000000..2283f8507e2d753268c77eae9cc0c9d69d6cb5ec
--- /dev/null
+++ b/Source/web/tests/DocumentLoadingRenderingTest.cpp
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "core/dom/Document.h"
+#include "web/WebLocalFrameImpl.h"
+#include "web/tests/FrameTestHelpers.h"
+#include "web/tests/sim/SimLayerTreeView.h"
+#include "web/tests/sim/SimNetwork.h"
+#include "web/tests/sim/SimRequest.h"
+#include "web/tests/sim/SimWebViewClient.h"
+#include <gtest/gtest.h>
+
+namespace blink {
+
+class DocumentLoadingRenderingTest : public ::testing::Test {
+ void SetUp() override
+ {
+ Document::setThreadedParsingEnabledForUnitTestsOnly(false);
+ }
+
+ void TearDown() override
+ {
+ Document::setThreadedParsingEnabledForUnitTestsOnly(true);
+ }
+};
+
+TEST_F(DocumentLoadingRenderingTest, ShouldResumeCommitsAfterBodyParsedWithoutSheets)
+{
+ SimLayerTreeView layerTreeView;
+ SimWebViewClient webViewClient(layerTreeView);
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initialize(true, nullptr, &webViewClient);
+
+ SimNetwork network;
+ SimRequest mainResource("https://example.com/test.html", "text/html");
+
+ WebURLRequest request;
+ request.initialize();
+ request.setURL(KURL(ParsedURLString, "https://example.com/test.html"));
+
+ webViewHelper.webViewImpl()->mainFrameImpl()->loadRequest(request);
+
+ mainResource.start();
+
+ // Still in the head, should not resume commits.
+ mainResource.write("<!DOCTYPE html>");
+ EXPECT_TRUE(layerTreeView.deferCommits());
+ mainResource.write("<title>Test</title><style>div { color red; }</style>");
+ EXPECT_TRUE(layerTreeView.deferCommits());
+
+ // Implicitly inserts the body. Since there's no loading stylesheets we
+ // should resume commits.
+ mainResource.write("<p>Hello World</p>");
+ EXPECT_FALSE(layerTreeView.deferCommits());
+
+ // Finish the load, should stay resumed.
+ mainResource.finish();
+ EXPECT_FALSE(layerTreeView.deferCommits());
+}
+
+} // 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