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

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

Issue 2834733003: Separate preaload matching from MemoryCache (Closed)
Patch Set: fix 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/LinkLoader.h" 5 #include "core/loader/LinkLoader.h"
6 6
7 #include <base/macros.h> 7 #include <base/macros.h>
8 #include <memory> 8 #include <memory>
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/LinkRelAttribute.h" 10 #include "core/html/LinkRelAttribute.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 URLTestHelpers::RegisterMockedErrorURLLoad(href_url); 120 URLTestHelpers::RegisterMockedErrorURLLoad(href_url);
121 loader->LoadLink(LinkRelAttribute("preload"), kCrossOriginAttributeNotSet, 121 loader->LoadLink(LinkRelAttribute("preload"), kCrossOriginAttributeNotSet,
122 test_case.type, test_case.as, test_case.media, 122 test_case.type, test_case.as, test_case.media,
123 test_case.referrer_policy, href_url, 123 test_case.referrer_policy, href_url,
124 dummy_page_holder->GetDocument(), NetworkHintsMock()); 124 dummy_page_holder->GetDocument(), NetworkHintsMock());
125 if (test_case.expecting_load && 125 if (test_case.expecting_load &&
126 test_case.priority != kResourceLoadPriorityUnresolved) { 126 test_case.priority != kResourceLoadPriorityUnresolved) {
127 ASSERT_EQ(1, fetcher->CountPreloads()); 127 ASSERT_EQ(1, fetcher->CountPreloads());
128 Resource* resource = loader->LinkPreloadedResourceForTesting(); 128 Resource* resource = loader->LinkPreloadedResourceForTesting();
129 ASSERT_NE(resource, nullptr); 129 ASSERT_NE(resource, nullptr);
130 EXPECT_TRUE(fetcher->ContainsAsPreloadForTesting(resource)); 130 EXPECT_TRUE(fetcher->ContainsAsPreload(resource));
131 EXPECT_EQ(test_case.priority, resource->GetResourceRequest().Priority()); 131 EXPECT_EQ(test_case.priority, resource->GetResourceRequest().Priority());
132 EXPECT_EQ(test_case.context, 132 EXPECT_EQ(test_case.context,
133 resource->GetResourceRequest().GetRequestContext()); 133 resource->GetResourceRequest().GetRequestContext());
134 if (test_case.expected_referrer_policy != kReferrerPolicyDefault) { 134 if (test_case.expected_referrer_policy != kReferrerPolicyDefault) {
135 EXPECT_EQ(test_case.expected_referrer_policy, 135 EXPECT_EQ(test_case.expected_referrer_policy,
136 resource->GetResourceRequest().GetReferrerPolicy()); 136 resource->GetResourceRequest().GetReferrerPolicy());
137 } 137 }
138 } else { 138 } else {
139 ASSERT_EQ(0, fetcher->CountPreloads()); 139 ASSERT_EQ(0, fetcher->CountPreloads());
140 } 140 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 href_url, dummy_page_holder->GetDocument(), network_hints); 374 href_url, dummy_page_holder->GetDocument(), network_hints);
375 EXPECT_EQ(test_case.should_load, network_hints.DidPreconnect()); 375 EXPECT_EQ(test_case.should_load, network_hints.DidPreconnect());
376 EXPECT_EQ(test_case.is_https, network_hints.IsHTTPS()); 376 EXPECT_EQ(test_case.is_https, network_hints.IsHTTPS());
377 EXPECT_EQ(test_case.is_cross_origin, network_hints.IsCrossOrigin()); 377 EXPECT_EQ(test_case.is_cross_origin, network_hints.IsCrossOrigin());
378 } 378 }
379 } 379 }
380 380
381 } // namespace 381 } // namespace
382 382
383 } // namespace blink 383 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.cpp ('k') | third_party/WebKit/Source/platform/loader/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698