Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 "web/WebLocalFrameImpl.h" | |
| 8 #include "web/tests/FrameTestHelpers.h" | |
| 9 #include "web/tests/mocks/MockLayerTreeView.h" | |
| 10 #include "web/tests/mocks/MockNetwork.h" | |
| 11 #include "web/tests/mocks/MockRequest.h" | |
| 12 #include "web/tests/mocks/MockWebViewClient.h" | |
| 13 #include <gtest/gtest.h> | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 class DocumentLoadingRenderingTest : public ::testing::Test { | |
| 18 }; | |
| 19 | |
| 20 TEST_F(DocumentLoadingRenderingTest, ShouldResumeCommitsAfterBodyParsedWithoutSh eets) | |
|
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.
| |
| 21 { | |
| 22 MockLayerTreeView layerTreeView; | |
| 23 MockWebViewClient webViewClient(layerTreeView); | |
| 24 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 25 webViewHelper.initialize(true, nullptr, &webViewClient); | |
| 26 | |
| 27 MockNetwork network; | |
| 28 MockRequest mainResource("https://example.com/test.html", "text/html"); | |
| 29 | |
| 30 WebURLRequest request; | |
| 31 request.initialize(); | |
| 32 request.setURL(KURL(ParsedURLString, "https://example.com/test.html")); | |
| 33 | |
| 34 webViewHelper.webViewImpl()->mainFrameImpl()->loadRequest(request); | |
| 35 | |
| 36 mainResource.start(); | |
| 37 | |
| 38 // Still in the head, should not resume commits. | |
| 39 mainResource.write("<!DOCTYPE html>"); | |
| 40 EXPECT_TRUE(layerTreeView.deferCommits()); | |
| 41 mainResource.write("<title>Test</title><style>div { color red; }</style>"); | |
| 42 EXPECT_TRUE(layerTreeView.deferCommits()); | |
| 43 | |
| 44 // Implicitly inserts the body. Since there's no loading stylesheets we | |
| 45 // should resume commits. | |
| 46 mainResource.write("<p>Hello World</p>"); | |
| 47 EXPECT_FALSE(layerTreeView.deferCommits()); | |
| 48 | |
| 49 // Finish the load, should stay resumed. | |
| 50 mainResource.finish(); | |
| 51 EXPECT_FALSE(layerTreeView.deferCommits()); | |
| 52 } | |
| 53 | |
| 54 } // namespace blink | |
| OLD | NEW |