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

Unified Diff: Source/core/loader/MixedContentCheckerTest.cpp

Issue 1299493003: Attach mixed content status to resource requests when sent to devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add contextTypeForInspector() unit test Created 5 years, 4 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
« no previous file with comments | « Source/core/loader/MixedContentChecker.cpp ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/loader/MixedContentChecker.cpp ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698