Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2705)

Unified Diff: chrome/browser/safe_browsing/certificate_reporting_service.cc

Issue 2605403002: Fix flaky CertificateReportingService browser tests. (Closed)
Patch Set: Fix broken tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/certificate_reporting_service.cc
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service.cc b/chrome/browser/safe_browsing/certificate_reporting_service.cc
index 9bcecb8a5ef09f64b662356e4190a9317d61355c..d0fb362c53701d89d6850c56ae7a62a5e22eff63 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_service.cc
@@ -167,12 +167,14 @@ CertificateReportingService::CertificateReportingService(
uint32_t server_public_key_version,
size_t max_queued_report_count,
base::TimeDelta max_report_age,
- base::Clock* clock)
+ base::Clock* clock,
+ const base::Callback<void()>& reset_callback)
: pref_service_(*profile->GetPrefs()),
url_request_context_(nullptr),
max_queued_report_count_(max_queued_report_count),
max_report_age_(max_report_age),
clock_(clock),
+ reset_callback_(reset_callback),
server_public_key_(server_public_key),
server_public_key_version_(server_public_key_version) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -188,12 +190,13 @@ CertificateReportingService::CertificateReportingService(
base::Bind(&CertificateReportingService::OnPreferenceChanged,
base::Unretained(this)));
- content::BrowserThread::PostTask(
+ content::BrowserThread::PostTaskAndReply(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&CertificateReportingService::InitializeOnIOThread,
base::Unretained(this), true, url_request_context_getter,
max_queued_report_count_, max_report_age_, clock_,
- server_public_key_, server_public_key_version_));
+ server_public_key_, server_public_key_version_),
+ reset_callback_);
}
CertificateReportingService::~CertificateReportingService() {
@@ -253,12 +256,13 @@ void CertificateReportingService::SetEnabled(bool enabled) {
if (!url_request_context_)
return;
- content::BrowserThread::PostTask(
+ content::BrowserThread::PostTaskAndReply(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&CertificateReportingService::ResetOnIOThread,
base::Unretained(this), enabled, url_request_context_,
max_queued_report_count_, max_report_age_, clock_,
- server_public_key_, server_public_key_version_));
+ server_public_key_, server_public_key_version_),
+ reset_callback_);
}
CertificateReportingService::Reporter*

Powered by Google App Engine
This is Rietveld 408576698