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 30 matching lines...) Expand all Loading... |
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> |
51 | 52 |
52 namespace blink { | 53 namespace blink { |
53 | 54 |
54 class StubFrameLoaderClientWithParent final : public EmptyFrameLoaderClient { | 55 class StubFrameLoaderClientWithParent final : public EmptyFrameLoaderClient { |
55 public: | 56 public: |
56 static StubFrameLoaderClientWithParent* create(Frame* parent) | 57 static StubFrameLoaderClientWithParent* create(Frame* parent) |
57 { | 58 { |
58 return new StubFrameLoaderClientWithParent(parent); | 59 return new StubFrameLoaderClientWithParent(parent); |
59 } | 60 } |
60 | 61 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho
st(), owner.get()); | 116 childFrame = LocalFrame::create(childClient.get(), document->frame()->ho
st(), owner.get()); |
116 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500
))); | 117 childFrame->setView(FrameView::create(childFrame.get(), IntSize(500, 500
))); |
117 childFrame->init(); | 118 childFrame->init(); |
118 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR
equest("http://www.example.com"), SubstituteData()); | 119 childDocumentLoader = DocumentLoader::create(childFrame.get(), ResourceR
equest("http://www.example.com"), SubstituteData()); |
119 childDocument = childFrame->document(); | 120 childDocument = childFrame->document(); |
120 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(&
childDocumentLoader->fetcher()->context()); | 121 FrameFetchContext* childFetchContext = static_cast<FrameFetchContext*>(&
childDocumentLoader->fetcher()->context()); |
121 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc
ument.get()); | 122 FrameFetchContext::provideDocumentToContext(*childFetchContext, childDoc
ument.get()); |
122 return childFetchContext; | 123 return childFetchContext; |
123 } | 124 } |
124 | 125 |
125 OwnPtr<DummyPageHolder> dummyPageHolder; | 126 std::unique_ptr<DummyPageHolder> dummyPageHolder; |
126 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long | 127 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long |
127 // as the ResourceFetcher and Document live due to indirect usage. | 128 // as the ResourceFetcher and Document live due to indirect usage. |
128 Persistent<DocumentLoader> documentLoader; | 129 Persistent<DocumentLoader> documentLoader; |
129 Persistent<Document> document; | 130 Persistent<Document> document; |
130 Persistent<FrameFetchContext> fetchContext; | 131 Persistent<FrameFetchContext> fetchContext; |
131 | 132 |
132 Persistent<StubFrameLoaderClientWithParent> childClient; | 133 Persistent<StubFrameLoaderClientWithParent> childClient; |
133 Persistent<LocalFrame> childFrame; | 134 Persistent<LocalFrame> childFrame; |
134 Persistent<DocumentLoader> childDocumentLoader; | 135 Persistent<DocumentLoader> childDocumentLoader; |
135 Persistent<Document> childDocument; | 136 Persistent<Document> childDocument; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource
); | 630 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource
); |
630 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); | 631 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); |
631 | 632 |
632 ResourceRequest subRequest(test.url); | 633 ResourceRequest subRequest(test.url); |
633 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); | 634 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); |
634 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); | 635 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); |
635 } | 636 } |
636 } | 637 } |
637 | 638 |
638 } // namespace blink | 639 } // namespace blink |
OLD | NEW |