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

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

Issue 2399473002: Remove Resource::create() to ensure proper subclasses of Resource are created (Closed)
Patch Set: Rebase Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 606 }
607 607
608 // Tests that when a resource with certificate errors is loaded from the memory 608 // Tests that when a resource with certificate errors is loaded from the memory
609 // cache, the embedder is notified. 609 // cache, the embedder is notified.
610 TEST_F(FrameFetchContextDisplayedCertificateErrorsTest, 610 TEST_F(FrameFetchContextDisplayedCertificateErrorsTest,
611 MemoryCacheCertificateError) { 611 MemoryCacheCertificateError) {
612 ResourceRequest resourceRequest(url); 612 ResourceRequest resourceRequest(url);
613 ResourceResponse response; 613 ResourceResponse response;
614 response.setURL(url); 614 response.setURL(url);
615 response.setHasMajorCertificateErrors(true); 615 response.setHasMajorCertificateErrors(true);
616 Resource* resource = Resource::create(resourceRequest, Resource::Image); 616 Resource* resource = ImageResource::create(resourceRequest);
617 resource->setResponse(response); 617 resource->setResponse(response);
618 fetchContext->dispatchDidLoadResourceFromMemoryCache( 618 fetchContext->dispatchDidLoadResourceFromMemoryCache(
619 createUniqueIdentifier(), resource, WebURLRequest::FrameTypeNone, 619 createUniqueIdentifier(), resource, WebURLRequest::FrameTypeNone,
620 WebURLRequest::RequestContextImage); 620 WebURLRequest::RequestContextImage);
621 } 621 }
622 622
623 TEST_F(FrameFetchContextTest, SetIsExternalRequestForPublicDocument) { 623 TEST_F(FrameFetchContextTest, SetIsExternalRequestForPublicDocument) {
624 EXPECT_EQ(WebAddressSpacePublic, document->addressSpace()); 624 EXPECT_EQ(WebAddressSpacePublic, document->addressSpace());
625 625
626 struct TestCase { 626 struct TestCase {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource); 738 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource);
739 EXPECT_EQ(test.isExternalExpectation, mainRequest.isExternalRequest()); 739 EXPECT_EQ(test.isExternalExpectation, mainRequest.isExternalRequest());
740 740
741 ResourceRequest subRequest(test.url); 741 ResourceRequest subRequest(test.url);
742 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); 742 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource);
743 EXPECT_EQ(test.isExternalExpectation, subRequest.isExternalRequest()); 743 EXPECT_EQ(test.isExternalExpectation, subRequest.isExternalRequest());
744 } 744 }
745 } 745 }
746 746
747 } // namespace blink 747 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698