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

Side by Side Diff: third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp

Issue 1845323002: Remove WebUnitTestSupport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/LinkLoader.h" 5 #include "core/loader/LinkLoader.h"
6 6
7 #include "core/fetch/MemoryCache.h" 7 #include "core/fetch/MemoryCache.h"
8 #include "core/fetch/ResourceFetcher.h" 8 #include "core/fetch/ResourceFetcher.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/LinkRelAttribute.h" 10 #include "core/html/LinkRelAttribute.h"
11 #include "core/loader/DocumentLoader.h" 11 #include "core/loader/DocumentLoader.h"
12 #include "core/loader/LinkLoaderClient.h" 12 #include "core/loader/LinkLoaderClient.h"
13 #include "core/loader/NetworkHintsInterface.h" 13 #include "core/loader/NetworkHintsInterface.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include "platform/network/ResourceLoadPriority.h" 15 #include "platform/network/ResourceLoadPriority.h"
16 #include "platform/testing/URLTestHelpers.h" 16 #include "platform/testing/URLTestHelpers.h"
17 #include "public/platform/Platform.h" 17 #include "public/platform/Platform.h"
18 #include "public/platform/WebUnitTestSupport.h" 18 #include "public/platform/WebURLLoaderMockFactory.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include <base/macros.h> 20 #include <base/macros.h>
21 21
22 namespace blink { 22 namespace blink {
23 23
24 class MockLinkLoaderClient final : public GarbageCollectedFinalized<MockLinkLoad erClient>, public LinkLoaderClient { 24 class MockLinkLoaderClient final : public GarbageCollectedFinalized<MockLinkLoad erClient>, public LinkLoaderClient {
25 USING_GARBAGE_COLLECTED_MIXIN(MockLinkLoaderClient); 25 USING_GARBAGE_COLLECTED_MIXIN(MockLinkLoaderClient);
26 public: 26 public:
27 static MockLinkLoaderClient* create(bool shouldLoad) 27 static MockLinkLoaderClient* create(bool shouldLoad)
28 { 28 {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (preloads->size() > 0) { 167 if (preloads->size() > 0) {
168 Resource* resource = preloads->begin().get()->get(); 168 Resource* resource = preloads->begin().get()->get();
169 ASSERT_EQ(testCase.priority, resource->resourceRequest().pri ority()); 169 ASSERT_EQ(testCase.priority, resource->resourceRequest().pri ority());
170 ASSERT_EQ(testCase.context, resource->resourceRequest().requ estContext()); 170 ASSERT_EQ(testCase.context, resource->resourceRequest().requ estContext());
171 ASSERT_STREQ(testCase.accept, resource->accept().getString() .ascii().data()); 171 ASSERT_STREQ(testCase.accept, resource->accept().getString() .ascii().data());
172 } 172 }
173 } 173 }
174 dummyPageHolder->document().fetcher()->clearPreloads(); 174 dummyPageHolder->document().fetcher()->clearPreloads();
175 } 175 }
176 memoryCache()->evictResources(); 176 memoryCache()->evictResources();
177 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 177 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
178 } 178 }
179 } 179 }
180 180
181 TEST(LinkLoaderTest, DNSPrefetch) 181 TEST(LinkLoaderTest, DNSPrefetch)
182 { 182 {
183 struct { 183 struct {
184 const char* href; 184 const char* href;
185 const bool shouldLoad; 185 const bool shouldLoad;
186 } cases[] = { 186 } cases[] = {
187 {"http://example.com/", true}, 187 {"http://example.com/", true},
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 hrefURL, 242 hrefURL,
243 dummyPageHolder->document(), 243 dummyPageHolder->document(),
244 networkHints); 244 networkHints);
245 ASSERT_EQ(testCase.shouldLoad, networkHints.didPreconnect()); 245 ASSERT_EQ(testCase.shouldLoad, networkHints.didPreconnect());
246 ASSERT_EQ(testCase.isHTTPS, networkHints.isHTTPS()); 246 ASSERT_EQ(testCase.isHTTPS, networkHints.isHTTPS());
247 ASSERT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin()); 247 ASSERT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin());
248 } 248 }
249 } 249 }
250 250
251 } // namespace blink 251 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698