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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/sim/SimLayerTreeView.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "core/dom/Document.h"
8 #include "web/WebLocalFrameImpl.h"
9 #include "web/tests/FrameTestHelpers.h"
10 #include "web/tests/sim/SimLayerTreeView.h"
11 #include "web/tests/sim/SimNetwork.h"
12 #include "web/tests/sim/SimRequest.h"
13 #include "web/tests/sim/SimWebViewClient.h"
14 #include <gtest/gtest.h>
15
16 namespace blink {
17
18 class DocumentLoadingRenderingTest : public ::testing::Test {
19 void SetUp() override
20 {
21 Document::setThreadedParsingEnabledForUnitTestsOnly(false);
22 }
23
24 void TearDown() override
25 {
26 Document::setThreadedParsingEnabledForUnitTestsOnly(true);
27 }
28 };
29
30 TEST_F(DocumentLoadingRenderingTest, ShouldResumeCommitsAfterBodyParsedWithoutSh eets)
31 {
32 SimLayerTreeView layerTreeView;
33 SimWebViewClient webViewClient(layerTreeView);
34 FrameTestHelpers::WebViewHelper webViewHelper;
35 webViewHelper.initialize(true, nullptr, &webViewClient);
36
37 SimNetwork network;
38 SimRequest mainResource("https://example.com/test.html", "text/html");
39
40 WebURLRequest request;
41 request.initialize();
42 request.setURL(KURL(ParsedURLString, "https://example.com/test.html"));
43
44 webViewHelper.webViewImpl()->mainFrameImpl()->loadRequest(request);
45
46 mainResource.start();
47
48 // Still in the head, should not resume commits.
49 mainResource.write("<!DOCTYPE html>");
50 EXPECT_TRUE(layerTreeView.deferCommits());
51 mainResource.write("<title>Test</title><style>div { color red; }</style>");
52 EXPECT_TRUE(layerTreeView.deferCommits());
53
54 // Implicitly inserts the body. Since there's no loading stylesheets we
55 // should resume commits.
56 mainResource.write("<p>Hello World</p>");
57 EXPECT_FALSE(layerTreeView.deferCommits());
58
59 // Finish the load, should stay resumed.
60 mainResource.finish();
61 EXPECT_FALSE(layerTreeView.deferCommits());
62 }
63
64 } // namespace blink
OLDNEW
« 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