| Index: third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp
|
| index b5eef4f1e1ed49f607d84ec42511aabda7374189..edc8abf2890bdd2e12fe98079d89c50509288058 100644
|
| --- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveListTest.cpp
|
| @@ -156,25 +156,27 @@ TEST_F(CSPDirectiveListTest, AllowScriptFromSourceNoNonce) {
|
| };
|
|
|
| for (const auto& test : cases) {
|
| - SCOPED_TRACE(testing::Message() << "List: `" << test.list << "`, URL: `"
|
| - << test.url << "`");
|
| + SCOPED_TRACE(testing::Message()
|
| + << "List: `" << test.list << "`, URL: `" << test.url << "`");
|
| KURL scriptSrc = KURL(KURL(), test.url);
|
|
|
| // Report-only
|
| Member<CSPDirectiveList> directiveList =
|
| createList(test.list, ContentSecurityPolicyHeaderTypeReport);
|
| - EXPECT_EQ(test.expected, directiveList->allowScriptFromSource(
|
| - scriptSrc, String(), ParserInserted,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowScriptFromSource(
|
| + scriptSrc, String(), ParserInserted,
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Enforce
|
| directiveList =
|
| createList(test.list, ContentSecurityPolicyHeaderTypeEnforce);
|
| - EXPECT_EQ(test.expected, directiveList->allowScriptFromSource(
|
| - scriptSrc, String(), ParserInserted,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowScriptFromSource(
|
| + scriptSrc, String(), ParserInserted,
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
| }
|
| }
|
|
|
| @@ -210,66 +212,74 @@ TEST_F(CSPDirectiveListTest, AllowFromSourceWithNonce) {
|
| };
|
|
|
| for (const auto& test : cases) {
|
| - SCOPED_TRACE(testing::Message() << "List: `" << test.list << "`, URL: `"
|
| - << test.url << "`");
|
| + SCOPED_TRACE(testing::Message()
|
| + << "List: `" << test.list << "`, URL: `" << test.url << "`");
|
| KURL resource = KURL(KURL(), test.url);
|
|
|
| // Report-only 'script-src'
|
| Member<CSPDirectiveList> directiveList =
|
| createList(String("script-src ") + test.list,
|
| ContentSecurityPolicyHeaderTypeReport);
|
| - EXPECT_EQ(test.expected, directiveList->allowScriptFromSource(
|
| - resource, String(test.nonce), ParserInserted,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowScriptFromSource(
|
| + resource, String(test.nonce), ParserInserted,
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Enforce 'script-src'
|
| directiveList = createList(String("script-src ") + test.list,
|
| ContentSecurityPolicyHeaderTypeEnforce);
|
| - EXPECT_EQ(test.expected, directiveList->allowScriptFromSource(
|
| - resource, String(test.nonce), ParserInserted,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowScriptFromSource(
|
| + resource, String(test.nonce), ParserInserted,
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Report-only 'style-src'
|
| directiveList = createList(String("style-src ") + test.list,
|
| ContentSecurityPolicyHeaderTypeReport);
|
| - EXPECT_EQ(test.expected, directiveList->allowStyleFromSource(
|
| - resource, String(test.nonce),
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowStyleFromSource(
|
| + resource, String(test.nonce),
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Enforce 'style-src'
|
| directiveList = createList(String("style-src ") + test.list,
|
| ContentSecurityPolicyHeaderTypeEnforce);
|
| - EXPECT_EQ(test.expected, directiveList->allowStyleFromSource(
|
| - resource, String(test.nonce),
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowStyleFromSource(
|
| + resource, String(test.nonce),
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Report-only 'style-src'
|
| directiveList = createList(String("default-src ") + test.list,
|
| ContentSecurityPolicyHeaderTypeReport);
|
| - EXPECT_EQ(test.expected, directiveList->allowScriptFromSource(
|
| - resource, String(test.nonce), ParserInserted,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| - EXPECT_EQ(test.expected, directiveList->allowStyleFromSource(
|
| - resource, String(test.nonce),
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowScriptFromSource(
|
| + resource, String(test.nonce), ParserInserted,
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowStyleFromSource(
|
| + resource, String(test.nonce),
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Enforce 'style-src'
|
| directiveList = createList(String("default-src ") + test.list,
|
| ContentSecurityPolicyHeaderTypeEnforce);
|
| - EXPECT_EQ(test.expected, directiveList->allowScriptFromSource(
|
| - resource, String(test.nonce), ParserInserted,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| - EXPECT_EQ(test.expected, directiveList->allowStyleFromSource(
|
| - resource, String(test.nonce),
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowScriptFromSource(
|
| + resource, String(test.nonce), ParserInserted,
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(test.expected,
|
| + directiveList->allowStyleFromSource(
|
| + resource, String(test.nonce),
|
| + ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
| }
|
| }
|
|
|
| @@ -381,18 +391,20 @@ TEST_F(CSPDirectiveListTest, allowRequestWithoutIntegrity) {
|
| // Report-only
|
| Member<CSPDirectiveList> directiveList =
|
| createList(test.list, ContentSecurityPolicyHeaderTypeReport);
|
| - EXPECT_EQ(true, directiveList->allowRequestWithoutIntegrity(
|
| - test.context, resource,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(
|
| + true,
|
| + directiveList->allowRequestWithoutIntegrity(
|
| + test.context, resource, ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
|
|
| // Enforce
|
| directiveList =
|
| createList(test.list, ContentSecurityPolicyHeaderTypeEnforce);
|
| - EXPECT_EQ(test.expected, directiveList->allowRequestWithoutIntegrity(
|
| - test.context, resource,
|
| - ResourceRequest::RedirectStatus::NoRedirect,
|
| - ContentSecurityPolicy::SuppressReport));
|
| + EXPECT_EQ(
|
| + test.expected,
|
| + directiveList->allowRequestWithoutIntegrity(
|
| + test.context, resource, ResourceRequest::RedirectStatus::NoRedirect,
|
| + ContentSecurityPolicy::SuppressReport));
|
| }
|
| }
|
|
|
|
|