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

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

Issue 1487343002: Set credentials mode "same-origin" when crossOrigin=anonymous is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 "config.h" 5 #include "config.h"
6 #include "core/html/parser/HTMLPreloadScanner.h" 6 #include "core/html/parser/HTMLPreloadScanner.h"
7 7
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/fetch/ClientHintsPreferences.h" 10 #include "core/fetch/ClientHintsPreferences.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 { 66 {
67 preloadRequestVerification(type, url, baseURL, width, ClientHintsPrefere nces()); 67 preloadRequestVerification(type, url, baseURL, width, ClientHintsPrefere nces());
68 EXPECT_EQ(referrerPolicy, m_preloadRequest->referrerPolicy()); 68 EXPECT_EQ(referrerPolicy, m_preloadRequest->referrerPolicy());
69 } 69 }
70 70
71 void preconnectRequestVerification(const String& host, CrossOriginAttributeV alue crossOrigin) 71 void preconnectRequestVerification(const String& host, CrossOriginAttributeV alue crossOrigin)
72 { 72 {
73 if (!host.isNull()) { 73 if (!host.isNull()) {
74 EXPECT_TRUE(m_preloadRequest->isPreconnect()); 74 EXPECT_TRUE(m_preloadRequest->isPreconnect());
75 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as cii().data()); 75 EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.as cii().data());
76 EXPECT_EQ(m_preloadRequest->isCORS(), crossOrigin != CrossOriginAttr ibuteNotSet); 76 EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin);
77 EXPECT_EQ(m_preloadRequest->isAllowCredentials(), crossOrigin == Cro ssOriginAttributeUseCredentials);
78 } 77 }
79 } 78 }
80 79
81 protected: 80 protected:
82 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn terface&) override 81 void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsIn terface&) override
83 { 82 {
84 m_preloadRequest = preloadRequest; 83 m_preloadRequest = preloadRequest;
85 } 84 }
86 85
87 private: 86 private:
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // The scanner's state is not reset between test cases, so all subsequen t test cases have a document referrer policy of no-referrer. 356 // The scanner's state is not reset between test cases, so all subsequen t test cases have a document referrer policy of no-referrer.
358 { "http://example.test", "<img referrerpolicy='not-a-valid-policy' src=' bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPoli cyNever }, 357 { "http://example.test", "<img referrerpolicy='not-a-valid-policy' src=' bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPoli cyNever },
359 { "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 }
360 }; 359 };
361 360
362 for (const auto& testCase : testCases) 361 for (const auto& testCase : testCases)
363 test(testCase); 362 test(testCase);
364 } 363 }
365 364
366 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698