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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp

Issue 2823213002: Implement CanRequest in BaseFetchContext (Closed)
Patch Set: make it work with non-document Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
index 3d65c243e60f7c58586bed5346680bf0000b941e..c520331517fbe00f4a128e11a6e7d1b7db7595f2 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp
@@ -469,46 +469,6 @@ TEST_F(FrameFetchContextModifyRequestTest, SendEmbeddingCSPHeader) {
}
}
-// Tests that CanFollowRedirect() checks both report-only and enforced CSP
-// headers.
-TEST_F(FrameFetchContextTest, RedirectChecksReportedAndEnforcedCSP) {
- ContentSecurityPolicy* policy = document->GetContentSecurityPolicy();
- policy->DidReceiveHeader("script-src https://foo.test",
- kContentSecurityPolicyHeaderTypeEnforce,
- kContentSecurityPolicyHeaderSourceHTTP);
- policy->DidReceiveHeader("script-src https://bar.test",
- kContentSecurityPolicyHeaderTypeReport,
- kContentSecurityPolicyHeaderSourceHTTP);
- KURL url(KURL(), "http://baz.test");
- ResourceRequest resource_request(url);
- resource_request.SetRequestContext(WebURLRequest::kRequestContextScript);
- EXPECT_EQ(
- ResourceRequestBlockedReason::CSP,
- fetch_context->CanFollowRedirect(
- Resource::kScript, resource_request, url, ResourceLoaderOptions(),
- SecurityViolationReportingPolicy::kReport,
- FetchParameters::kUseDefaultOriginRestrictionForType));
- EXPECT_EQ(2u, policy->violation_reports_sent_.size());
-}
-
-// Tests that AllowResponse() checks both report-only and enforced CSP headers.
-TEST_F(FrameFetchContextTest, AllowResponseChecksReportedAndEnforcedCSP) {
- ContentSecurityPolicy* policy = document->GetContentSecurityPolicy();
- policy->DidReceiveHeader("script-src https://foo.test",
- kContentSecurityPolicyHeaderTypeEnforce,
- kContentSecurityPolicyHeaderSourceHTTP);
- policy->DidReceiveHeader("script-src https://bar.test",
- kContentSecurityPolicyHeaderTypeReport,
- kContentSecurityPolicyHeaderSourceHTTP);
- KURL url(KURL(), "http://baz.test");
- ResourceRequest resource_request(url);
- resource_request.SetRequestContext(WebURLRequest::kRequestContextScript);
- EXPECT_EQ(ResourceRequestBlockedReason::CSP,
- fetch_context->AllowResponse(Resource::kScript, resource_request,
- url, ResourceLoaderOptions()));
- EXPECT_EQ(2u, policy->violation_reports_sent_.size());
-}
-
// Tests that PopulateResourceRequest() checks report-only CSP headers, so that
// any violations are reported before the request is modified.
TEST_F(FrameFetchContextTest, PopulateResourceRequestChecksReportOnlyCSP) {
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | third_party/WebKit/Source/core/loader/SubresourceFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698