| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 { | 56 { |
| 57 if (!host.isNull()) { | 57 if (!host.isNull()) { |
| 58 EXPECT_TRUE(m_preloadRequest->isPreconnect()); | 58 EXPECT_TRUE(m_preloadRequest->isPreconnect()); |
| 59 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); | 59 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); |
| 60 EXPECT_EQ(m_preloadRequest->isCORS(), crossOrigin != CrossOriginAttr
ibuteNotSet); | 60 EXPECT_EQ(m_preloadRequest->isCORS(), crossOrigin != CrossOriginAttr
ibuteNotSet); |
| 61 EXPECT_EQ(m_preloadRequest->isAllowCredentials(), crossOrigin == Cro
ssOriginAttributeUseCredentials); | 61 EXPECT_EQ(m_preloadRequest->isAllowCredentials(), crossOrigin == Cro
ssOriginAttributeUseCredentials); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 void preload(PassOwnPtr<PreloadRequest> preloadRequest) override | 66 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn
terface&) override |
| 67 { | 67 { |
| 68 m_preloadRequest = preloadRequest; | 68 m_preloadRequest = preloadRequest; |
| 69 } | 69 } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 OwnPtr<PreloadRequest> m_preloadRequest; | 72 OwnPtr<PreloadRequest> m_preloadRequest; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 class HTMLPreloadScannerTest : public testing::Test { | 75 class HTMLPreloadScannerTest : public testing::Test { |
| 76 protected: | 76 protected: |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 {"http://example.test", "<picture><source sizes='50vw' srcset='srcset_bl
a.gif'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://exa
mple.test/", Resource::Image, 250}, | 291 {"http://example.test", "<picture><source sizes='50vw' srcset='srcset_bl
a.gif'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://exa
mple.test/", Resource::Image, 250}, |
| 292 {"http://example.test", "<picture><source srcset='srcset_bla.gif' sizes=
'50vw'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://exa
mple.test/", Resource::Image, 250}, | 292 {"http://example.test", "<picture><source srcset='srcset_bla.gif' sizes=
'50vw'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://exa
mple.test/", Resource::Image, 250}, |
| 293 {"http://example.test", "<picture><source srcset='srcset_bla.gif'><img s
izes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/",
Resource::Image, 0}, | 293 {"http://example.test", "<picture><source srcset='srcset_bla.gif'><img s
izes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/",
Resource::Image, 0}, |
| 294 }; | 294 }; |
| 295 | 295 |
| 296 for (const auto& testCase : testCases) | 296 for (const auto& testCase : testCases) |
| 297 test(testCase); | 297 test(testCase); |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace blink | 300 } // namespace blink |
| OLD | NEW |