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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 /* 1 /*
2 * Copyright (c) 2015, Google Inc. All rights reserved. 2 * Copyright (c) 2015, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 fetchContext->modifyRequestForCSP(resourceRequest); 259 fetchContext->modifyRequestForCSP(resourceRequest);
260 260
261 EXPECT_EQ( 261 EXPECT_EQ(
262 shouldPrefer ? String("1") : String(), 262 shouldPrefer ? String("1") : String(),
263 resourceRequest.httpHeaderField(HTTPNames::Upgrade_Insecure_Requests)); 263 resourceRequest.httpHeaderField(HTTPNames::Upgrade_Insecure_Requests));
264 264
265 // Calling modifyRequestForCSP more than once shouldn't affect the 265 // Calling modifyRequestForCSP more than once shouldn't affect the
266 // header. 266 // header.
267 if (shouldPrefer) { 267 if (shouldPrefer) {
268 fetchContext->modifyRequestForCSP(resourceRequest); 268 fetchContext->modifyRequestForCSP(resourceRequest);
269 EXPECT_EQ("1", resourceRequest.httpHeaderField( 269 EXPECT_EQ("1",
270 HTTPNames::Upgrade_Insecure_Requests)); 270 resourceRequest.httpHeaderField(
271 HTTPNames::Upgrade_Insecure_Requests));
271 } 272 }
272 } 273 }
273 274
274 void expectSetEmbeddingCSPRequestHeader( 275 void expectSetEmbeddingCSPRequestHeader(
275 const char* input, 276 const char* input,
276 WebURLRequest::FrameType frameType, 277 WebURLRequest::FrameType frameType,
277 const AtomicString& expectedEmbeddingCSP) { 278 const AtomicString& expectedEmbeddingCSP) {
278 KURL inputURL(ParsedURLString, input); 279 KURL inputURL(ParsedURLString, input);
279 ResourceRequest resourceRequest(inputURL); 280 ResourceRequest resourceRequest(inputURL);
280 resourceRequest.setRequestContext(WebURLRequest::RequestContextScript); 281 resourceRequest.setRequestContext(WebURLRequest::RequestContextScript);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 627
627 // If the request's frame type is not 'none', then 628 // If the request's frame type is not 'none', then
628 // 'setFirstPartyCookieAndRequestorOrigin' 629 // 'setFirstPartyCookieAndRequestorOrigin'
629 // leaves it alone: 630 // leaves it alone:
630 {"http://example.test", false, "", WebURLRequest::FrameTypeTopLevel, ""}, 631 {"http://example.test", false, "", WebURLRequest::FrameTypeTopLevel, ""},
631 {"http://example.test", false, "", WebURLRequest::FrameTypeAuxiliary, ""}, 632 {"http://example.test", false, "", WebURLRequest::FrameTypeAuxiliary, ""},
632 {"http://example.test", false, "", WebURLRequest::FrameTypeNested, ""}, 633 {"http://example.test", false, "", WebURLRequest::FrameTypeNested, ""},
633 }; 634 };
634 635
635 for (const auto& test : cases) { 636 for (const auto& test : cases) {
636 SCOPED_TRACE(::testing::Message() << test.documentURL << " => " 637 SCOPED_TRACE(::testing::Message()
637 << test.serializedOrigin); 638 << test.documentURL << " => " << test.serializedOrigin);
638 // Set up a new document to ensure sandbox flags are cleared: 639 // Set up a new document to ensure sandbox flags are cleared:
639 dummyPageHolder = DummyPageHolder::create(IntSize(500, 500)); 640 dummyPageHolder = DummyPageHolder::create(IntSize(500, 500));
640 dummyPageHolder->page().setDeviceScaleFactor(1.0); 641 dummyPageHolder->page().setDeviceScaleFactor(1.0);
641 document = &dummyPageHolder->document(); 642 document = &dummyPageHolder->document();
642 FrameFetchContext::provideDocumentToContext(*fetchContext, document.get()); 643 FrameFetchContext::provideDocumentToContext(*fetchContext, document.get());
643 644
644 // Setup the test: 645 // Setup the test:
645 document->setURL(KURL(ParsedURLString, test.documentURL)); 646 document->setURL(KURL(ParsedURLString, test.documentURL));
646 document->setSecurityOrigin(SecurityOrigin::create(document->url())); 647 document->setSecurityOrigin(SecurityOrigin::create(document->url()));
647 648
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 setFilterPolicy(WebDocumentSubresourceFilter::WouldDisallow); 902 setFilterPolicy(WebDocumentSubresourceFilter::WouldDisallow);
902 903
903 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequest()); 904 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequest());
904 EXPECT_EQ(0, getFilteredLoadCallCount()); 905 EXPECT_EQ(0, getFilteredLoadCallCount());
905 906
906 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequestPreload()); 907 EXPECT_EQ(ResourceRequestBlockedReason::None, canRequestPreload());
907 EXPECT_EQ(0, getFilteredLoadCallCount()); 908 EXPECT_EQ(0, getFilteredLoadCallCount());
908 } 909 }
909 910
910 } // namespace blink 911 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698