Commit bf1583d7 authored by Mustafa Emre Acer's avatar Mustafa Emre Acer Committed by Commit Bot

Move SetSSLCertReporterForTesting() to SSLBlockingPageBase

The method is duplicated by sublasses. Push it to the base class instead.
An upcoming CL will use this for CaptivePortalBlockingPage as well.

Change-Id: Id24993df5fa0f7a0371e01ee84bf4788a196aca6
Reviewed-on: https://chromium-review.googlesource.com/902805Reviewed-by: default avatarCarlos IL <carlosil@chromium.org>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534519}
parent 5e45044e
...@@ -116,12 +116,6 @@ void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) { ...@@ -116,12 +116,6 @@ void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) {
entry->GetSSL() = content::SSLStatus(ssl_info_); entry->GetSSL() = content::SSLStatus(ssl_info_);
} }
void BadClockBlockingPage::SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter) {
cert_report_helper()->SetSSLCertReporterForTesting(
std::move(ssl_cert_reporter));
}
// This handles the commands sent from the interstitial JavaScript. // This handles the commands sent from the interstitial JavaScript.
void BadClockBlockingPage::CommandReceived(const std::string& command) { void BadClockBlockingPage::CommandReceived(const std::string& command) {
if (command == "\"pageLoadComplete\"") { if (command == "\"pageLoadComplete\"") {
......
...@@ -50,9 +50,6 @@ class BadClockBlockingPage : public SSLBlockingPageBase { ...@@ -50,9 +50,6 @@ class BadClockBlockingPage : public SSLBlockingPageBase {
// InterstitialPageDelegate method: // InterstitialPageDelegate method:
InterstitialPageDelegate::TypeID GetTypeForTesting() const override; InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
void SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter);
protected: protected:
// InterstitialPageDelegate implementation: // InterstitialPageDelegate implementation:
void CommandReceived(const std::string& command) override; void CommandReceived(const std::string& command) override;
......
...@@ -117,12 +117,6 @@ void MITMSoftwareBlockingPage::OverrideEntry(NavigationEntry* entry) { ...@@ -117,12 +117,6 @@ void MITMSoftwareBlockingPage::OverrideEntry(NavigationEntry* entry) {
entry->GetSSL() = content::SSLStatus(ssl_info_); entry->GetSSL() = content::SSLStatus(ssl_info_);
} }
void MITMSoftwareBlockingPage::SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter) {
cert_report_helper()->SetSSLCertReporterForTesting(
std::move(ssl_cert_reporter));
}
// This handles the commands sent from the interstitial JavaScript. // This handles the commands sent from the interstitial JavaScript.
void MITMSoftwareBlockingPage::CommandReceived(const std::string& command) { void MITMSoftwareBlockingPage::CommandReceived(const std::string& command) {
if (command == "\"pageLoadComplete\"") { if (command == "\"pageLoadComplete\"") {
......
...@@ -52,9 +52,6 @@ class MITMSoftwareBlockingPage : public SSLBlockingPageBase { ...@@ -52,9 +52,6 @@ class MITMSoftwareBlockingPage : public SSLBlockingPageBase {
// InterstitialPageDelegate method: // InterstitialPageDelegate method:
InterstitialPageDelegate::TypeID GetTypeForTesting() const override; InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
void SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter);
protected: protected:
// InterstitialPageDelegate implementation: // InterstitialPageDelegate implementation:
void CommandReceived(const std::string& command) override; void CommandReceived(const std::string& command) override;
......
...@@ -188,12 +188,6 @@ void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { ...@@ -188,12 +188,6 @@ void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) {
entry->GetSSL() = content::SSLStatus(ssl_info_); entry->GetSSL() = content::SSLStatus(ssl_info_);
} }
void SSLBlockingPage::SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter) {
cert_report_helper()->SetSSLCertReporterForTesting(
std::move(ssl_cert_reporter));
}
// This handles the commands sent from the interstitial JavaScript. // This handles the commands sent from the interstitial JavaScript.
void SSLBlockingPage::CommandReceived(const std::string& command) { void SSLBlockingPage::CommandReceived(const std::string& command) {
if (command == "\"pageLoadComplete\"") { if (command == "\"pageLoadComplete\"") {
......
...@@ -68,9 +68,6 @@ class SSLBlockingPage : public SSLBlockingPageBase { ...@@ -68,9 +68,6 @@ class SSLBlockingPage : public SSLBlockingPageBase {
// if SSL error overriding is allowed by policy. // if SSL error overriding is allowed by policy.
static bool IsOverridable(int options_mask); static bool IsOverridable(int options_mask);
void SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter);
protected: protected:
friend class policy::PolicyTest_SSLErrorOverridingDisallowed_Test; friend class policy::PolicyTest_SSLErrorOverridingDisallowed_Test;
friend class SSLUITestBase; friend class SSLUITestBase;
......
...@@ -40,6 +40,12 @@ void SSLBlockingPageBase::OnInterstitialClosing() { ...@@ -40,6 +40,12 @@ void SSLBlockingPageBase::OnInterstitialClosing() {
cert_report_helper_->FinishCertCollection(); cert_report_helper_->FinishCertCollection();
} }
void SSLBlockingPageBase::SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter) {
cert_report_helper_->SetSSLCertReporterForTesting(
std::move(ssl_cert_reporter));
}
CertReportHelper* SSLBlockingPageBase::cert_report_helper() { CertReportHelper* SSLBlockingPageBase::cert_report_helper() {
return cert_report_helper_.get(); return cert_report_helper_.get();
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_ #ifndef CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_
#define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_ #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_BASE_H_
#include "chrome/browser/ssl/cert_report_helper.h"
#include "components/certificate_reporting/error_report.h" #include "components/certificate_reporting/error_report.h"
#include "components/security_interstitials/content/security_interstitial_page.h" #include "components/security_interstitials/content/security_interstitial_page.h"
...@@ -41,6 +42,9 @@ class SSLBlockingPageBase ...@@ -41,6 +42,9 @@ class SSLBlockingPageBase
// security_interstitials::SecurityInterstitialPage: // security_interstitials::SecurityInterstitialPage:
void OnInterstitialClosing() override; void OnInterstitialClosing() override;
void SetSSLCertReporterForTesting(
std::unique_ptr<SSLCertReporter> ssl_cert_reporter);
protected: protected:
CertReportHelper* cert_report_helper(); CertReportHelper* cert_report_helper();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment