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

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

Issue 2654933003: platform/testing/{URL|Unit}TestHelpers improvements (Closed)
Patch Set: header changes Created 3 years, 10 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 "core/page/Page.h" 8 #include "core/page/Page.h"
8 #include "platform/testing/URLTestHelpers.h" 9 #include "platform/testing/URLTestHelpers.h"
10 #include "platform/testing/UnitTestHelpers.h"
9 #include "public/platform/Platform.h" 11 #include "public/platform/Platform.h"
10 #include "public/platform/WebURLLoaderClient.h" 12 #include "public/platform/WebURLLoaderClient.h"
11 #include "public/platform/WebURLLoaderMockFactory.h" 13 #include "public/platform/WebURLLoaderMockFactory.h"
12 #include "public/web/WebCache.h" 14 #include "public/web/WebCache.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 #include "web/WebLocalFrameImpl.h" 16 #include "web/WebLocalFrameImpl.h"
15 #include "web/tests/FrameTestHelpers.h" 17 #include "web/tests/FrameTestHelpers.h"
16 #include "wtf/AutoReset.h" 18 #include "wtf/AutoReset.h"
17 #include <queue>
18 19
19 namespace blink { 20 namespace blink {
20 21
21 // TODO(dcheng): Ideally, enough of FrameTestHelpers would be in core/ that 22 // 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. 23 // placing a test for a core/ class in web/ wouldn't be necessary.
23 class DocumentLoaderTest : public ::testing::Test { 24 class DocumentLoaderTest : public ::testing::Test {
24 protected: 25 protected:
25 void SetUp() override { 26 void SetUp() override {
26 m_webViewHelper.initialize(); 27 m_webViewHelper.initialize();
27 URLTestHelpers::registerMockedURLLoad( 28 URLTestHelpers::registerMockedURLLoad(
28 URLTestHelpers::toKURL("https://example.com/foo.html"), "foo.html"); 29 URLTestHelpers::toKURL("https://example.com/foo.html"),
30 testing::webTestDataPath("foo.html"));
29 } 31 }
30 32
31 void TearDown() override { 33 void TearDown() override {
32 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); 34 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
33 WebCache::clear(); 35 WebCache::clear();
34 } 36 }
35 37
36 WebLocalFrameImpl* mainFrame() { 38 WebLocalFrameImpl* mainFrame() {
37 return m_webViewHelper.webView()->mainFrameImpl(); 39 return m_webViewHelper.webView()->mainFrameImpl();
38 } 40 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 TEST_F(DocumentLoaderTest, isCommittedButEmpty) { 172 TEST_F(DocumentLoaderTest, isCommittedButEmpty) {
171 WebViewImpl* webViewImpl = 173 WebViewImpl* webViewImpl =
172 m_webViewHelper.initializeAndLoad("about:blank", true); 174 m_webViewHelper.initializeAndLoad("about:blank", true);
173 EXPECT_TRUE(toLocalFrame(webViewImpl->page()->mainFrame()) 175 EXPECT_TRUE(toLocalFrame(webViewImpl->page()->mainFrame())
174 ->loader() 176 ->loader()
175 .documentLoader() 177 .documentLoader()
176 ->isCommittedButEmpty()); 178 ->isCommittedButEmpty());
177 } 179 }
178 180
179 } // namespace blink 181 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698