| OLD | NEW |
| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 TEST_F(FrameFetchContextModifyRequestTest, SendEmbeddingCSPHeader) { | 373 TEST_F(FrameFetchContextModifyRequestTest, SendEmbeddingCSPHeader) { |
| 374 struct TestCase { | 374 struct TestCase { |
| 375 const char* toRequest; | 375 const char* toRequest; |
| 376 WebURLRequest::FrameType frameType; | 376 WebURLRequest::FrameType frameType; |
| 377 } tests[] = { | 377 } tests[] = { |
| 378 {"https://example.test/page.html", WebURLRequest::FrameTypeAuxiliary}, | 378 {"https://example.test/page.html", WebURLRequest::FrameTypeAuxiliary}, |
| 379 {"https://example.test/page.html", WebURLRequest::FrameTypeNested}, | 379 {"https://example.test/page.html", WebURLRequest::FrameTypeNested}, |
| 380 {"https://example.test/page.html", WebURLRequest::FrameTypeNone}, | 380 {"https://example.test/page.html", WebURLRequest::FrameTypeNone}, |
| 381 {"https://example.test/page.html", WebURLRequest::FrameTypeTopLevel}}; | 381 {"https://example.test/page.html", WebURLRequest::FrameTypeTopLevel}}; |
| 382 | 382 |
| 383 HTMLIFrameElement* iframe = HTMLIFrameElement::create(*document); | 383 HTMLIFrameElement* iframe = HTMLIFrameElement::create(*document, false); |
| 384 const AtomicString& requiredCSP = AtomicString("default-src 'none'"); | 384 const AtomicString& requiredCSP = AtomicString("default-src 'none'"); |
| 385 const AtomicString& anotherRequiredCSP = AtomicString("default-src 'self'"); | 385 const AtomicString& anotherRequiredCSP = AtomicString("default-src 'self'"); |
| 386 | 386 |
| 387 for (const auto& test : tests) { | 387 for (const auto& test : tests) { |
| 388 setFrameOwnerBasedOnFrameType(test.frameType, iframe, requiredCSP); | 388 setFrameOwnerBasedOnFrameType(test.frameType, iframe, requiredCSP); |
| 389 expectSetEmbeddingCSPRequestHeader( | 389 expectSetEmbeddingCSPRequestHeader( |
| 390 test.toRequest, test.frameType, | 390 test.toRequest, test.frameType, |
| 391 test.frameType == WebURLRequest::FrameTypeNested ? requiredCSP | 391 test.frameType == WebURLRequest::FrameTypeNested ? requiredCSP |
| 392 : nullAtom); | 392 : nullAtom); |
| 393 | 393 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource); | 803 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource); |
| 804 EXPECT_EQ(test.isExternalExpectation, mainRequest.isExternalRequest()); | 804 EXPECT_EQ(test.isExternalExpectation, mainRequest.isExternalRequest()); |
| 805 | 805 |
| 806 ResourceRequest subRequest(test.url); | 806 ResourceRequest subRequest(test.url); |
| 807 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); | 807 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); |
| 808 EXPECT_EQ(test.isExternalExpectation, subRequest.isExternalRequest()); | 808 EXPECT_EQ(test.isExternalExpectation, subRequest.isExternalRequest()); |
| 809 } | 809 } |
| 810 } | 810 } |
| 811 | 811 |
| 812 } // namespace blink | 812 } // namespace blink |
| OLD | NEW |