| 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 601 |
| 602 // Setup the test: | 602 // Setup the test: |
| 603 document->setURL(KURL(ParsedURLString, test.documentURL)); | 603 document->setURL(KURL(ParsedURLString, test.documentURL)); |
| 604 document->setSecurityOrigin(SecurityOrigin::create(document->url())); | 604 document->setSecurityOrigin(SecurityOrigin::create(document->url())); |
| 605 | 605 |
| 606 if (test.documentSandboxed) | 606 if (test.documentSandboxed) |
| 607 document->enforceSandboxFlags(SandboxOrigin); | 607 document->enforceSandboxFlags(SandboxOrigin); |
| 608 | 608 |
| 609 ResourceRequest request("http://example.test/"); | 609 ResourceRequest request("http://example.test/"); |
| 610 request.setFrameType(test.frameType); | 610 request.setFrameType(test.frameType); |
| 611 if (strlen(test.requestorOrigin) == 0) | 611 if (strlen(test.requestorOrigin) == 0) { |
| 612 request.setRequestorOrigin(SecurityOrigin::createUnique()); | 612 request.setRequestorOrigin(SecurityOrigin::createUnique()); |
| 613 else | 613 } else { |
| 614 request.setRequestorOrigin( | 614 request.setRequestorOrigin( |
| 615 SecurityOrigin::create(KURL(ParsedURLString, test.requestorOrigin))); | 615 SecurityOrigin::create(KURL(ParsedURLString, test.requestorOrigin))); |
| 616 } |
| 616 | 617 |
| 617 // Compare the populated |requestorOrigin| against |test.serializedOrigin| | 618 // Compare the populated |requestorOrigin| against |test.serializedOrigin| |
| 618 fetchContext->populateRequestData(request); | 619 fetchContext->populateRequestData(request); |
| 619 if (strlen(test.serializedOrigin) == 0) | 620 if (strlen(test.serializedOrigin) == 0) { |
| 620 EXPECT_TRUE(request.requestorOrigin()->isUnique()); | 621 EXPECT_TRUE(request.requestorOrigin()->isUnique()); |
| 621 else | 622 } else { |
| 622 EXPECT_EQ(String(test.serializedOrigin), | 623 EXPECT_EQ(String(test.serializedOrigin), |
| 623 request.requestorOrigin()->toString()); | 624 request.requestorOrigin()->toString()); |
| 625 } |
| 624 | 626 |
| 625 EXPECT_EQ(document->firstPartyForCookies(), request.firstPartyForCookies()); | 627 EXPECT_EQ(document->firstPartyForCookies(), request.firstPartyForCookies()); |
| 626 } | 628 } |
| 627 } | 629 } |
| 628 | 630 |
| 629 TEST_F(FrameFetchContextTest, ModifyPriorityForLowPriorityIframes) { | 631 TEST_F(FrameFetchContextTest, ModifyPriorityForLowPriorityIframes) { |
| 630 Settings* settings = document->frame()->settings(); | 632 Settings* settings = document->frame()->settings(); |
| 631 settings->setLowPriorityIframes(false); | 633 settings->setLowPriorityIframes(false); |
| 632 FetchRequest request(ResourceRequest("http://www.example.com"), | 634 FetchRequest request(ResourceRequest("http://www.example.com"), |
| 633 FetchInitiatorInfo()); | 635 FetchInitiatorInfo()); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource); | 805 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource); |
| 804 EXPECT_EQ(test.isExternalExpectation, mainRequest.isExternalRequest()); | 806 EXPECT_EQ(test.isExternalExpectation, mainRequest.isExternalRequest()); |
| 805 | 807 |
| 806 ResourceRequest subRequest(test.url); | 808 ResourceRequest subRequest(test.url); |
| 807 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); | 809 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); |
| 808 EXPECT_EQ(test.isExternalExpectation, subRequest.isExternalRequest()); | 810 EXPECT_EQ(test.isExternalExpectation, subRequest.isExternalRequest()); |
| 809 } | 811 } |
| 810 } | 812 } |
| 811 | 813 |
| 812 } // namespace blink | 814 } // namespace blink |
| OLD | NEW |