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

Unified 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: Addressed all jam@ latest comments. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
diff --git a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
index 3323b620ed051de2d2bcc125b1651d2ba36371fb..859a79c6053bd1a5d6a343ef9ae04b6be0970b64 100644
--- a/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
+++ b/third_party/WebKit/Source/core/loader/MixedContentCheckerTest.cpp
@@ -10,6 +10,8 @@
#include "platform/network/ResourceResponse.h"
#include "platform/weborigin/KURL.h"
#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/WebMixedContent.h"
+#include "public/platform/WebMixedContentContextType.h"
#include "testing/gmock/include/gmock/gmock-generated-function-mockers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/RefPtr.h"
@@ -18,6 +20,11 @@
namespace blink {
+// Tests that MixedContentChecker::isMixedContent correctly detects or ignores
+// many cases where there is or there is not mixed content, respectively.
+// Note: Renderer side version of
+// MixedContentNavigationThrottleTest.IsMixedContent. Must be kept in sync
+// manually!
TEST(MixedContentCheckerTest, IsMixedContent) {
struct TestCase {
const char* origin;
@@ -68,20 +75,20 @@ TEST(MixedContentCheckerTest, ContextTypeForInspector) {
ResourceRequest notMixedContent("https://example.test/foo.jpg");
notMixedContent.setFrameType(WebURLRequest::FrameTypeAuxiliary);
notMixedContent.setRequestContext(WebURLRequest::RequestContextScript);
- EXPECT_EQ(WebMixedContent::ContextType::NotMixedContent,
+ EXPECT_EQ(WebMixedContentContextType::NotMixedContent,
MixedContentChecker::contextTypeForInspector(
&dummyPageHolder->frame(), notMixedContent));
dummyPageHolder->frame().document()->setSecurityOrigin(
SecurityOrigin::createFromString("https://example.test"));
- EXPECT_EQ(WebMixedContent::ContextType::NotMixedContent,
+ EXPECT_EQ(WebMixedContentContextType::NotMixedContent,
MixedContentChecker::contextTypeForInspector(
&dummyPageHolder->frame(), notMixedContent));
ResourceRequest blockableMixedContent("http://example.test/foo.jpg");
blockableMixedContent.setFrameType(WebURLRequest::FrameTypeAuxiliary);
blockableMixedContent.setRequestContext(WebURLRequest::RequestContextScript);
- EXPECT_EQ(WebMixedContent::ContextType::Blockable,
+ EXPECT_EQ(WebMixedContentContextType::Blockable,
MixedContentChecker::contextTypeForInspector(
&dummyPageHolder->frame(), blockableMixedContent));
@@ -89,7 +96,7 @@ TEST(MixedContentCheckerTest, ContextTypeForInspector) {
"http://example.test/foo.jpg");
blockableMixedContent.setFrameType(WebURLRequest::FrameTypeAuxiliary);
blockableMixedContent.setRequestContext(WebURLRequest::RequestContextImage);
- EXPECT_EQ(WebMixedContent::ContextType::OptionallyBlockable,
+ EXPECT_EQ(WebMixedContentContextType::OptionallyBlockable,
MixedContentChecker::contextTypeForInspector(
&dummyPageHolder->frame(), blockableMixedContent));
}
@@ -126,7 +133,7 @@ TEST(MixedContentCheckerTest, HandleCertificateError) {
WebURLRequest::RequestContext requestContext =
WebURLRequest::RequestContextImage;
ASSERT_EQ(
- WebMixedContent::ContextType::OptionallyBlockable,
+ WebMixedContentContextType::OptionallyBlockable,
WebMixedContent::contextTypeFromRequestContext(
requestContext, dummyPageHolder->frame()
.settings()

Powered by Google App Engine
This is Rietveld 408576698