Index: Source/core/loader/MixedContentCheckerTest.cpp |
diff --git a/Source/core/loader/MixedContentCheckerTest.cpp b/Source/core/loader/MixedContentCheckerTest.cpp |
index a9f156b67d651983f63df1c95e7efbf20ce8e6af..fb371f2d4e5c1b2476d544b8a965a6855e000a4f 100644 |
--- a/Source/core/loader/MixedContentCheckerTest.cpp |
+++ b/Source/core/loader/MixedContentCheckerTest.cpp |
@@ -5,6 +5,7 @@ |
#include "config.h" |
#include "core/loader/MixedContentChecker.h" |
+#include "core/testing/DummyPageHolder.h" |
#include "platform/weborigin/KURL.h" |
#include "platform/weborigin/SecurityOrigin.h" |
#include "wtf/RefPtr.h" |
@@ -43,4 +44,28 @@ TEST(MixedContentCheckerTest, IsMixedContent) |
} |
} |
+TEST(MixedContentCheckerTest, ContextTypeForInspector) |
+{ |
+ OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(1, 1)); |
+ dummyPageHolder->frame().document()->setSecurityOrigin(SecurityOrigin::createFromString("http://example.test")); |
+ |
+ ResourceRequest notMixedContent("https://example.test/foo.jpg"); |
+ notMixedContent.setFrameType(WebURLRequest::FrameTypeAuxiliary); |
+ notMixedContent.setRequestContext(WebURLRequest::RequestContextScript); |
+ EXPECT_EQ(MixedContentChecker::ContextTypeNotMixedContent, MixedContentChecker::contextTypeForInspector(&dummyPageHolder->frame(), notMixedContent)); |
+ |
+ dummyPageHolder->frame().document()->setSecurityOrigin(SecurityOrigin::createFromString("https://example.test")); |
+ EXPECT_EQ(MixedContentChecker::ContextTypeNotMixedContent, MixedContentChecker::contextTypeForInspector(&dummyPageHolder->frame(), notMixedContent)); |
+ |
+ ResourceRequest blockableMixedContent("http://example.test/foo.jpg"); |
+ blockableMixedContent.setFrameType(WebURLRequest::FrameTypeAuxiliary); |
+ blockableMixedContent.setRequestContext(WebURLRequest::RequestContextScript); |
+ EXPECT_EQ(MixedContentChecker::ContextTypeBlockable, MixedContentChecker::contextTypeForInspector(&dummyPageHolder->frame(), blockableMixedContent)); |
+ |
+ ResourceRequest optionallyBlockableMixedContent("http://example.test/foo.jpg"); |
+ blockableMixedContent.setFrameType(WebURLRequest::FrameTypeAuxiliary); |
+ blockableMixedContent.setRequestContext(WebURLRequest::RequestContextImage); |
+ EXPECT_EQ(MixedContentChecker::ContextTypeOptionallyBlockable, MixedContentChecker::contextTypeForInspector(&dummyPageHolder->frame(), blockableMixedContent)); |
+} |
+ |
} // namespace blink |