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..4d4b193d271ed8034c7ca28bf920115fa4d897c7 |
--- /dev/null |
+++ b/Source/web/tests/DocumentLoadingRenderingTest.cpp |
@@ -0,0 +1,54 @@ |
+// 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 "web/WebLocalFrameImpl.h" |
+#include "web/tests/FrameTestHelpers.h" |
+#include "web/tests/mocks/MockLayerTreeView.h" |
+#include "web/tests/mocks/MockNetwork.h" |
+#include "web/tests/mocks/MockRequest.h" |
+#include "web/tests/mocks/MockWebViewClient.h" |
+#include <gtest/gtest.h> |
+ |
+namespace blink { |
+ |
+class DocumentLoadingRenderingTest : public ::testing::Test { |
+}; |
+ |
+TEST_F(DocumentLoadingRenderingTest, ShouldResumeCommitsAfterBodyParsedWithoutSheets) |
dcheng
2015/08/27 23:10:22
Since the fixture doesn't do anything, how about j
esprehn
2015/08/28 08:31:43
Done.
|
+{ |
+ MockLayerTreeView layerTreeView; |
+ MockWebViewClient webViewClient(layerTreeView); |
+ FrameTestHelpers::WebViewHelper webViewHelper; |
+ webViewHelper.initialize(true, nullptr, &webViewClient); |
+ |
+ MockNetwork network; |
+ MockRequest 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 |