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 "core/html/parser/HTMLPreloadScanner.h" | 5 #include "core/html/parser/HTMLPreloadScanner.h" |
6 | 6 |
7 #include "core/MediaTypeNames.h" | 7 #include "core/MediaTypeNames.h" |
8 #include "core/css/MediaValuesCached.h" | 8 #include "core/css/MediaValuesCached.h" |
9 #include "core/fetch/ClientHintsPreferences.h" | 9 #include "core/fetch/ClientHintsPreferences.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 void preconnectRequestVerification(const String& host, CrossOriginAttributeV
alue crossOrigin) | 73 void preconnectRequestVerification(const String& host, CrossOriginAttributeV
alue crossOrigin) |
74 { | 74 { |
75 if (!host.isNull()) { | 75 if (!host.isNull()) { |
76 EXPECT_TRUE(m_preloadRequest->isPreconnect()); | 76 EXPECT_TRUE(m_preloadRequest->isPreconnect()); |
77 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); | 77 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as
cii().data()); |
78 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin); | 78 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 protected: | 82 protected: |
83 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn
terface&) override | 83 void preload(PassOwnPtr<PreloadRequest> preloadRequest) override |
84 { | 84 { |
85 m_preloadRequest = std::move(preloadRequest); | 85 m_preloadRequest = std::move(preloadRequest); |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 OwnPtr<PreloadRequest> m_preloadRequest; | 89 OwnPtr<PreloadRequest> m_preloadRequest; |
90 }; | 90 }; |
91 | 91 |
92 class HTMLPreloadScannerTest : public testing::Test { | 92 class HTMLPreloadScannerTest : public testing::Test { |
93 protected: | 93 protected: |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", "
http://example.test/", Resource::TextTrack, 0}, | 407 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", "
http://example.test/", Resource::TextTrack, 0}, |
408 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0}, | 408 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0}, |
409 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0}, | 409 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0}, |
410 }; | 410 }; |
411 | 411 |
412 for (const auto& testCase : testCases) | 412 for (const auto& testCase : testCases) |
413 test(testCase); | 413 test(testCase); |
414 } | 414 } |
415 | 415 |
416 } // namespace blink | 416 } // namespace blink |
OLD | NEW |