#include "components/security_interstitials/content/ssl_error_navigation_throttle.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "components/security_interstitials/content/security_interstitial_controller_client.h"
#include "components/security_interstitials/content/security_interstitial_page.h"
#include "components/security_interstitials/content/settings_page_helper.h"
#include "components/security_interstitials/core/metrics_helper.h"
#include "components/security_interstitials/core/ssl_error_ui.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/test_renderer_host.h"
#include "net/cert/cert_status_flags.h"
#include "net/test/cert_test_util.h"
#include "net/test/test_data_directory.h"
namespace {
std::unique_ptr<security_interstitials::MetricsHelper>
CreateMetricsHelperForTest(const GURL& request_url) { … }
class FakeSSLBlockingPage
: public security_interstitials::SecurityInterstitialPage { … };
void MockHandleSSLError(
bool async,
content::WebContents* web_contents,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
base::OnceCallback<
void(std::unique_ptr<security_interstitials::SecurityInterstitialPage>)>
blocking_page_ready_callback) { … }
bool IsInHostedApp(content::WebContents* web_contents) { … }
bool ShouldIgnoreInterstitialBecauseNavigationDefaultedToHttps(
content::NavigationHandle* handle) { … }
class TestSSLErrorNavigationThrottle : public SSLErrorNavigationThrottle { … };
class SSLErrorNavigationThrottleTest
: public content::RenderViewHostTestHarness,
public testing::WithParamInterface<bool> { … };
TEST_P(SSLErrorNavigationThrottleTest, NoSSLError) { … }
TEST_P(SSLErrorNavigationThrottleTest, SSLInfoWithCertError) { … }
INSTANTIATE_TEST_SUITE_P(…);
}