Commit dd133eb6 authored by meacer's avatar meacer Committed by Commit bot

Implement main CertificateReportingService code and add unit tests.

This CL adds the actual CertificateReportingService code that's going to be
used to send reports. The service is still not wired to any other service, so is
off by default.

BUG=554323

Review-Url: https://codereview.chromium.org/2543523002
Cr-Commit-Position: refs/heads/master@{#438017}
parent d722a94d
...@@ -4209,6 +4209,8 @@ static_library("test_support") { ...@@ -4209,6 +4209,8 @@ static_library("test_support") {
# "Safe Browsing Basic" files used for safe browsing in full mode # "Safe Browsing Basic" files used for safe browsing in full mode
# (safe_browsing=1) and mobile (=2) # (safe_browsing=1) and mobile (=2)
sources += [ sources += [
"safe_browsing/certificate_reporting_service_test_utils.cc",
"safe_browsing/certificate_reporting_service_test_utils.h",
"safe_browsing/mock_permission_report_sender.cc", "safe_browsing/mock_permission_report_sender.cc",
"safe_browsing/mock_permission_report_sender.h", "safe_browsing/mock_permission_report_sender.h",
] ]
......
...@@ -2,12 +2,20 @@ ...@@ -2,12 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "base/bind_helpers.h"
#include "base/time/clock.h" #include "base/time/clock.h"
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
#include "chrome/browser/safe_browsing/certificate_reporting_service.h" #include "chrome/browser/safe_browsing/certificate_reporting_service.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
namespace { namespace {
// URL to upload invalid certificate chain reports. An HTTP URL is used because
// a client seeing an invalid cert might not be able to make an HTTPS connection
// to report it.
const char kExtendedReportingUploadUrl[] =
"http://safebrowsing.googleusercontent.com/safebrowsing/clientreport/";
// Compare function that orders Reports in reverse chronological order (i.e. // Compare function that orders Reports in reverse chronological order (i.e.
// oldest item is last). // oldest item is last).
bool ReportCompareFunc(const CertificateReportingService::Report& item1, bool ReportCompareFunc(const CertificateReportingService::Report& item1,
...@@ -57,11 +65,13 @@ CertificateReportingService::Reporter::Reporter( ...@@ -57,11 +65,13 @@ CertificateReportingService::Reporter::Reporter(
std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter, std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter,
std::unique_ptr<BoundedReportList> retry_list, std::unique_ptr<BoundedReportList> retry_list,
base::Clock* clock, base::Clock* clock,
base::TimeDelta report_ttl) base::TimeDelta report_ttl,
bool retries_enabled)
: error_reporter_(std::move(error_reporter)), : error_reporter_(std::move(error_reporter)),
retry_list_(std::move(retry_list)), retry_list_(std::move(retry_list)),
test_clock_(clock), clock_(clock),
report_ttl_(report_ttl), report_ttl_(report_ttl),
retries_enabled_(retries_enabled),
current_report_id_(0), current_report_id_(0),
weak_factory_(this) {} weak_factory_(this) {}
...@@ -70,15 +80,15 @@ CertificateReportingService::Reporter::~Reporter() {} ...@@ -70,15 +80,15 @@ CertificateReportingService::Reporter::~Reporter() {}
void CertificateReportingService::Reporter::Send( void CertificateReportingService::Reporter::Send(
const std::string& serialized_report) { const std::string& serialized_report) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::Time now = SendInternal(Report(current_report_id_++, clock_->Now(), serialized_report));
test_clock_ ? test_clock_->Now() : base::Time::NowFromSystemTime();
SendInternal(Report(current_report_id_++, now, serialized_report));
} }
void CertificateReportingService::Reporter::SendPending() { void CertificateReportingService::Reporter::SendPending() {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::Time now = if (!retries_enabled_) {
test_clock_ ? test_clock_->Now() : base::Time::NowFromSystemTime(); return;
}
const base::Time now = clock_->Now();
// Copy pending reports and clear the retry list. // Copy pending reports and clear the retry list.
std::vector<Report> items = retry_list_->items(); std::vector<Report> items = retry_list_->items();
retry_list_->Clear(); retry_list_->Clear();
...@@ -118,9 +128,11 @@ void CertificateReportingService::Reporter::ErrorCallback(int report_id, ...@@ -118,9 +128,11 @@ void CertificateReportingService::Reporter::ErrorCallback(int report_id,
const GURL& url, const GURL& url,
int error) { int error) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
auto it = inflight_reports_.find(report_id); if (retries_enabled_) {
DCHECK(it != inflight_reports_.end()); auto it = inflight_reports_.find(report_id);
retry_list_->Add(it->second); DCHECK(it != inflight_reports_.end());
retry_list_->Add(it->second);
}
CHECK_GT(inflight_reports_.erase(report_id), 0u); CHECK_GT(inflight_reports_.erase(report_id), 0u);
} }
...@@ -128,3 +140,159 @@ void CertificateReportingService::Reporter::SuccessCallback(int report_id) { ...@@ -128,3 +140,159 @@ void CertificateReportingService::Reporter::SuccessCallback(int report_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
CHECK_GT(inflight_reports_.erase(report_id), 0u); CHECK_GT(inflight_reports_.erase(report_id), 0u);
} }
CertificateReportingService::CertificateReportingService(
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
uint8_t server_public_key[/* 32 */],
uint32_t server_public_key_version,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
std::unique_ptr<base::Clock> clock)
: enabled_(true),
url_request_context_(nullptr),
max_queued_report_count_(max_queued_report_count),
max_report_age_(max_report_age),
clock_(std::move(clock)),
made_send_attempt_(false),
server_public_key_(server_public_key),
server_public_key_version_(server_public_key_version) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&CertificateReportingService::InitializeOnIOThread,
base::Unretained(this), enabled_, url_request_context_getter,
max_queued_report_count_, max_report_age_, clock_.get(),
server_public_key_, server_public_key_version_));
}
CertificateReportingService::~CertificateReportingService() {
DCHECK(!reporter_);
}
void CertificateReportingService::Shutdown() {
// Shutdown will be called twice: Once after SafeBrowsing shuts down, and once
// when all KeyedServices shut down. All calls after the first one are no-op.
enabled_ = false;
Reset();
}
void CertificateReportingService::Send(const std::string& serialized_report) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
made_send_attempt_ = true;
if (!reporter_) {
return;
}
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&CertificateReportingService::Reporter::Send,
base::Unretained(reporter_.get()), serialized_report));
}
void CertificateReportingService::SendPending() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
made_send_attempt_ = true;
if (!reporter_) {
return;
}
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&CertificateReportingService::Reporter::SendPending,
base::Unretained(reporter_.get())));
}
void CertificateReportingService::InitializeOnIOThread(
bool enabled,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
base::Clock* clock,
uint8_t* server_public_key,
uint32_t server_public_key_version) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!url_request_context_);
url_request_context_ = url_request_context_getter->GetURLRequestContext();
ResetOnIOThread(enabled, url_request_context_, max_queued_report_count,
max_report_age, clock, server_public_key,
server_public_key_version);
}
void CertificateReportingService::SetEnabled(bool enabled) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
enabled_ = enabled;
Reset();
}
CertificateReportingService::Reporter*
CertificateReportingService::GetReporterForTesting() const {
return reporter_.get();
}
void CertificateReportingService::SetMaxQueuedReportCountForTesting(
size_t count) {
DCHECK(!made_send_attempt_);
max_queued_report_count_ = count;
Reset();
}
void CertificateReportingService::SetClockForTesting(
std::unique_ptr<base::Clock> clock) {
DCHECK(!made_send_attempt_);
clock_ = std::move(clock);
Reset();
}
void CertificateReportingService::SetMaxReportAgeForTesting(
base::TimeDelta max_report_age) {
DCHECK(!made_send_attempt_);
max_report_age_ = max_report_age;
Reset();
}
// static
GURL CertificateReportingService::GetReportingURLForTesting() {
return GURL(kExtendedReportingUploadUrl);
}
void CertificateReportingService::Reset() {
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&CertificateReportingService::ResetOnIOThread,
base::Unretained(this), enabled_, url_request_context_,
max_queued_report_count_, max_report_age_, clock_.get(),
server_public_key_, server_public_key_version_));
}
void CertificateReportingService::ResetOnIOThread(
bool enabled,
net::URLRequestContext* url_request_context,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
base::Clock* clock,
uint8_t* const server_public_key,
uint32_t server_public_key_version) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
// url_request_context_ is null during shutdown.
if (!enabled || !url_request_context) {
reporter_.reset(nullptr);
return;
}
std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter;
if (server_public_key) {
// Only used in tests.
std::unique_ptr<net::ReportSender> report_sender(new net::ReportSender(
url_request_context, net::ReportSender::DO_NOT_SEND_COOKIES));
error_reporter.reset(new certificate_reporting::ErrorReporter(
GURL(kExtendedReportingUploadUrl), server_public_key,
server_public_key_version, std::move(report_sender)));
} else {
error_reporter.reset(new certificate_reporting::ErrorReporter(
url_request_context, GURL(kExtendedReportingUploadUrl),
net::ReportSender::DO_NOT_SEND_COOKIES));
}
reporter_.reset(
new Reporter(std::move(error_reporter),
std::unique_ptr<BoundedReportList>(
new BoundedReportList(max_queued_report_count)),
clock, max_report_age, true /* retries_enabled */));
}
...@@ -16,16 +16,31 @@ ...@@ -16,16 +16,31 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "components/certificate_reporting/error_reporter.h" #include "components/certificate_reporting/error_reporter.h"
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "net/url_request/url_request_context_getter.h"
namespace base { namespace base {
class Clock; class Clock;
} }
namespace net {
class URLRequestContextGetter;
}
// This service initiates uploads of invalid certificate reports and retries any // This service initiates uploads of invalid certificate reports and retries any
// failed uploads. // failed uploads. Each report is retried until it's older than a certain time
// to live (TTL). Reports older than this TTL are dropped and no more retried,
// so that the retry list doesn't grow indefinitely.
//
// Lifetime and dependencies:
//
// CertificateReportingService uses the url request context from SafeBrowsing
// service. SafeBrowsing service is created before CertificateReportingService,
// but is also shut down before any KeyedService is shut down. This means that
// CertificateReportingService cannot depend on SafeBrowsing's url request being
// available at all times, and it should know when SafeBrowsing shuts down.
class CertificateReportingService : public KeyedService { class CertificateReportingService : public KeyedService {
public: public:
// Represent a report to be sent. // Represents a report to be sent.
struct Report { struct Report {
int report_id; int report_id;
base::Time creation_time; base::Time creation_time;
...@@ -64,6 +79,8 @@ class CertificateReportingService : public KeyedService { ...@@ -64,6 +79,8 @@ class CertificateReportingService : public KeyedService {
std::vector<Report> items_; std::vector<Report> items_;
base::ThreadChecker thread_checker_; base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(BoundedReportList);
}; };
// Class that handles report uploads and implements the upload retry logic. // Class that handles report uploads and implements the upload retry logic.
...@@ -73,7 +90,8 @@ class CertificateReportingService : public KeyedService { ...@@ -73,7 +90,8 @@ class CertificateReportingService : public KeyedService {
std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter_, std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter_,
std::unique_ptr<BoundedReportList> retry_list, std::unique_ptr<BoundedReportList> retry_list,
base::Clock* clock, base::Clock* clock,
base::TimeDelta report_ttl); base::TimeDelta report_ttl,
bool retries_enabled);
~Reporter(); ~Reporter();
// Sends a report. If the send fails, the report will be added to the retry // Sends a report. If the send fails, the report will be added to the retry
...@@ -96,16 +114,105 @@ class CertificateReportingService : public KeyedService { ...@@ -96,16 +114,105 @@ class CertificateReportingService : public KeyedService {
std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter_; std::unique_ptr<certificate_reporting::ErrorReporter> error_reporter_;
std::unique_ptr<BoundedReportList> retry_list_; std::unique_ptr<BoundedReportList> retry_list_;
base::Clock* test_clock_; base::Clock* clock_;
// Maximum age of a queued report. Reports older than this are discarded in
// the next SendPending() call.
const base::TimeDelta report_ttl_; const base::TimeDelta report_ttl_;
const bool retries_enabled_;
// Current report id, starting from zero and monotonically incrementing.
int current_report_id_; int current_report_id_;
std::map<int, Report> inflight_reports_; std::map<int, Report> inflight_reports_;
base::WeakPtrFactory<Reporter> weak_factory_; base::WeakPtrFactory<Reporter> weak_factory_;
DISALLOW_IMPLICIT_CONSTRUCTORS(Reporter); DISALLOW_COPY_AND_ASSIGN(Reporter);
}; };
CertificateReportingService(
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
uint8_t server_public_key[/* 32 */],
uint32_t server_public_key_version,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
std::unique_ptr<base::Clock> clock);
~CertificateReportingService() override;
// KeyedService implementation:
void Shutdown() override;
// Sends a serialized report. If the report upload fails, the upload is
// retried at a future time.
void Send(const std::string& serialized_report);
// Sends pending reports that are in the retry queue.
void SendPending();
// Enables or disables reporting. When disabled, pending report queue is
// cleared and incoming reports are ignored. Reporting is enabled by default
// once the service is initialized.
void SetEnabled(bool enabled);
// Getters and setters for testing.
Reporter* GetReporterForTesting() const;
void SetMaxQueuedReportCountForTesting(size_t max_report_count);
void SetClockForTesting(std::unique_ptr<base::Clock> clock);
void SetMaxReportAgeForTesting(base::TimeDelta max_report_age);
static GURL GetReportingURLForTesting();
private:
void Reset();
void InitializeOnIOThread(
bool enabled,
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
base::Clock* clock,
uint8_t* server_public_key,
uint32_t server_public_key_version);
// Resets the reporter on the IO thread. Changes in SafeBrowsing or extended
// reporting enabled states cause the reporter to be reset.
// If |enabled| is false or |url_request_context_getter| is null, report is
// set to null, effectively cancelling all in flight uploads and clearing the
// pending reports queue.
void ResetOnIOThread(bool enabled,
net::URLRequestContext* url_request_context,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
base::Clock* clock,
uint8_t* server_public_key,
uint32_t server_public_key_version);
// If true, reporting is enabled. When SafeBrowsing preferences change, this
// might be set to false.
bool enabled_;
net::URLRequestContext* url_request_context_;
std::unique_ptr<Reporter> reporter_;
// Maximum number of reports to be queued for retry.
size_t max_queued_report_count_;
// Maximum age of the reports to be queued for retry, from the time the
// certificate error was first encountered by the user. Any report older than
// this age is ignored and is not re-uploaded.
base::TimeDelta max_report_age_;
std::unique_ptr<base::Clock> clock_;
// Whether a send has ever been made. Used to verify that test setters are
// only called after initialization.
bool made_send_attempt_;
// Encryption parameters.
uint8_t* server_public_key_;
uint32_t server_public_key_version_;
DISALLOW_COPY_AND_ASSIGN(CertificateReportingService);
}; };
#endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_ #endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_H_
...@@ -29,7 +29,8 @@ CertificateReportingServiceFactory::~CertificateReportingServiceFactory() {} ...@@ -29,7 +29,8 @@ CertificateReportingServiceFactory::~CertificateReportingServiceFactory() {}
KeyedService* CertificateReportingServiceFactory::BuildServiceInstanceFor( KeyedService* CertificateReportingServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const { content::BrowserContext* profile) const {
return new CertificateReportingService(); // TODO(crbug.com/554323): Create a real CertificateReportingService here.
return nullptr;
} }
content::BrowserContext* content::BrowserContext*
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_TEST_UTILS_H_
#define CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_TEST_UTILS_H_
#include <set>
#include "base/macros.h"
#include "base/run_loop.h"
#include "chrome/browser/safe_browsing/certificate_reporting_service.h"
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "net/base/network_delegate_impl.h"
#include "net/url_request/url_request_interceptor.h"
#include "net/url_request/url_request_job.h"
namespace net {
class NetworkDelegate;
}
namespace certificate_reporting_test_utils {
// Failure mode of the report sending attempts.
enum ReportSendingResult {
// Report send attempts should be successful.
REPORTS_SUCCESSFUL,
// Report send attempts should fail.
REPORTS_FAIL,
// Report send attempts should hang until explicitly resumed.
REPORTS_DELAY,
};
// A URLRequestJob that can be delayed until Resume() is called. Returns an
// empty response. If Resume() is called before a request is made, then the
// request will not be delayed.
class DelayableCertReportURLRequestJob : public net::URLRequestJob {
public:
DelayableCertReportURLRequestJob(net::URLRequest* request,
net::NetworkDelegate* network_delegate);
~DelayableCertReportURLRequestJob() override;
base::WeakPtr<DelayableCertReportURLRequestJob> GetWeakPtr();
// net::URLRequestJob methods:
void Start() override;
int ReadRawData(net::IOBuffer* buf, int buf_size) override;
int GetResponseCode() const override;
void GetResponseInfo(net::HttpResponseInfo* info) override;
// Resumes a previously started request that was delayed. If no
// request has been started yet, then when Start() is called it will
// not delay.
void Resume();
private:
bool delayed_ = true;
bool started_ = false;
base::WeakPtrFactory<DelayableCertReportURLRequestJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(DelayableCertReportURLRequestJob);
};
// A job interceptor that returns a failed, succesful or delayed request job.
// Used to simulate report uploads that fail, succeed or hang.
class CertReportJobInterceptor : public net::URLRequestInterceptor {
public:
CertReportJobInterceptor(ReportSendingResult expected_report_result,
const uint8_t* server_private_key);
~CertReportJobInterceptor() override;
// net::URLRequestInterceptor method:
net::URLRequestJob* MaybeInterceptRequest(
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const override;
// Sets the failure mode for reports. Must be called on the UI thread.
void SetFailureMode(ReportSendingResult expected_report_result);
// Resumes any hanging URL request. Must be called on the UI thread.
void Resume();
// These must be called on the UI thread.
const std::set<std::string>& successful_reports() const;
const std::set<std::string>& failed_reports() const;
const std::set<std::string>& delayed_reports() const;
void ClearObservedReports();
private:
void SetFailureModeOnIOThread(ReportSendingResult expected_report_result);
void ResumeOnIOThread();
void RequestCreated(const std::string& uploaded_report,
ReportSendingResult expected_report_result);
std::set<std::string> successful_reports_;
std::set<std::string> failed_reports_;
std::set<std::string> delayed_reports_;
ReportSendingResult expected_report_result_;
// Private key to decrypt certificate reports.
const uint8_t* server_private_key_;
mutable base::WeakPtr<DelayableCertReportURLRequestJob> delayed_request_ =
nullptr;
mutable base::WeakPtrFactory<CertReportJobInterceptor> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CertReportJobInterceptor);
};
// A network delegate used to observe URL request destructions. The tests check
// that no outstanding URL request is present during tear down.
class CertificateReportingServiceTestNetworkDelegate
: public net::NetworkDelegateImpl {
public:
CertificateReportingServiceTestNetworkDelegate(
const base::Callback<void()>& url_request_destroyed_callback);
~CertificateReportingServiceTestNetworkDelegate() override;
// net::NetworkDelegate method:
void OnURLRequestDestroyed(net::URLRequest* request) override;
private:
base::Callback<void()> url_request_destroyed_callback_;
};
// Base class for CertificateReportingService tests. Sets up an interceptor to
// keep track of reports that are being sent.
class CertificateReportingServiceTestBase {
protected:
CertificateReportingServiceTestBase();
virtual ~CertificateReportingServiceTestBase();
// Syntactic sugar for wrapping report expectations in a more readable way.
// Passed to WaitForRequestDeletions() as input.
// Example:
// The following expects report0 and report1 to be successfully sent and their
// URL requests to be deleted:
// WaitForRequestDeletions(
// ReportExpectation::Successful("report0, report1"));
struct ReportExpectation {
ReportExpectation();
ReportExpectation(const ReportExpectation& other);
~ReportExpectation();
// Returns an expectation where all reports in |reports| succeed.
static ReportExpectation Successful(const std::set<std::string>& reports);
// Returns an expectation where all reports in |reports| fail.
static ReportExpectation Failed(const std::set<std::string>& reports);
// Returns an expectation where all reports in |reports| are delayed.
static ReportExpectation Delayed(const std::set<std::string>& reports);
std::set<std::string> successful_reports;
std::set<std::string> failed_reports;
std::set<std::string> delayed_reports;
};
void SetUpInterceptor();
void TearDownInterceptor();
// Changes the behavior of report uploads to fail, succeed or hang.
void SetFailureMode(ReportSendingResult expected_report_result);
// Resumes delayed report request. Failure mode should be REPORTS_DELAY when
// calling this method.
void ResumeDelayedRequest();
// Waits for the URL requests for the expected reports to be destroyed.
// Doesn't block if all requests have already been destroyed.
void WaitForRequestsDestroyed(const ReportExpectation& expectation);
uint8_t* server_public_key();
uint32_t server_public_key_version() const;
net::NetworkDelegate* network_delegate();
CertReportJobInterceptor* interceptor() { return url_request_interceptor_; }
private:
void SetUpInterceptorOnIOThread(
std::unique_ptr<net::URLRequestInterceptor> url_request_interceptor);
void TearDownInterceptorOnIOThread();
void OnURLRequestDestroyed();
CertReportJobInterceptor* url_request_interceptor_;
uint8_t server_public_key_[32];
uint8_t server_private_key_[32];
std::unique_ptr<CertificateReportingServiceTestNetworkDelegate>
network_delegate_;
int num_request_deletions_to_wait_for_;
int num_deleted_requests_;
std::unique_ptr<base::RunLoop> run_loop_;
DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceTestBase);
};
} // namespace certificate_reporting_test_utils
#endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_TEST_UTILS_H_
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