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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc

Issue 564833002: Fix needless environment scan in safe browsing incident reporting service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment tweak Created 6 years, 3 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
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc
index 2377ba3cd757f2e453d1f18c16fc3c5022ad1248..06110e48a8baf1a0d9f1f83227184ced4225edc5 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service_unittest.cc
@@ -794,6 +794,33 @@ TEST_F(IncidentReportingServiceTest, ProcessWideOneUploadAfterProfile) {
ExpectTestIncidentUploaded(1);
}
+TEST_F(IncidentReportingServiceTest, NoCollectionWithoutIncident) {
+ // Register a callback.
+ RegisterAnalysis(ON_DELAYED_ANALYSIS_NO_ACTION);
+
+ // Let all tasks run.
+ task_runner_->RunUntilIdle();
+
+ // Confirm that the callback was not run.
+ ASSERT_FALSE(DelayedAnalysisRan());
+
+ // No collection should have taken place.
+ ASSERT_FALSE(HasCollectedEnvironmentData());
+
+ // Add a profile that participates in safe browsing.
+ CreateProfile(
+ "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION);
+
+ // Let all tasks run.
+ task_runner_->RunUntilIdle();
+
+ // Confirm that the callback was run.
+ ASSERT_TRUE(DelayedAnalysisRan());
+
+ // Still no collection should have taken place.
+ ASSERT_FALSE(HasCollectedEnvironmentData());
+}
+
// Tests that delayed analysis callbacks are called following the addition of a
// profile that participates in safe browsing.
TEST_F(IncidentReportingServiceTest, AnalysisAfterProfile) {
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698