Upstream version 10.38.208.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / safe_browsing / incident_reporting / incident_reporting_service_unittest.cc
index e676110..dbe16fb 100644 (file)
@@ -802,6 +802,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) {