Index: content/browser/site_per_process_browsertest.cc |
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc |
index 6aacbff6a2412760ce32daf09bf0bec5b02c786d..dbf8f85483dd8a0b08db8639c8909b1f2e3755f3 100644 |
--- a/content/browser/site_per_process_browsertest.cc |
+++ b/content/browser/site_per_process_browsertest.cc |
@@ -596,6 +596,20 @@ class SitePerProcessHighDPIBrowserTest : public SitePerProcessBrowserTest { |
} |
}; |
+// SitePerProcessIgnoreCertErrorsBrowserTest |
+ |
+class SitePerProcessIgnoreCertErrorsBrowserTest |
+ : public SitePerProcessBrowserTest { |
+ public: |
+ SitePerProcessIgnoreCertErrorsBrowserTest() {} |
+ |
+ protected: |
+ void SetUpCommandLine(base::CommandLine* command_line) override { |
+ SitePerProcessBrowserTest::SetUpCommandLine(command_line); |
+ command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
+ } |
+}; |
+ |
// Ensure that navigating subframes in --site-per-process mode works and the |
// correct documents are committed. |
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
@@ -4744,4 +4758,86 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChanged) { |
EXPECT_TRUE(show_observer.WaitUntilSatisfied()); |
} |
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, PassiveMixedContent) { |
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
+ https_server.ServeFilesFromSourceDirectory("content/test/data"); |
+ ASSERT_TRUE(https_server.Start()); |
+ |
+ GURL url(https_server.GetURL("/mixed-content/basic-passive.html")); |
+ NavigateToURL(shell(), url); |
+ EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
+} |
+ |
+// Tests that the WebContents is notified when passive mixed content is |
+// displayed in an OOPIF. The test ignores cert errors so that an HTTPS |
+// iframe can be loaded from a site other than localhost (the |
+// EmbeddedTestServer serves a certificate that is valid for localhost). |
+IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
+ PassiveMixedContentInIframe) { |
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
+ https_server.ServeFilesFromSourceDirectory("content/test/data"); |
+ ASSERT_TRUE(https_server.Start()); |
+ SetupCrossSiteRedirector(&https_server); |
+ |
+ GURL iframe_url( |
+ https_server.GetURL("/mixed-content/basic-passive-in-iframe.html")); |
+ NavigateToURL(shell(), iframe_url); |
+ EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
+ |
+ // When the subframe navigates, the WebContents should still be marked |
+ // as having displayed insecure content. |
+ GURL navigate_url(https_server.GetURL("/title1.html")); |
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
+ ->GetFrameTree() |
+ ->root(); |
+ NavigateFrameToURL(root->child_at(0), navigate_url); |
+ EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent()); |
+ |
+ // When the main frame navigates, it should no longer be marked as |
+ // displaying insecure content. |
+ NavigateToURL(shell(), navigate_url); |
+ EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
+} |
+ |
+// Tests that, when a parent frame is set to strictly block mixed |
+// content via Content Security Policy, child OOPIFs cannot display |
+// mixed content. |
+IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest, |
+ PassiveMixedContentInIframeWithStrictBlocking) { |
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
+ https_server.ServeFilesFromSourceDirectory("content/test/data"); |
+ ASSERT_TRUE(https_server.Start()); |
+ SetupCrossSiteRedirector(&https_server); |
+ |
+ GURL iframe_url_with_strict_blocking(https_server.GetURL( |
+ "/mixed-content/basic-passive-in-iframe-with-strict-blocking.html")); |
+ NavigateToURL(shell(), iframe_url_with_strict_blocking); |
+ EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent()); |
+ |
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
+ ->GetFrameTree() |
+ ->root(); |
+ EXPECT_TRUE(root->current_replication_state() |
+ .should_enforce_strict_mixed_content_checking); |
+ EXPECT_TRUE(root->child_at(0) |
+ ->current_replication_state() |
+ .should_enforce_strict_mixed_content_checking); |
+ |
+ // When the subframe navigates, it should still be marked as enforcing |
+ // strict mixed content. |
+ GURL navigate_url(https_server.GetURL("/title1.html")); |
+ NavigateFrameToURL(root->child_at(0), navigate_url); |
+ EXPECT_TRUE(root->current_replication_state() |
+ .should_enforce_strict_mixed_content_checking); |
+ EXPECT_TRUE(root->child_at(0) |
+ ->current_replication_state() |
+ .should_enforce_strict_mixed_content_checking); |
+ |
+ // When the main frame navigates, it should no longer be marked as |
+ // enforcing strict mixed content. |
+ NavigateToURL(shell(), navigate_url); |
+ EXPECT_FALSE(root->current_replication_state() |
+ .should_enforce_strict_mixed_content_checking); |
+} |
+ |
} // namespace content |