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

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

Issue 1632523002: `<link rel=preload>` with no `as` should be subject to connect-src (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests Created 4 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 { "http://example.test", "<img src='bla.gif'/>", "bla.gif", "http://exam ple.test/", Resource::Image, 0, ReferrerPolicyNever } 358 { "http://example.test", "<img src='bla.gif'/>", "bla.gif", "http://exam ple.test/", Resource::Image, 0, ReferrerPolicyNever }
359 }; 359 };
360 360
361 for (const auto& testCase : testCases) 361 for (const auto& testCase : testCases)
362 test(testCase); 362 test(testCase);
363 } 363 }
364 364
365 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload) 365 TEST_F(HTMLPreloadScannerTest, testLinkRelPreload)
366 { 366 {
367 TestCase testCases[] = { 367 TestCase testCases[] = {
368 {"http://example.test", "<link rel=preload href=bla>", "bla", "http://ex ample.test/", Resource::LinkSubresource, 0}, 368 {"http://example.test", "<link rel=preload href=bla>", "bla", "http://ex ample.test/", Resource::LinkPreload, 0},
369 {"http://example.test", "<link rel=preload href=bla as=script>", "bla", "http://example.test/", Resource::Script, 0}, 369 {"http://example.test", "<link rel=preload href=bla as=script>", "bla", "http://example.test/", Resource::Script, 0},
370 {"http://example.test", "<link rel=preload href=bla as=style>", "bla", " http://example.test/", Resource::CSSStyleSheet, 0}, 370 {"http://example.test", "<link rel=preload href=bla as=style>", "bla", " http://example.test/", Resource::CSSStyleSheet, 0},
371 {"http://example.test", "<link rel=preload href=bla as=image>", "bla", " http://example.test/", Resource::Image, 0}, 371 {"http://example.test", "<link rel=preload href=bla as=image>", "bla", " http://example.test/", Resource::Image, 0},
372 {"http://example.test", "<link rel=preload href=bla as=font>", "bla", "h ttp://example.test/", Resource::Font, 0}, 372 {"http://example.test", "<link rel=preload href=bla as=font>", "bla", "h ttp://example.test/", Resource::Font, 0},
373 {"http://example.test", "<link rel=preload href=bla as=audio>", "bla", " http://example.test/", Resource::Media, 0}, 373 {"http://example.test", "<link rel=preload href=bla as=audio>", "bla", " http://example.test/", Resource::Media, 0},
374 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", " http://example.test/", Resource::Media, 0}, 374 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", " http://example.test/", Resource::Media, 0},
375 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", " http://example.test/", Resource::TextTrack, 0}, 375 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", " http://example.test/", Resource::TextTrack, 0},
376 }; 376 };
377 377
378 for (const auto& testCase : testCases) 378 for (const auto& testCase : testCases)
379 test(testCase); 379 test(testCase);
380 } 380 }
381 381
382 } // namespace blink 382 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | third_party/WebKit/Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698