| OLD | NEW |
| 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/FrameTestHelpers.h" | 8 #include "core/frame/FrameTestHelpers.h" |
| 9 #include "core/frame/WebLocalFrameBase.h" | 9 #include "core/frame/WebLocalFrameBase.h" |
| 10 #include "core/page/Page.h" | 10 #include "core/page/Page.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 WebLocalFrameBase* MainFrame() { | 38 WebLocalFrameBase* MainFrame() { return web_view_helper_.LocalMainFrame(); } |
| 39 return web_view_helper_.WebView()->MainFrameImpl(); | |
| 40 } | |
| 41 | 39 |
| 42 FrameTestHelpers::WebViewHelper web_view_helper_; | 40 FrameTestHelpers::WebViewHelper web_view_helper_; |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 TEST_F(DocumentLoaderTest, SingleChunk) { | 43 TEST_F(DocumentLoaderTest, SingleChunk) { |
| 46 class TestDelegate : public WebURLLoaderTestDelegate { | 44 class TestDelegate : public WebURLLoaderTestDelegate { |
| 47 public: | 45 public: |
| 48 void DidReceiveData(WebURLLoaderClient* original_client, | 46 void DidReceiveData(WebURLLoaderClient* original_client, |
| 49 const char* data, | 47 const char* data, |
| 50 int data_length) override { | 48 int data_length) override { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 TEST_F(DocumentLoaderTest, isCommittedButEmpty) { | 187 TEST_F(DocumentLoaderTest, isCommittedButEmpty) { |
| 190 WebViewBase* web_view_impl = | 188 WebViewBase* web_view_impl = |
| 191 web_view_helper_.InitializeAndLoad("about:blank"); | 189 web_view_helper_.InitializeAndLoad("about:blank"); |
| 192 EXPECT_TRUE(ToLocalFrame(web_view_impl->GetPage()->MainFrame()) | 190 EXPECT_TRUE(ToLocalFrame(web_view_impl->GetPage()->MainFrame()) |
| 193 ->Loader() | 191 ->Loader() |
| 194 .GetDocumentLoader() | 192 .GetDocumentLoader() |
| 195 ->IsCommittedButEmpty()); | 193 ->IsCommittedButEmpty()); |
| 196 } | 194 } |
| 197 | 195 |
| 198 } // namespace blink | 196 } // namespace blink |
| OLD | NEW |