#include "content/browser/renderer_host/mixed_content_checker.h"
#include <memory>
#include <optional>
#include <ostream>
#include <tuple>
#include <vector>
#include "content/public/browser/web_contents.h"
#include "content/public/test/fake_local_frame.h"
#include "content/test/navigation_simulator_impl.h"
#include "content/test/test_render_frame_host.h"
#include "content/test/test_render_view_host.h"
#include "services/network/public/mojom/source_location.mojom-forward.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
#include "third_party/blink/public/mojom/loader/mixed_content.mojom.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h"
#include "url/gurl.h"
namespace content {
namespace {
Eq;
FieldsAre;
IsEmpty;
Optional;
UnorderedElementsAre;
class LocalFrameInterceptor : public FakeLocalFrame { … };
std::ostream& operator<<(std::ostream& out,
const LocalFrameInterceptor::MixedContentResult& m) { … }
}
TEST(MixedContentCheckerTest, IsMixedContent) { … }
class MixedContentCheckerShouldBlockTestBase
: public RenderViewHostImplTestHarness,
public testing::WithParamInterface<bool> { … };
class MixedContentCheckerShouldBlockNavigationTestBase
: public MixedContentCheckerShouldBlockTestBase { … };
MixedContentCheckerShouldBlockNavigationTest;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MixedContentCheckerShouldBlockNavigationTest,
ShouldNotBlockNavigationFromInsecureMainFrame) { … }
TEST_P(MixedContentCheckerShouldBlockNavigationTest,
ShouldNotBlockNavigationFromSecureMainFrame) { … }
TEST_P(MixedContentCheckerShouldBlockNavigationTest,
ShouldNotBlockNavigationFromInsecureSubFrame) { … }
class MixedContentCheckerShouldBlockNavigationWithBlockableContextTest
: public MixedContentCheckerShouldBlockNavigationTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MixedContentCheckerShouldBlockNavigationWithBlockableContextTest,
ShouldBlockMixedContentNavigationWithPolicyLeaveInsecureRequestAlone) { … }
TEST_P(MixedContentCheckerShouldBlockNavigationWithBlockableContextTest,
ShouldBlockMixedContentNavigationWithPolicyBlockAll) { … }
class MixedContentCheckerShouldBlockNavigationWithOptionallyBlockableContextTest
: public MixedContentCheckerShouldBlockNavigationTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(
MixedContentCheckerShouldBlockNavigationWithOptionallyBlockableContextTest,
ShouldNotBlockMixedContentNavigationWithPolicyLeaveInsecureRequestAlone) { … }
TEST_P(
MixedContentCheckerShouldBlockNavigationWithOptionallyBlockableContextTest,
ShouldBlockMixedContentNavigationWithPolicyBlockAll) { … }
class MixedContentCheckerShouldBlockNavigationWithShouldBeBlockableContextTest
: public MixedContentCheckerShouldBlockNavigationTestBase { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(
MixedContentCheckerShouldBlockNavigationWithShouldBeBlockableContextTest,
ShouldNotBlockMixedContentNavigationWithPolicyLeaveInsecureRequestAlone) { … }
TEST_P(MixedContentCheckerShouldBlockNavigationWithShouldBeBlockableContextTest,
ShouldBlockMixedContentNavigationWithPolicyBlockAll) { … }
class MixedContentCheckerShouldBlockFetchKeepAliveTestBase
: public MixedContentCheckerShouldBlockTestBase { … };
MixedContentCheckerShouldBlockFetchKeepAliveTest;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(MixedContentCheckerShouldBlockFetchKeepAliveTest,
ShouldNotBlockInsecureFetchFromInsecureMainFrame) { … }
TEST_P(MixedContentCheckerShouldBlockFetchKeepAliveTest,
ShouldNotBlockInsecureFetchFromInsecureSubFrame) { … }
TEST_P(
MixedContentCheckerShouldBlockFetchKeepAliveTest,
ShouldBlockInsecureFetchFromSecureFrameWithPolicyLeaveInsecureRequestAlone) { … }
TEST_P(MixedContentCheckerShouldBlockFetchKeepAliveTest,
ShouldBlockInsecureFetchFromSecureFrameWithPolicyBlockAllMixedContent) { … }
}