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

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

Issue 2903653005: [preload] Mandatory `as` value and related spec alignments (Closed)
Patch Set: IDL changes Created 3 years, 6 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 <memory> 7 #include <memory>
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/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 "bla.gif", "http://example.test/", Resource::kImage, 0, 790 "bla.gif", "http://example.test/", Resource::kImage, 0,
791 kReferrerPolicyAlways, nullptr}, 791 kReferrerPolicyAlways, nullptr},
792 }; 792 };
793 793
794 for (const auto& test_case : test_cases) 794 for (const auto& test_case : test_cases)
795 Test(test_case); 795 Test(test_case);
796 } 796 }
797 797
798 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) { 798 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) {
799 TestCase test_cases[] = { 799 TestCase test_cases[] = {
800 {"http://example.test", "<link rel=preload href=bla>", "bla", 800 {"http://example.test", "<link rel=preload as=fetch href=bla>", "bla",
801 "http://example.test/", Resource::kRaw, 0}, 801 "http://example.test/", Resource::kRaw, 0},
802 {"http://example.test", "<link rel=preload href=bla as=script>", "bla", 802 {"http://example.test", "<link rel=preload href=bla as=script>", "bla",
803 "http://example.test/", Resource::kScript, 0}, 803 "http://example.test/", Resource::kScript, 0},
804 {"http://example.test", 804 {"http://example.test",
805 "<link rel=preload href=bla as=script type='script/foo'>", "bla", 805 "<link rel=preload href=bla as=script type='script/foo'>", "bla",
806 "http://example.test/", Resource::kScript, 0}, 806 "http://example.test/", Resource::kScript, 0},
807 {"http://example.test", "<link rel=preload href=bla as=style>", "bla", 807 {"http://example.test", "<link rel=preload href=bla as=style>", "bla",
808 "http://example.test/", Resource::kCSSStyleSheet, 0}, 808 "http://example.test/", Resource::kCSSStyleSheet, 0},
809 {"http://example.test", 809 {"http://example.test",
810 "<link rel=preload href=bla as=style type='text/css'>", "bla", 810 "<link rel=preload href=bla as=style type='text/css'>", "bla",
(...skipping 20 matching lines...) Expand all
831 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", 831 {"http://example.test", "<link rel=preload href=bla as=video>", "bla",
832 "http://example.test/", Resource::kMedia, 0}, 832 "http://example.test/", Resource::kMedia, 0},
833 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", 833 {"http://example.test", "<link rel=preload href=bla as=track>", "bla",
834 "http://example.test/", Resource::kTextTrack, 0}, 834 "http://example.test/", Resource::kTextTrack, 0},
835 {"http://example.test", 835 {"http://example.test",
836 "<link rel=preload href=bla as=image media=\"(max-width: 800px)\">", 836 "<link rel=preload href=bla as=image media=\"(max-width: 800px)\">",
837 "bla", "http://example.test/", Resource::kImage, 0}, 837 "bla", "http://example.test/", Resource::kImage, 0},
838 {"http://example.test", 838 {"http://example.test",
839 "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">", 839 "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">",
840 nullptr, "http://example.test/", Resource::kImage, 0}, 840 nullptr, "http://example.test/", Resource::kImage, 0},
841 {"http://example.test", "<link rel=preload href=bla>", nullptr,
842 "http://example.test/", Resource::kRaw, 0},
841 }; 843 };
842 844
843 for (const auto& test_case : test_cases) 845 for (const auto& test_case : test_cases)
844 Test(test_case); 846 Test(test_case);
845 } 847 }
846 848
847 TEST_F(HTMLPreloadScannerTest, testNoDataUrls) { 849 TEST_F(HTMLPreloadScannerTest, testNoDataUrls) {
848 TestCase test_cases[] = { 850 TestCase test_cases[] = {
849 {"http://example.test", 851 {"http://example.test",
850 "<link rel=preload href='data:text/html,<p>data</data>'>", nullptr, 852 "<link rel=preload href='data:text/html,<p>data</data>'>", nullptr,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 "sheet.css", 935 "sheet.css",
934 "http://example.test/", 936 "http://example.test/",
935 Resource::kCSSStyleSheet, 937 Resource::kCSSStyleSheet,
936 0, 938 0,
937 kReferrerPolicyAlways, 939 kReferrerPolicyAlways,
938 "http://whatever.test/"}; 940 "http://whatever.test/"};
939 Test(test_case); 941 Test(test_case);
940 } 942 }
941 943
942 } // namespace blink 944 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLLinkElement.idl ('k') | third_party/WebKit/Source/core/loader/LinkLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698