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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 { "http://example.test", "<meta name='referrer' content='unsafe-url'><im
g src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, Refer
rerPolicyAlways }, | 442 { "http://example.test", "<meta name='referrer' content='unsafe-url'><im
g src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, Refer
rerPolicyAlways }, |
443 }; | 443 }; |
444 | 444 |
445 for (const auto& testCase : testCases) | 445 for (const auto& testCase : testCases) |
446 test(testCase); | 446 test(testCase); |
447 } | 447 } |
448 | 448 |
449 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) | 449 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) |
450 { | 450 { |
451 TestCase testCases[] = { | 451 TestCase testCases[] = { |
452 {"http://example.test", "<link rel=preload href=bla>", "bla", "http://ex
ample.test/", Resource::LinkPreload, 0}, | 452 {"http://example.test", "<link rel=preload href=bla>", "bla", "http://ex
ample.test/", Resource::Raw, 0}, |
453 {"http://example.test", "<link rel=preload href=bla as=script>", "bla",
"http://example.test/", Resource::Script, 0}, | 453 {"http://example.test", "<link rel=preload href=bla as=script>", "bla",
"http://example.test/", Resource::Script, 0}, |
454 {"http://example.test", "<link rel=preload href=bla as=style>", "bla", "
http://example.test/", Resource::CSSStyleSheet, 0}, | 454 {"http://example.test", "<link rel=preload href=bla as=style>", "bla", "
http://example.test/", Resource::CSSStyleSheet, 0}, |
455 {"http://example.test", "<link rel=preload href=bla as=image>", "bla", "
http://example.test/", Resource::Image, 0}, | 455 {"http://example.test", "<link rel=preload href=bla as=image>", "bla", "
http://example.test/", Resource::Image, 0}, |
456 {"http://example.test", "<link rel=preload href=bla as=font>", "bla", "h
ttp://example.test/", Resource::Font, 0}, | 456 {"http://example.test", "<link rel=preload href=bla as=font>", "bla", "h
ttp://example.test/", Resource::Font, 0}, |
457 {"http://example.test", "<link rel=preload href=bla as=media>", "bla", "
http://example.test/", Resource::Media, 0}, | 457 {"http://example.test", "<link rel=preload href=bla as=media>", "bla", "
http://example.test/", Resource::Media, 0}, |
458 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", "
http://example.test/", Resource::TextTrack, 0}, | 458 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", "
http://example.test/", Resource::TextTrack, 0}, |
459 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0}, | 459 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 800px)\">", "bla", "http://example.test/", Resource::Image, 0}, |
460 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0}, | 460 {"http://example.test", "<link rel=preload href=bla as=image media=\"(ma
x-width: 400px)\">", nullptr, "http://example.test/", Resource::Image, 0}, |
461 }; | 461 }; |
462 | 462 |
463 for (const auto& testCase : testCases) | 463 for (const auto& testCase : testCases) |
464 test(testCase); | 464 test(testCase); |
465 } | 465 } |
466 | 466 |
467 } // namespace blink | 467 } // namespace blink |
OLD | NEW |