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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp

Issue 2620993002: Fix HTMLPreloadScanner handling of type in link preload. (Closed)
Patch Set: Review comments Created 3 years, 11 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/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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 for (const auto& testCase : testCases) 716 for (const auto& testCase : testCases)
717 test(testCase); 717 test(testCase);
718 } 718 }
719 719
720 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) { 720 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) {
721 TestCase testCases[] = { 721 TestCase testCases[] = {
722 {"http://example.test", "<link rel=preload href=bla>", "bla", 722 {"http://example.test", "<link rel=preload href=bla>", "bla",
723 "http://example.test/", Resource::Raw, 0}, 723 "http://example.test/", Resource::Raw, 0},
724 {"http://example.test", "<link rel=preload href=bla as=script>", "bla", 724 {"http://example.test", "<link rel=preload href=bla as=script>", "bla",
725 "http://example.test/", Resource::Script, 0}, 725 "http://example.test/", Resource::Script, 0},
726 {"http://example.test",
727 "<link rel=preload href=bla as=script type='script/foo'>", "bla",
728 "http://example.test/", Resource::Script, 0},
726 {"http://example.test", "<link rel=preload href=bla as=style>", "bla", 729 {"http://example.test", "<link rel=preload href=bla as=style>", "bla",
727 "http://example.test/", Resource::CSSStyleSheet, 0}, 730 "http://example.test/", Resource::CSSStyleSheet, 0},
731 {"http://example.test",
732 "<link rel=preload href=bla as=style type='text/css'>", "bla",
733 "http://example.test/", Resource::CSSStyleSheet, 0},
734 {"http://example.test",
735 "<link rel=preload href=bla as=style type='text/bla'>", nullptr,
736 "http://example.test/", Resource::CSSStyleSheet, 0},
728 {"http://example.test", "<link rel=preload href=bla as=image>", "bla", 737 {"http://example.test", "<link rel=preload href=bla as=image>", "bla",
729 "http://example.test/", Resource::Image, 0}, 738 "http://example.test/", Resource::Image, 0},
739 {"http://example.test",
740 "<link rel=preload href=bla as=image type='image/webp'>", "bla",
741 "http://example.test/", Resource::Image, 0},
742 {"http://example.test",
743 "<link rel=preload href=bla as=image type='image/bla'>", nullptr,
744 "http://example.test/", Resource::Image, 0},
730 {"http://example.test", "<link rel=preload href=bla as=font>", "bla", 745 {"http://example.test", "<link rel=preload href=bla as=font>", "bla",
731 "http://example.test/", Resource::Font, 0}, 746 "http://example.test/", Resource::Font, 0},
747 {"http://example.test",
748 "<link rel=preload href=bla as=font type='font/woff2'>", "bla",
749 "http://example.test/", Resource::Font, 0},
750 {"http://example.test",
751 "<link rel=preload href=bla as=font type='font/bla'>", nullptr,
752 "http://example.test/", Resource::Font, 0},
732 {"http://example.test", "<link rel=preload href=bla as=media>", "bla", 753 {"http://example.test", "<link rel=preload href=bla as=media>", "bla",
733 "http://example.test/", Resource::Media, 0}, 754 "http://example.test/", Resource::Media, 0},
734 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", 755 {"http://example.test", "<link rel=preload href=bla as=track>", "bla",
735 "http://example.test/", Resource::TextTrack, 0}, 756 "http://example.test/", Resource::TextTrack, 0},
736 {"http://example.test", 757 {"http://example.test",
737 "<link rel=preload href=bla as=image media=\"(max-width: 800px)\">", 758 "<link rel=preload href=bla as=image media=\"(max-width: 800px)\">",
738 "bla", "http://example.test/", Resource::Image, 0}, 759 "bla", "http://example.test/", Resource::Image, 0},
739 {"http://example.test", 760 {"http://example.test",
740 "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">", 761 "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">",
741 nullptr, "http://example.test/", Resource::Image, 0}, 762 nullptr, "http://example.test/", Resource::Image, 0},
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 "http://example.test/", Resource::Script, 0}, 836 "http://example.test/", Resource::Script, 0},
816 {"http://example.test", "<link rel=preload href=bla as=fOnT>", "bla", 837 {"http://example.test", "<link rel=preload href=bla as=fOnT>", "bla",
817 "http://example.test/", Resource::Font, 0}, 838 "http://example.test/", Resource::Font, 0},
818 }; 839 };
819 840
820 for (const auto& testCase : testCases) 841 for (const auto& testCase : testCases)
821 test(testCase); 842 test(testCase);
822 } 843 }
823 844
824 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | third_party/WebKit/Source/core/loader/LinkLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698