From 4282f117db4ddb6b307efad849ec6635095e9cd1 Mon Sep 17 00:00:00 2001 From: estark Date: Wed, 13 May 2015 15:01:55 -0700 Subject: Split cert reporter class into report building/serializing and sending The pre-existing |CertificateErrorReporter| class (in //chrome/browser/net) is now only in charge of sending reports over the network. A new class (|CertificateErrorReport| in //chrome/browser/ssl) is in charge of building and serializing the reports. The motivation for this change is to allow reports to include interstitial-specific information (such as the type of interstitial that was shown, whether the user clicked through, etc.). So as to avoid introducing interstitial knowledge into //c/b/net, all the report building and serializing knowledge (including the report protobuf) has been moved into //c/b/ssl. |SSLBlockingPage| now sends a serialized report through |ChromeContentBrowserClient| to the SafeBrowsing UIManager to be sent over the network. |ChromeFraudulentCertificateReporter| (responsible for reporting Google-property pinning violations) has also been moved into //c/b/ssl so that it can use the new |CertificateErrorReport| class to build reports before sending them with a |CertificateErrorReporter|. BUG=462713,461588 Review URL: https://codereview.chromium.org/1117173004 Cr-Commit-Position: refs/heads/master@{#329723} --- chrome/browser/ssl/ssl_browser_tests.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'chrome/browser/ssl/ssl_browser_tests.cc') diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index d536049..bbdd300 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -21,6 +21,8 @@ #include "chrome/browser/safe_browsing/ping_manager.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/safe_browsing/ui_manager.h" +#include "chrome/browser/ssl/cert_logger.pb.h" +#include "chrome/browser/ssl/certificate_error_report.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" #include "chrome/browser/ssl/ssl_blocking_page.h" #include "chrome/browser/ui/browser.h" @@ -211,10 +213,11 @@ class MockReporter : public CertificateErrorReporter { cookies_preference) {} void SendReport(CertificateErrorReporter::ReportType type, - const std::string& hostname, - const net::SSLInfo& ssl_info) override { + const std::string& serialized_report) override { + CertificateErrorReport report; + ASSERT_TRUE(report.InitializeFromString(serialized_report)); EXPECT_EQ(CertificateErrorReporter::REPORT_TYPE_EXTENDED_REPORTING, type); - latest_hostname_reported_ = hostname; + latest_hostname_reported_ = report.hostname(); } const std::string& latest_hostname_reported() { @@ -247,12 +250,12 @@ class MockSSLCertReporter : public SSLCertReporter { ~MockSSLCertReporter() override { EXPECT_EQ(expect_report_, reported_); } // SSLCertReporter implementation - void ReportInvalidCertificateChain(const std::string& hostname, - const net::SSLInfo& ssl_info) override { + void ReportInvalidCertificateChain( + const std::string& serialized_report) override { reported_ = true; if (expect_report_) { safe_browsing_ui_manager_->ReportInvalidCertificateChain( - hostname, ssl_info, report_sent_callback_); + serialized_report, report_sent_callback_); } } -- cgit v1.1