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

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

Issue 2970833002: Be explicit about namespace testing to not mix it with blink::testing (Closed)
Patch Set: Created 3 years, 5 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "platform/weborigin/SecurityViolationReportingPolicy.h" 53 #include "platform/weborigin/SecurityViolationReportingPolicy.h"
54 #include "public/platform/WebAddressSpace.h" 54 #include "public/platform/WebAddressSpace.h"
55 #include "public/platform/WebCachePolicy.h" 55 #include "public/platform/WebCachePolicy.h"
56 #include "public/platform/WebDocumentSubresourceFilter.h" 56 #include "public/platform/WebDocumentSubresourceFilter.h"
57 #include "public/platform/WebInsecureRequestPolicy.h" 57 #include "public/platform/WebInsecureRequestPolicy.h"
58 #include "testing/gmock/include/gmock/gmock.h" 58 #include "testing/gmock/include/gmock/gmock.h"
59 #include "testing/gtest/include/gtest/gtest.h" 59 #include "testing/gtest/include/gtest/gtest.h"
60 60
61 namespace blink { 61 namespace blink {
62 62
63 using Checkpoint = testing::StrictMock<testing::MockFunction<void(int)>>; 63 using Checkpoint = ::testing::StrictMock<testing::MockFunction<void(int)>>;
64 64
65 class StubLocalFrameClientWithParent final : public EmptyLocalFrameClient { 65 class StubLocalFrameClientWithParent final : public EmptyLocalFrameClient {
66 public: 66 public:
67 static StubLocalFrameClientWithParent* Create(Frame* parent) { 67 static StubLocalFrameClientWithParent* Create(Frame* parent) {
68 return new StubLocalFrameClientWithParent(parent); 68 return new StubLocalFrameClientWithParent(parent);
69 } 69 }
70 70
71 DEFINE_INLINE_VIRTUAL_TRACE() { 71 DEFINE_INLINE_VIRTUAL_TRACE() {
72 visitor->Trace(parent_); 72 visitor->Trace(parent_);
73 EmptyLocalFrameClient::Trace(visitor); 73 EmptyLocalFrameClient::Trace(visitor);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 int filtered_load_callback_counter_; 207 int filtered_load_callback_counter_;
208 }; 208 };
209 209
210 // This test class sets up a mock frame loader client. 210 // This test class sets up a mock frame loader client.
211 class FrameFetchContextMockedLocalFrameClientTest 211 class FrameFetchContextMockedLocalFrameClientTest
212 : public FrameFetchContextTest { 212 : public FrameFetchContextTest {
213 protected: 213 protected:
214 void SetUp() override { 214 void SetUp() override {
215 url = KURL(NullURL(), "https://example.test/foo"); 215 url = KURL(NullURL(), "https://example.test/foo");
216 main_resource_url = KURL(NullURL(), "https://www.example.test"); 216 main_resource_url = KURL(NullURL(), "https://www.example.test");
217 client = new testing::NiceMock<MockLocalFrameClient>(); 217 client = new ::testing::NiceMock<MockLocalFrameClient>();
218 dummy_page_holder = 218 dummy_page_holder =
219 DummyPageHolder::Create(IntSize(500, 500), nullptr, client); 219 DummyPageHolder::Create(IntSize(500, 500), nullptr, client);
220 dummy_page_holder->GetPage().SetDeviceScaleFactorDeprecated(1.0); 220 dummy_page_holder->GetPage().SetDeviceScaleFactorDeprecated(1.0);
221 document = &dummy_page_holder->GetDocument(); 221 document = &dummy_page_holder->GetDocument();
222 document->SetURL(main_resource_url); 222 document->SetURL(main_resource_url);
223 fetch_context = 223 fetch_context =
224 static_cast<FrameFetchContext*>(&document->Fetcher()->Context()); 224 static_cast<FrameFetchContext*>(&document->Fetcher()->Context());
225 owner = DummyFrameOwner::Create(); 225 owner = DummyFrameOwner::Create();
226 FrameFetchContext::ProvideDocumentToContext(*fetch_context, document.Get()); 226 FrameFetchContext::ProvideDocumentToContext(*fetch_context, document.Get());
227 } 227 }
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 // from the memory cache. 894 // from the memory cache.
895 TEST_F(FrameFetchContextMockedLocalFrameClientTest, 895 TEST_F(FrameFetchContextMockedLocalFrameClientTest,
896 DispatchDidLoadResourceFromMemoryCache) { 896 DispatchDidLoadResourceFromMemoryCache) {
897 ResourceRequest resource_request(url); 897 ResourceRequest resource_request(url);
898 resource_request.SetRequestContext(WebURLRequest::kRequestContextImage); 898 resource_request.SetRequestContext(WebURLRequest::kRequestContextImage);
899 resource_request.SetFetchCredentialsMode( 899 resource_request.SetFetchCredentialsMode(
900 WebURLRequest::kFetchCredentialsModeOmit); 900 WebURLRequest::kFetchCredentialsModeOmit);
901 Resource* resource = MockResource::Create(resource_request); 901 Resource* resource = MockResource::Create(resource_request);
902 EXPECT_CALL(*client, 902 EXPECT_CALL(*client,
903 DispatchDidLoadResourceFromMemoryCache( 903 DispatchDidLoadResourceFromMemoryCache(
904 testing::AllOf( 904 ::testing::AllOf(
905 testing::Property(&ResourceRequest::Url, url), 905 ::testing::Property(&ResourceRequest::Url, url),
906 testing::Property(&ResourceRequest::GetFrameType, 906 ::testing::Property(&ResourceRequest::GetFrameType,
907 WebURLRequest::kFrameTypeNone), 907 WebURLRequest::kFrameTypeNone),
908 testing::Property(&ResourceRequest::GetRequestContext, 908 ::testing::Property(&ResourceRequest::GetRequestContext,
909 WebURLRequest::kRequestContextImage)), 909 WebURLRequest::kRequestContextImage)),
910 ResourceResponse())); 910 ResourceResponse()));
911 fetch_context->DispatchDidLoadResourceFromMemoryCache( 911 fetch_context->DispatchDidLoadResourceFromMemoryCache(
912 CreateUniqueIdentifier(), resource_request, resource->GetResponse()); 912 CreateUniqueIdentifier(), resource_request, resource->GetResponse());
913 } 913 }
914 914
915 // Tests that when a resource with certificate errors is loaded from the memory 915 // Tests that when a resource with certificate errors is loaded from the memory
916 // cache, the embedder is notified. 916 // cache, the embedder is notified.
917 TEST_F(FrameFetchContextMockedLocalFrameClientTest, 917 TEST_F(FrameFetchContextMockedLocalFrameClientTest,
918 MemoryCacheCertificateError) { 918 MemoryCacheCertificateError) {
919 ResourceRequest resource_request(url); 919 ResourceRequest resource_request(url);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 fetch_context->AddAdditionalRequestHeaders(resource_request2, 1318 fetch_context->AddAdditionalRequestHeaders(resource_request2,
1319 kFetchSubresource); 1319 kFetchSubresource);
1320 EXPECT_EQ( 1320 EXPECT_EQ(
1321 "<https://otherintervention.org>, " 1321 "<https://otherintervention.org>, "
1322 "<https://www.chromestatus.com/features/6072546726248448>; " 1322 "<https://www.chromestatus.com/features/6072546726248448>; "
1323 "level=\"warning\"", 1323 "level=\"warning\"",
1324 resource_request2.HttpHeaderField("Intervention")); 1324 resource_request2.HttpHeaderField("Intervention"));
1325 } 1325 }
1326 1326
1327 } // namespace blink 1327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698