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

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

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 30 matching lines...) Expand all
41 #include "core/loader/EmptyClients.h" 41 #include "core/loader/EmptyClients.h"
42 #include "core/page/Page.h" 42 #include "core/page/Page.h"
43 #include "core/testing/DummyPageHolder.h" 43 #include "core/testing/DummyPageHolder.h"
44 #include "platform/network/ResourceRequest.h" 44 #include "platform/network/ResourceRequest.h"
45 #include "platform/weborigin/KURL.h" 45 #include "platform/weborigin/KURL.h"
46 #include "public/platform/WebAddressSpace.h" 46 #include "public/platform/WebAddressSpace.h"
47 #include "public/platform/WebCachePolicy.h" 47 #include "public/platform/WebCachePolicy.h"
48 #include "public/platform/WebInsecureRequestPolicy.h" 48 #include "public/platform/WebInsecureRequestPolicy.h"
49 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" 49 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h"
50 #include "testing/gtest/include/gtest/gtest.h" 50 #include "testing/gtest/include/gtest/gtest.h"
51 #include <memory>
52 51
53 namespace blink { 52 namespace blink {
54 53
55 class StubFrameLoaderClientWithParent final : public EmptyFrameLoaderClient { 54 class StubFrameLoaderClientWithParent final : public EmptyFrameLoaderClient {
56 public: 55 public:
57 static StubFrameLoaderClientWithParent* create(Frame* parent) 56 static StubFrameLoaderClientWithParent* create(Frame* parent)
58 { 57 {
59 return new StubFrameLoaderClientWithParent(parent); 58 return new StubFrameLoaderClientWithParent(parent);
60 } 59 }
61 60
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho st(), owner.get()); 115 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho st(), owner.get());
117 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500 ))); 116 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500 )));
118 childFrame->init(); 117 childFrame->init();
119 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData()); 118 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR equest("http://www.example.com"), SubstituteData());
120 childDocument = childFrame->document(); 119 childDocument = childFrame->document();
121 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context()); 120 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(& childDocumentLoader->fetcher()->context());
122 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get()); 121 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc ument.get());
123 return childFetchContext; 122 return childFetchContext;
124 } 123 }
125 124
126 std::unique_ptr<DummyPageHolder> dummyPageHolder; 125 OwnPtr<DummyPageHolder> dummyPageHolder;
127 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long 126 // We don't use the DocumentLoader directly in any tests, but need to keep i t around as long
128 // as the ResourceFetcher and Document live due to indirect usage. 127 // as the ResourceFetcher and Document live due to indirect usage.
129 Persistent<DocumentLoader> documentLoader; 128 Persistent<DocumentLoader> documentLoader;
130 Persistent<Document> document; 129 Persistent<Document> document;
131 Persistent<FrameFetchContext> fetchContext; 130 Persistent<FrameFetchContext> fetchContext;
132 131
133 Persistent<StubFrameLoaderClientWithParent> childClient; 132 Persistent<StubFrameLoaderClientWithParent> childClient;
134 Persistent<LocalFrame> childFrame; 133 Persistent<LocalFrame> childFrame;
135 Persistent<DocumentLoader> childDocumentLoader; 134 Persistent<DocumentLoader> childDocumentLoader;
136 Persistent<Document> childDocument; 135 Persistent<Document> childDocument;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource ); 629 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource );
631 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); 630 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation);
632 631
633 ResourceRequest subRequest(test.url); 632 ResourceRequest subRequest(test.url);
634 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); 633 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource);
635 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); 634 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation);
636 } 635 }
637 } 636 }
638 637
639 } // namespace blink 638 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.cpp ('k') | third_party/WebKit/Source/core/loader/FrameLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698