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

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

Issue 2632533002: Add retry information to certificate reports. (Closed)
Patch Set: 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_browsertest.cc
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc b/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc
index eb5249ac471cb845652166b3305ab739b5275dce..c84ef0200662a985f02af173f3a9b179964f3bd0 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_service_browsertest.cc
@@ -37,6 +37,7 @@
using certificate_reporting_test_utils::CertificateReportingServiceTestHelper;
using certificate_reporting_test_utils::CertificateReportingServiceObserver;
+using certificate_reporting_test_utils::ObservedReport;
using certificate_reporting_test_utils::ReportExpectation;
namespace {
@@ -234,7 +235,7 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Reporting is opted in, so the report should succeed.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Successful({"report0"}));
+ ReportExpectation::Successful({ObservedReport::NotRetried("report0")}));
}
// Tests that report send attempts are not cancelled when extended reporting is
@@ -253,12 +254,12 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Send a failed report.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report0"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report0")}));
// Send another failed report.
SendReport("report1");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report1"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report1")}));
// Let all report uploads complete successfully now.
test_helper()->SetFailureMode(certificate_reporting_test_utils::
@@ -267,13 +268,14 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Send another report. This time the report should be successfully sent.
SendReport("report2");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Successful({"report2"}));
+ ReportExpectation::Successful({ObservedReport::NotRetried("report2")}));
// Send all pending reports. The two previously failed reports should have
// been queued, and now be sent successfully.
SendPendingReports();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Successful({"report0", "report1"}));
+ ReportExpectation::Successful({ObservedReport::NotRetried("report0"),
+ ObservedReport::NotRetried("report1")}));
// Try sending pending reports again. Since there is no pending report,
// nothing should be sent this time. If any report is sent, test teardown
@@ -296,7 +298,7 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Send a failed report.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report0"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report0")}));
// Disable reporting. This should clear all pending reports.
ChangeOptInAndWait(
@@ -329,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// A failed report should be observed.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report0"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report0")}));
// Disable reporting. This should reset the reporting service and
// clear all pending reports.
@@ -360,7 +362,7 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Send a delayed report.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report0"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report0")}));
// Disable SafeBrowsing. This should clear all pending reports.
ToggleSafeBrowsingAndWaitForServiceReset(false);
@@ -373,14 +375,14 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
ToggleSafeBrowsingAndWaitForServiceReset(true);
SendReport("report1");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report1"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report1")}));
// Queued report should now be successfully sent.
test_helper()->SetFailureMode(certificate_reporting_test_utils::
ReportSendingResult::REPORTS_SUCCESSFUL);
SendPendingReports();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Successful({"report1"}));
+ ReportExpectation::Successful({ObservedReport::Retried("report1")}));
}
// CertificateReportingService should ignore reports older than the report TTL.
@@ -406,13 +408,13 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Send a failed report.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report0"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report0")}));
// Advance the clock a bit and trigger another failed report.
clock->Advance(base::TimeDelta::FromHours(5));
SendReport("report1");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report1"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report1")}));
// Advance the clock to 20 hours, putting it 25 hours ahead of the reference
// time. This makes report0 older than 24 hours. report1 is now 20 hours.
@@ -422,12 +424,12 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// report1 should be queued again.
SendPendingReports();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report1"}));
+ ReportExpectation::Failed({ObservedReport::Retried("report1")}));
// Trigger another failed report.
SendReport("report2");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report2"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report2")}));
// Advance the clock 5 hours. report1 will now be 25 hours old.
clock->Advance(base::TimeDelta::FromHours(5));
@@ -436,7 +438,7 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// report2 should be queued again.
SendPendingReports();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report2"}));
+ ReportExpectation::Failed({ObservedReport::Retried("report2")}));
// Advance the clock 20 hours again so that report2 is 25 hours old and is
// older than max age (24 hours).
@@ -473,7 +475,7 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Trigger a failed report.
SendReport("report0");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report0"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report0")}));
// Trigger three more reports within five hours of each other. After this:
// report0 is 0 hours after reference time (15 hours old).
@@ -490,14 +492,17 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
SendReport("report3");
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report1", "report2", "report3"}));
+ ReportExpectation::Failed({ObservedReport::NotRetried("report1"),
+ ObservedReport::NotRetried("report2"),
+ ObservedReport::NotRetried("report3")}));
// Send pending reports. Four reports were generated above, but the service
// only queues three reports, so report0 should be dropped since it's the
// oldest.
SendPendingReports();
- test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Failed({"report1", "report2", "report3"}));
+ test_helper()->WaitForRequestsDestroyed(ReportExpectation::Failed(
+ {ObservedReport::Retried("report1"), ObservedReport::Retried("report2"),
+ ObservedReport::Retried("report3")}));
// Let all reports succeed.
test_helper()->SetFailureMode(certificate_reporting_test_utils::
@@ -514,7 +519,8 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// should be ignored because it's too old.
SendPendingReports();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Successful({"report2", "report3"}));
+ ReportExpectation::Successful({ObservedReport::Retried("report2"),
+ ObservedReport::Retried("report3")}));
}
IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
@@ -530,14 +536,14 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Trigger a report that hangs.
SendReport("report0");
test_helper()->WaitForRequestsCreated(
- ReportExpectation::Delayed({"report0"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report0")}));
// Resume the report upload. The report upload should successfully complete.
// The interceptor only observes request creations and not response
// completions, so there is nothing to observe.
test_helper()->ResumeDelayedRequest();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Delayed({"report0"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report0")}));
}
// Same as above, but the service is shut down before resuming the delayed
@@ -555,13 +561,13 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest,
// Trigger a report that hangs.
SendReport("report0");
test_helper()->WaitForRequestsCreated(
- ReportExpectation::Delayed({"report0"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report0")}));
// Shutdown the service and resume the report upload. Shouldn't crash.
service()->Shutdown();
test_helper()->ResumeDelayedRequest();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Delayed({"report0"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report0")}));
}
// Trigger a delayed report, then disable Safebrowsing. Certificate reporting
@@ -578,12 +584,12 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, Delayed_Reset) {
// Trigger a report that hangs.
SendReport("report0");
test_helper()->WaitForRequestsCreated(
- ReportExpectation::Delayed({"report0"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report0")}));
// Disable SafeBrowsing. This should clear all pending reports.
ToggleSafeBrowsingAndWaitForServiceReset(false);
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Delayed({"report0"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report0")}));
// Resume delayed report. No response should be observed since all pending
// reports should be cleared.
@@ -596,12 +602,12 @@ IN_PROC_BROWSER_TEST_F(CertificateReportingServiceBrowserTest, Delayed_Reset) {
// Trigger a report that hangs.
SendReport("report1");
test_helper()->WaitForRequestsCreated(
- ReportExpectation::Delayed({"report1"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report1")}));
// Resume the delayed report and wait for it to complete.
test_helper()->ResumeDelayedRequest();
test_helper()->WaitForRequestsDestroyed(
- ReportExpectation::Delayed({"report1"}));
+ ReportExpectation::Delayed({ObservedReport::NotRetried("report1")}));
}
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698