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

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

Issue 2823213002: Implement CanRequest in BaseFetchContext (Closed)
Patch Set: rebase, tests 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 3381bf4e30b499dbc9344e581a7850095812c94a..5540a26fec952a5affade6bc296bb375b7e02cc8 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) {

Powered by Google App Engine
This is Rietveld 408576698