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

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

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Fixed external handling order change for request start and redirects. Created 4 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 // 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"
11 #include "platform/weborigin/KURL.h" 11 #include "platform/weborigin/KURL.h"
12 #include "platform/weborigin/SecurityOrigin.h" 12 #include "platform/weborigin/SecurityOrigin.h"
13 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h" 13 #include "testing/gmock/include/gmock/gmock-generated-function-mockers.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
16 #include <base/macros.h> 16 #include <base/macros.h>
17 #include <memory> 17 #include <memory>
18 18
19 namespace blink { 19 namespace blink {
20 20
21 // Tests that many cases where there is or there is not mixed content are
22 // correctly detected by MixedContentChecker::isMixedContent.
23 // Note: Renderer side version of
24 // MixedContentNavigationThrottleTest.IsMixedContent. Must be kept in sync
25 // manually!
21 TEST(MixedContentCheckerTest, IsMixedContent) 26 TEST(MixedContentCheckerTest, IsMixedContent)
22 { 27 {
23 struct TestCase { 28 struct TestCase {
24 const char* origin; 29 const char* origin;
25 const char* target; 30 const char* target;
26 bool expectation; 31 bool expectation;
27 } cases[] = { 32 } cases[] = {
28 {"http://example.com/foo", "http://example.com/foo", false}, 33 {"http://example.com/foo", "http://example.com/foo", false},
29 {"http://example.com/foo", "https://example.com/foo", false}, 34 {"http://example.com/foo", "https://example.com/foo", false},
30 {"http://example.com/foo", "data:text/html,<p>Hi!</p>", false}, 35 {"http://example.com/foo", "data:text/html,<p>Hi!</p>", false},
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 ResourceResponse response2; 114 ResourceResponse response2;
110 WebURLRequest::RequestContext requestContext = WebURLRequest::RequestContext Image; 115 WebURLRequest::RequestContext requestContext = WebURLRequest::RequestContext Image;
111 ASSERT_EQ(WebMixedContent::ContextType::OptionallyBlockable, WebMixedContent ::contextTypeFromRequestContext(requestContext, dummyPageHolder->frame().setting s()->strictMixedContentCheckingForPlugin())); 116 ASSERT_EQ(WebMixedContent::ContextType::OptionallyBlockable, WebMixedContent ::contextTypeFromRequestContext(requestContext, dummyPageHolder->frame().setting s()->strictMixedContentCheckingForPlugin()));
112 response2.setURL(displayedUrl); 117 response2.setURL(displayedUrl);
113 response2.setSecurityInfo("security info2"); 118 response2.setSecurityInfo("security info2");
114 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl, re sponse2.getSecurityInfo())); 119 EXPECT_CALL(*client, didDisplayContentWithCertificateErrors(displayedUrl, re sponse2.getSecurityInfo()));
115 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), respo nse2, WebURLRequest::FrameTypeNone, requestContext); 120 MixedContentChecker::handleCertificateError(&dummyPageHolder->frame(), respo nse2, WebURLRequest::FrameTypeNone, requestContext);
116 } 121 }
117 122
118 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698