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

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

Issue 2315443003: Stop sending serialized SSLStatus to the renderer. (Closed)
Patch Set: self review fix and merge fix Created 4 years, 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/MixedContentChecker.h" 5 #include "core/loader/MixedContentChecker.h"
6 6
7 #include "core/frame/Settings.h" 7 #include "core/frame/Settings.h"
8 #include "core/loader/EmptyClients.h" 8 #include "core/loader/EmptyClients.h"
9 #include "core/testing/DummyPageHolder.h" 9 #include "core/testing/DummyPageHolder.h"
10 #include "platform/network/ResourceResponse.h" 10 #include "platform/network/ResourceResponse.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 namespace { 79 namespace {
80 80
81 class MockFrameLoaderClient : public EmptyFrameLoaderClient { 81 class MockFrameLoaderClient : public EmptyFrameLoaderClient {
82 public: 82 public:
83 MockFrameLoaderClient() 83 MockFrameLoaderClient()
84 : EmptyFrameLoaderClient() 84 : EmptyFrameLoaderClient()
85 { 85 {
86 } 86 }
87 MOCK_METHOD2(didDisplayContentWithCertificateErrors, void(const KURL&, c onst CString&)); 87 MOCK_METHOD1(didDisplayContentWithCertificateErrors, void(const KURL&));
88 MOCK_METHOD2(didRunContentWithCertificateErrors, void(const KURL&, const CString&)); 88 MOCK_METHOD1(didRunContentWithCertificateErrors, void(const KURL&));
89 }; 89 };
90 90
91 } // namespace 91 } // namespace
92 92
93 TEST(MixedContentCheckerTest, HandleCertificateError) 93 TEST(MixedContentCheckerTest, HandleCertificateError)
94 { 94 {
95 MockFrameLoaderClient* client = new MockFrameLoaderClient; 95 MockFrameLoaderClient* client = new MockFrameLoaderClient;
96 std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(I ntSize(1, 1), nullptr, client); 96 std::unique_ptr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(I ntSize(1, 1), nullptr, client);
97 97
98 KURL mainResourceUrl(KURL(), "https://example.test"); 98 KURL mainResourceUrl(KURL(), "https://example.test");
99 KURL displayedUrl(KURL(), "https://example-displayed.test"); 99 KURL displayedUrl(KURL(), "https://example-displayed.test");
100 KURL ranUrl(KURL(), "https://example-ran.test"); 100 KURL ranUrl(KURL(), "https://example-ran.test");
101 101
102 dummyPageHolder->frame().document()->setURL(mainResourceUrl); 102 dummyPageHolder->frame().document()->setURL(mainResourceUrl);
103 ResourceResponse response1; 103 ResourceResponse response1;
104 response1.setURL(ranUrl); 104 response1.setURL(ranUrl);
105 response1.setSecurityInfo("security info1"); 105 EXPECT_CALL(*client, didRunContentWithCertificateErrors(ranUrl));
106 EXPECT_CALL(*client, didRunContentWithCertificateErrors(ranUrl, response1.ge tSecurityInfo()));
107 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), respo nse1, WebURLRequest::FrameTypeNone, WebURLRequest::RequestContextScript); 106 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), respo nse1, WebURLRequest::FrameTypeNone, WebURLRequest::RequestContextScript);
108 107
109 ResourceResponse response2; 108 ResourceResponse response2;
110 WebURLRequest::RequestContext requestContext = WebURLRequest::RequestContext Image; 109 WebURLRequest::RequestContext requestContext = WebURLRequest::RequestContext Image;
111 ASSERT_EQ(WebMixedContent::ContextType::OptionallyBlockable, WebMixedContent ::contextTypeFromRequestContext(requestContext, dummyPageHolder->frame().setting s()->strictMixedContentCheckingForPlugin())); 110 ASSERT_EQ(WebMixedContent::ContextType::OptionallyBlockable, WebMixedContent ::contextTypeFromRequestContext(requestContext, dummyPageHolder->frame().setting s()->strictMixedContentCheckingForPlugin()));
112 response2.setURL(displayedUrl); 111 response2.setURL(displayedUrl);
113 response2.setSecurityInfo("security info2"); 112 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl));
114 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl, re sponse2.getSecurityInfo()));
115 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), respo nse2, WebURLRequest::FrameTypeNone, requestContext); 113 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), respo nse2, WebURLRequest::FrameTypeNone, requestContext);
116 } 114 }
117 115
118 } // namespace blink 116 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698