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 "config.h" | 5 #include "config.h" |
6 #include "core/html/parser/HTMLPreloadScanner.h" | 6 #include "core/html/parser/HTMLPreloadScanner.h" |
7 | 7 |
8 #include "core/MediaTypeNames.h" | 8 #include "core/MediaTypeNames.h" |
9 #include "core/css/MediaValuesCached.h" | 9 #include "core/css/MediaValuesCached.h" |
10 #include "core/fetch/ClientHintsPreferences.h" | 10 #include "core/fetch/ClientHintsPreferences.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 { | 66 { |
67 preloadRequestVerification(type, url, baseURL, width, ClientHintsPrefere
nces()); | 67 preloadRequestVerification(type, url, baseURL, width, ClientHintsPrefere
nces()); |
68 EXPECT_EQ(referrerPolicy, m_preloadRequest->referrerPolicy()); | 68 EXPECT_EQ(referrerPolicy, m_preloadRequest->referrerPolicy()); |
69 } | 69 } |
70 | 70 |
71 void preconnectRequestVerification(const String& host, CrossOriginAttributeV
alue crossOrigin) | 71 void preconnectRequestVerification(const String& host, CrossOriginAttributeV
alue crossOrigin) |
72 { | 72 { |
73 if (!host.isNull()) { | 73 if (!host.isNull()) { |
74 EXPECT_TRUE(m_preloadRequest->isPreconnect()); | 74 EXPECT_TRUE(m_preloadRequest->isPreconnect()); |
75 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); | 75 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); |
76 EXPECT_EQ(m_preloadRequest->isCORS(), crossOrigin != CrossOriginAttr
ibuteNotSet); | 76 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin); |
77 EXPECT_EQ(m_preloadRequest->isAllowCredentials(), crossOrigin == Cro
ssOriginAttributeUseCredentials); | |
78 } | 77 } |
79 } | 78 } |
80 | 79 |
81 protected: | 80 protected: |
82 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn
terface&) override | 81 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn
terface&) override |
83 { | 82 { |
84 m_preloadRequest = preloadRequest; | 83 m_preloadRequest = preloadRequest; |
85 } | 84 } |
86 | 85 |
87 private: | 86 private: |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // The scanner's state is not reset between test cases, so all subsequen
t test cases have a document referrer policy of no-referrer. | 356 // The scanner's state is not reset between test cases, so all subsequen
t test cases have a document referrer policy of no-referrer. |
358 { "http://example.test", "<img referrerpolicy='not-a-valid-policy' src='
bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPoli
cyNever }, | 357 { "http://example.test", "<img referrerpolicy='not-a-valid-policy' src='
bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPoli
cyNever }, |
359 { "http://example.test", "<img src='bla.gif'/>", "bla.gif", "http://exam
ple.test/", Resource::Image, 0, ReferrerPolicyNever } | 358 { "http://example.test", "<img src='bla.gif'/>", "bla.gif", "http://exam
ple.test/", Resource::Image, 0, ReferrerPolicyNever } |
360 }; | 359 }; |
361 | 360 |
362 for (const auto& testCase : testCases) | 361 for (const auto& testCase : testCases) |
363 test(testCase); | 362 test(testCase); |
364 } | 363 } |
365 | 364 |
366 } // namespace blink | 365 } // namespace blink |
OLD | NEW |