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

Side by Side Diff: third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp

Issue 2896563002: Update WebLocalFrameImpl with WebLocalFrameBase to break dependencies. (Closed)
Patch Set: Rebase Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/DocumentLoader.h" 5 #include "core/loader/DocumentLoader.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include "core/frame/WebLocalFrameBase.h"
8 #include "core/page/Page.h" 9 #include "core/page/Page.h"
9 #include "platform/testing/URLTestHelpers.h" 10 #include "platform/testing/URLTestHelpers.h"
10 #include "platform/testing/UnitTestHelpers.h" 11 #include "platform/testing/UnitTestHelpers.h"
11 #include "platform/wtf/AutoReset.h" 12 #include "platform/wtf/AutoReset.h"
12 #include "public/platform/Platform.h" 13 #include "public/platform/Platform.h"
13 #include "public/platform/WebURLLoaderClient.h" 14 #include "public/platform/WebURLLoaderClient.h"
14 #include "public/platform/WebURLLoaderMockFactory.h" 15 #include "public/platform/WebURLLoaderMockFactory.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "web/WebLocalFrameImpl.h"
17 #include "web/tests/FrameTestHelpers.h" 17 #include "web/tests/FrameTestHelpers.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 // TODO(dcheng): Ideally, enough of FrameTestHelpers would be in core/ that 21 // TODO(dcheng): Ideally, enough of FrameTestHelpers would be in core/ that
22 // placing a test for a core/ class in web/ wouldn't be necessary. 22 // placing a test for a core/ class in web/ wouldn't be necessary.
23 class DocumentLoaderTest : public ::testing::Test { 23 class DocumentLoaderTest : public ::testing::Test {
24 protected: 24 protected:
25 void SetUp() override { 25 void SetUp() override {
26 web_view_helper_.Initialize(); 26 web_view_helper_.Initialize();
27 URLTestHelpers::RegisterMockedURLLoad( 27 URLTestHelpers::RegisterMockedURLLoad(
28 URLTestHelpers::ToKURL("https://example.com/foo.html"), 28 URLTestHelpers::ToKURL("https://example.com/foo.html"),
29 testing::WebTestDataPath("foo.html")); 29 testing::WebTestDataPath("foo.html"));
30 } 30 }
31 31
32 void TearDown() override { 32 void TearDown() override {
33 Platform::Current() 33 Platform::Current()
34 ->GetURLLoaderMockFactory() 34 ->GetURLLoaderMockFactory()
35 ->UnregisterAllURLsAndClearMemoryCache(); 35 ->UnregisterAllURLsAndClearMemoryCache();
36 } 36 }
37 37
38 WebLocalFrameImpl* MainFrame() { 38 WebLocalFrameBase* MainFrame() {
39 return web_view_helper_.WebView()->MainFrameImpl(); 39 return web_view_helper_.WebView()->MainFrameImpl();
40 } 40 }
41 41
42 FrameTestHelpers::WebViewHelper web_view_helper_; 42 FrameTestHelpers::WebViewHelper web_view_helper_;
43 }; 43 };
44 44
45 TEST_F(DocumentLoaderTest, SingleChunk) { 45 TEST_F(DocumentLoaderTest, SingleChunk) {
46 class TestDelegate : public WebURLLoaderTestDelegate { 46 class TestDelegate : public WebURLLoaderTestDelegate {
47 public: 47 public:
48 void DidReceiveData(WebURLLoaderClient* original_client, 48 void DidReceiveData(WebURLLoaderClient* original_client,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TEST_F(DocumentLoaderTest, isCommittedButEmpty) { 172 TEST_F(DocumentLoaderTest, isCommittedButEmpty) {
173 WebViewBase* web_view_impl = 173 WebViewBase* web_view_impl =
174 web_view_helper_.InitializeAndLoad("about:blank", true); 174 web_view_helper_.InitializeAndLoad("about:blank", true);
175 EXPECT_TRUE(ToLocalFrame(web_view_impl->GetPage()->MainFrame()) 175 EXPECT_TRUE(ToLocalFrame(web_view_impl->GetPage()->MainFrame())
176 ->Loader() 176 ->Loader()
177 .GetDocumentLoader() 177 .GetDocumentLoader()
178 ->IsCommittedButEmpty()); 178 ->IsCommittedButEmpty());
179 } 179 }
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp ('k') | third_party/WebKit/Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698