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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 1550723003: Adapt MixedContentChecker for remote frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: alexmos comments Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 SitePerProcessHighDPIBrowserTest() {} 589 SitePerProcessHighDPIBrowserTest() {}
590 590
591 protected: 591 protected:
592 void SetUpCommandLine(base::CommandLine* command_line) override { 592 void SetUpCommandLine(base::CommandLine* command_line) override {
593 SitePerProcessBrowserTest::SetUpCommandLine(command_line); 593 SitePerProcessBrowserTest::SetUpCommandLine(command_line);
594 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, 594 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor,
595 base::StringPrintf("2")); 595 base::StringPrintf("2"));
596 } 596 }
597 }; 597 };
598 598
599 // SitePerProcessIgnoreCertErrorsBrowserTest
600
601 class SitePerProcessIgnoreCertErrorsBrowserTest
602 : public SitePerProcessBrowserTest {
603 public:
604 SitePerProcessIgnoreCertErrorsBrowserTest() {}
605
606 protected:
607 void SetUpCommandLine(base::CommandLine* command_line) override {
608 SitePerProcessBrowserTest::SetUpCommandLine(command_line);
609 command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
610 }
611 };
612
599 // Ensure that navigating subframes in --site-per-process mode works and the 613 // Ensure that navigating subframes in --site-per-process mode works and the
600 // correct documents are committed. 614 // correct documents are committed.
601 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { 615 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) {
602 GURL main_url(embedded_test_server()->GetURL( 616 GURL main_url(embedded_test_server()->GetURL(
603 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); 617 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))"));
604 NavigateToURL(shell(), main_url); 618 NavigateToURL(shell(), main_url);
605 619
606 // It is safe to obtain the root frame tree node here, as it doesn't change. 620 // It is safe to obtain the root frame tree node here, as it doesn't change.
607 FrameTreeNode* root = 621 FrameTreeNode* root =
608 static_cast<WebContentsImpl*>(shell()->web_contents())-> 622 static_cast<WebContentsImpl*>(shell()->web_contents())->
(...skipping 4128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4737 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), hide_script)); 4751 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), hide_script));
4738 EXPECT_TRUE(hide_observer.WaitUntilSatisfied()); 4752 EXPECT_TRUE(hide_observer.WaitUntilSatisfied());
4739 4753
4740 // Verify showing leads to a notification as well. 4754 // Verify showing leads to a notification as well.
4741 RenderWidgetHostVisibilityObserver show_observer( 4755 RenderWidgetHostVisibilityObserver show_observer(
4742 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), true); 4756 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), true);
4743 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), show_script)); 4757 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), show_script));
4744 EXPECT_TRUE(show_observer.WaitUntilSatisfied()); 4758 EXPECT_TRUE(show_observer.WaitUntilSatisfied());
4745 } 4759 }
4746 4760
4761 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, PassiveMixedContent) {
4762 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
4763 https_server.ServeFilesFromSourceDirectory("content/test/data");
4764 ASSERT_TRUE(https_server.Start());
4765
4766 GURL url(https_server.GetURL("/mixed-content/basic-passive.html"));
4767 NavigateToURL(shell(), url);
4768 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent());
4769 }
4770
4771 // Tests that the WebContents is notified when passive mixed content is
4772 // displayed in an OOPIF. The test ignores cert errors so that an HTTPS
4773 // iframe can be loaded from a site other than localhost (the
4774 // EmbeddedTestServer serves a certificate that is valid for localhost).
4775 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest,
4776 PassiveMixedContentInIframe) {
4777 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
4778 https_server.ServeFilesFromSourceDirectory("content/test/data");
4779 ASSERT_TRUE(https_server.Start());
4780 SetupCrossSiteRedirector(&https_server);
4781
4782 GURL iframe_url(
4783 https_server.GetURL("/mixed-content/basic-passive-in-iframe.html"));
4784 NavigateToURL(shell(), iframe_url);
4785 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent());
4786
4787 // When the subframe navigates, the WebContents should still be marked
4788 // as having displayed insecure content.
4789 GURL navigate_url(https_server.GetURL("/title1.html"));
4790 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
4791 ->GetFrameTree()
4792 ->root();
4793 NavigateFrameToURL(root->child_at(0), navigate_url);
4794 EXPECT_TRUE(shell()->web_contents()->DisplayedInsecureContent());
4795
4796 // When the main frame navigates, it should no longer be marked as
4797 // displaying insecure content.
4798 NavigateToURL(shell(), navigate_url);
4799 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent());
4800 }
4801
4802 // Tests that, when a parent frame is set to strictly block mixed
4803 // content via Content Security Policy, child OOPIFs cannot display
4804 // mixed content.
4805 IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest,
4806 PassiveMixedContentInIframeWithStrictBlocking) {
4807 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
4808 https_server.ServeFilesFromSourceDirectory("content/test/data");
4809 ASSERT_TRUE(https_server.Start());
4810 SetupCrossSiteRedirector(&https_server);
4811
4812 GURL iframe_url_with_strict_blocking(https_server.GetURL(
4813 "/mixed-content/basic-passive-in-iframe-with-strict-blocking.html"));
4814 NavigateToURL(shell(), iframe_url_with_strict_blocking);
4815 EXPECT_FALSE(shell()->web_contents()->DisplayedInsecureContent());
4816
4817 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
4818 ->GetFrameTree()
4819 ->root();
4820 EXPECT_TRUE(root->current_replication_state()
4821 .should_enforce_strict_mixed_content_checking);
4822 EXPECT_TRUE(root->child_at(0)
4823 ->current_replication_state()
4824 .should_enforce_strict_mixed_content_checking);
4825
4826 // When the subframe navigates, it should still be marked as enforcing
4827 // strict mixed content.
4828 GURL navigate_url(https_server.GetURL("/title1.html"));
4829 NavigateFrameToURL(root->child_at(0), navigate_url);
4830 EXPECT_TRUE(root->current_replication_state()
4831 .should_enforce_strict_mixed_content_checking);
4832 EXPECT_TRUE(root->child_at(0)
4833 ->current_replication_state()
4834 .should_enforce_strict_mixed_content_checking);
4835
4836 // When the main frame navigates, it should no longer be marked as
4837 // enforcing strict mixed content.
4838 NavigateToURL(shell(), navigate_url);
4839 EXPECT_FALSE(root->current_replication_state()
4840 .should_enforce_strict_mixed_content_checking);
4841 }
4842
4747 } // namespace content 4843 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/frame_messages.h » ('j') | content/test/data/mixed-content/basic-passive-in-iframe.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698