// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/site_per_process_browsertest.h" #include "build/build_config.h" #include "content/public/test/browser_test.h" #include "content/public/test/content_browser_test_utils.h" #include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/test_navigation_observer.h" #include "content/test/render_document_feature.h" namespace content { // A subclass of SitePerProcessIgnoreCertErrorsBrowsertest that disables mixed // content autoupgrades. // TODO(carlosil): Since the flag will be cleaned up eventually, this should be // changed to proper plumbing that adds the relevant urls to the allowlist. class SitePerProcessIgnoreCertErrorsAllowMixedContentBrowserTest : public SitePerProcessIgnoreCertErrorsBrowserTest { … }; // 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_P(SitePerProcessIgnoreCertErrorsBrowserTest, PassiveMixedContentInIframeWithStrictBlocking) { … } // Tests that, when a parent frame is set to upgrade insecure requests // via Content Security Policy, child OOPIFs will upgrade as well. IN_PROC_BROWSER_TEST_P(SitePerProcessIgnoreCertErrorsBrowserTest, PassiveMixedContentInIframeWithUpgrade) { … } // Tests that active mixed content is blocked 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_P(SitePerProcessIgnoreCertErrorsBrowserTest, ActiveMixedContentInIframe) { … } // 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). // This test crashes on Windows under Dr. Memory, see https://crbug.com/600942. #if BUILDFLAG(IS_WIN) #define MAYBE_PassiveMixedContentInIframe … #else #define MAYBE_PassiveMixedContentInIframe … #endif IN_PROC_BROWSER_TEST_P( SitePerProcessIgnoreCertErrorsAllowMixedContentBrowserTest, MAYBE_PassiveMixedContentInIframe) { … } INSTANTIATE_TEST_SUITE_P(…); } // namespace content