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

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

Issue 2440803002: Filter out data urls in the preload scanner (Closed)
Patch Set: nits and test Created 4 years, 1 month 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 "bla", "http://example.test/", Resource::Image, 0}, 718 "bla", "http://example.test/", Resource::Image, 0},
719 {"http://example.test", 719 {"http://example.test",
720 "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">", 720 "<link rel=preload href=bla as=image media=\"(max-width: 400px)\">",
721 nullptr, "http://example.test/", Resource::Image, 0}, 721 nullptr, "http://example.test/", Resource::Image, 0},
722 }; 722 };
723 723
724 for (const auto& testCase : testCases) 724 for (const auto& testCase : testCases)
725 test(testCase); 725 test(testCase);
726 } 726 }
727 727
728 TEST_F(HTMLPreloadScannerTest, testNoDataUrls) {
729 TestCase testCases[] = {
730 {"http://example.test",
731 "<link rel=preload href='data:text/html,<p>data</data>'>", nullptr,
732 "http://example.test/", Resource::Raw, 0},
733 {"http://example.test", "<img src='data:text/html,<p>data</data>'>",
734 nullptr, "http://example.test/", Resource::Image, 0},
735 {"data:text/html,<a>anchor</a>", "<img src='#anchor'>", nullptr,
736 "http://example.test/", Resource::Image, 0},
737 };
738
739 for (const auto& testCase : testCases)
740 test(testCase);
741 }
742
728 } // namespace blink 743 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698