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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "platform/network/ResourceRequest.h" 43 #include "platform/network/ResourceRequest.h"
44 #include "platform/weborigin/KURL.h" 44 #include "platform/weborigin/KURL.h"
45 #include "public/platform/WebAddressSpace.h" 45 #include "public/platform/WebAddressSpace.h"
46 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" 46 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h"
47 #include "testing/gtest/include/gtest/gtest.h" 47 #include "testing/gtest/include/gtest/gtest.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 class StubFrameLoaderClientWithParent final : public EmptyFrameLoaderClient { 51 class StubFrameLoaderClientWithParent final : public EmptyFrameLoaderClient {
52 public: 52 public:
53 static PassOwnPtrWillBeRawPtr<StubFrameLoaderClientWithParent> create(Frame* parent) 53 static RawPtr<StubFrameLoaderClientWithParent> create(Frame* parent)
54 { 54 {
55 return adoptPtrWillBeNoop(new StubFrameLoaderClientWithParent(parent)); 55 return new StubFrameLoaderClientWithParent(parent);
56 } 56 }
57 57
58 DEFINE_INLINE_VIRTUAL_TRACE() 58 DEFINE_INLINE_VIRTUAL_TRACE()
59 { 59 {
60 visitor->trace(m_parent); 60 visitor->trace(m_parent);
61 EmptyFrameLoaderClient::trace(visitor); 61 EmptyFrameLoaderClient::trace(visitor);
62 } 62 }
63 63
64 Frame* parent() const override { return m_parent.get(); } 64 Frame* parent() const override { return m_parent.get(); }
65 65
66 private: 66 private:
67 explicit StubFrameLoaderClientWithParent(Frame* parent) 67 explicit StubFrameLoaderClientWithParent(Frame* parent)
68 : m_parent(parent) 68 : m_parent(parent)
69 { 69 {
70 } 70 }
71 71
72 RawPtrWillBeMember<Frame> m_parent; 72 Member<Frame> m_parent;
73 }; 73 };
74 74
75 class MockFrameLoaderClient : public EmptyFrameLoaderClient { 75 class MockFrameLoaderClient : public EmptyFrameLoaderClient {
76 public: 76 public:
77 MockFrameLoaderClient() 77 MockFrameLoaderClient()
78 : EmptyFrameLoaderClient() 78 : EmptyFrameLoaderClient()
79 { 79 {
80 } 80 }
81 MOCK_METHOD4(didDisplayContentWithCertificateErrors, void(const KURL&, const CString&, const WebURL&, const CString&)); 81 MOCK_METHOD4(didDisplayContentWithCertificateErrors, void(const KURL&, const CString&, const WebURL&, const CString&));
82 }; 82 };
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData()); 115 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData());
116 childDocument = childFrame->document(); 116 childDocument = childFrame->document();
117 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context()); 117 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context());
118 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get()); 118 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get());
119 return childFetchContext; 119 return childFetchContext;
120 } 120 }
121 121
122 OwnPtr<DummyPageHolder> dummyPageHolder; 122 OwnPtr<DummyPageHolder> dummyPageHolder;
123 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long 123 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long
124 // as the ResourceFetcher and Document live due to indirect usage. 124 // as the ResourceFetcher and Document live due to indirect usage.
125 RefPtrWillBePersistent<DocumentLoader> documentLoader; 125 Persistent<DocumentLoader> documentLoader;
126 RefPtrWillBePersistent<Document> document; 126 Persistent<Document> document;
127 Persistent<FrameFetchContext> fetchContext; 127 Persistent<FrameFetchContext> fetchContext;
128 128
129 OwnPtrWillBePersistent<StubFrameLoaderClientWithParent> childClient; 129 Persistent<StubFrameLoaderClientWithParent> childClient;
130 RefPtrWillBePersistent<LocalFrame> childFrame; 130 Persistent<LocalFrame> childFrame;
131 RefPtrWillBePersistent<DocumentLoader> childDocumentLoader; 131 Persistent<DocumentLoader> childDocumentLoader;
132 RefPtrWillBePersistent<Document> childDocument; 132 Persistent<Document> childDocument;
133 OwnPtrWillBePersistent<DummyFrameOwner> owner; 133 Persistent<DummyFrameOwner> owner;
134 }; 134 };
135 135
136 // This test class sets up a mock frame loader client that expects a 136 // This test class sets up a mock frame loader client that expects a
137 // call to didDisplayContentWithCertificateErrors(). 137 // call to didDisplayContentWithCertificateErrors().
138 class FrameFetchContextDisplayedCertificateErrorsTest : public FrameFetchContext Test { 138 class FrameFetchContextDisplayedCertificateErrorsTest : public FrameFetchContext Test {
139 protected: 139 protected:
140 void SetUp() override 140 void SetUp() override
141 { 141 {
142 url = KURL(KURL(), "https://example.test/foo"); 142 url = KURL(KURL(), "https://example.test/foo");
143 securityInfo = "security info"; 143 securityInfo = "security info";
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 // Tests that when a resource with certificate errors is loaded from the 562 // Tests that when a resource with certificate errors is loaded from the
563 // memory cache, the embedder is notified. 563 // memory cache, the embedder is notified.
564 TEST_F(FrameFetchContextDisplayedCertificateErrorsTest, MemoryCacheCertificateEr ror) 564 TEST_F(FrameFetchContextDisplayedCertificateErrorsTest, MemoryCacheCertificateEr ror)
565 { 565 {
566 ResourceRequest resourceRequest(url); 566 ResourceRequest resourceRequest(url);
567 ResourceResponse response; 567 ResourceResponse response;
568 response.setURL(url); 568 response.setURL(url);
569 response.setSecurityInfo(securityInfo); 569 response.setSecurityInfo(securityInfo);
570 response.setHasMajorCertificateErrors(true); 570 response.setHasMajorCertificateErrors(true);
571 RefPtrWillBeRawPtr<Resource> resource = Resource::create(resourceRequest, Re source::Image); 571 RawPtr<Resource> resource = Resource::create(resourceRequest, Resource::Imag e);
572 resource->setResponse(response); 572 resource->setResponse(response);
573 fetchContext->dispatchDidLoadResourceFromMemoryCache(resource.get(), WebURLR equest::FrameTypeNone, WebURLRequest::RequestContextImage); 573 fetchContext->dispatchDidLoadResourceFromMemoryCache(resource.get(), WebURLR equest::FrameTypeNone, WebURLRequest::RequestContextImage);
574 } 574 }
575 575
576 TEST_F(FrameFetchContextTest, SetIsExternalRequestForPublicDocument) 576 TEST_F(FrameFetchContextTest, SetIsExternalRequestForPublicDocument)
577 { 577 {
578 EXPECT_EQ(WebAddressSpacePublic, document->addressSpace()); 578 EXPECT_EQ(WebAddressSpacePublic, document->addressSpace());
579 579
580 struct TestCase { 580 struct TestCase {
581 const char* url; 581 const char* url;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource ); 709 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource );
710 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); 710 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation);
711 711
712 ResourceRequest subRequest(test.url); 712 ResourceRequest subRequest(test.url);
713 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); 713 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource);
714 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); 714 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation);
715 } 715 }
716 } 716 }
717 717
718 } // namespace blink 718 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | third_party/WebKit/Source/core/loader/FrameLoadRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698