OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/safe_browsing/incident_reporting_service.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting_service.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 typedef base::Callback<scoped_ptr<safe_browsing::IncidentReportUploader>( | 49 typedef base::Callback<scoped_ptr<safe_browsing::IncidentReportUploader>( |
50 const safe_browsing::IncidentReportUploader::OnResultCallback&, | 50 const safe_browsing::IncidentReportUploader::OnResultCallback&, |
51 const safe_browsing::ClientIncidentReport& report)> StartUploadCallback; | 51 const safe_browsing::ClientIncidentReport& report)> StartUploadCallback; |
52 | 52 |
53 TestIncidentReportingService( | 53 TestIncidentReportingService( |
54 const scoped_refptr<base::TaskRunner>& task_runner, | 54 const scoped_refptr<base::TaskRunner>& task_runner, |
55 const PreProfileAddCallback& pre_profile_add_callback, | 55 const PreProfileAddCallback& pre_profile_add_callback, |
56 const CollectEnvironmentCallback& collect_environment_callback, | 56 const CollectEnvironmentCallback& collect_environment_callback, |
57 const CreateDownloadFinderCallback& create_download_finder_callback, | 57 const CreateDownloadFinderCallback& create_download_finder_callback, |
58 const StartUploadCallback& start_upload_callback) | 58 const StartUploadCallback& start_upload_callback) |
59 : IncidentReportingService(NULL, NULL), | 59 : IncidentReportingService(NULL, |
| 60 NULL, |
| 61 base::TimeDelta::FromMilliseconds(5), |
| 62 task_runner), |
60 pre_profile_add_callback_(pre_profile_add_callback), | 63 pre_profile_add_callback_(pre_profile_add_callback), |
61 collect_environment_callback_(collect_environment_callback), | 64 collect_environment_callback_(collect_environment_callback), |
62 create_download_finder_callback_(create_download_finder_callback), | 65 create_download_finder_callback_(create_download_finder_callback), |
63 start_upload_callback_(start_upload_callback) { | 66 start_upload_callback_(start_upload_callback) { |
64 SetCollectEnvironmentHook(&CollectEnvironmentData, task_runner); | 67 SetCollectEnvironmentHook(&CollectEnvironmentData, task_runner); |
65 test_instance_.Get().Set(this); | 68 test_instance_.Get().Set(this); |
66 } | 69 } |
67 | 70 |
68 virtual ~TestIncidentReportingService() { test_instance_.Get().Set(NULL); } | 71 virtual ~TestIncidentReportingService() { test_instance_.Get().Set(NULL); } |
69 | 72 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // service creates a LastDownloadFinder. | 128 // service creates a LastDownloadFinder. |
126 enum OnCreateDownloadFinderAction { | 129 enum OnCreateDownloadFinderAction { |
127 // Post a task that reports a download. | 130 // Post a task that reports a download. |
128 ON_CREATE_DOWNLOAD_FINDER_DOWNLOAD_FOUND, | 131 ON_CREATE_DOWNLOAD_FINDER_DOWNLOAD_FOUND, |
129 // Post a task that reports no downloads found. | 132 // Post a task that reports no downloads found. |
130 ON_CREATE_DOWNLOAD_FINDER_NO_DOWNLOADS, | 133 ON_CREATE_DOWNLOAD_FINDER_NO_DOWNLOADS, |
131 // Immediately return due to a lack of eligible profiles. | 134 // Immediately return due to a lack of eligible profiles. |
132 ON_CREATE_DOWNLOAD_FINDER_NO_PROFILES, | 135 ON_CREATE_DOWNLOAD_FINDER_NO_PROFILES, |
133 }; | 136 }; |
134 | 137 |
| 138 // A type for specifying the action to be taken by the test fixture when its |
| 139 // delayed analysis callback is run. |
| 140 enum OnDelayedAnalysisAction { |
| 141 ON_DELAYED_ANALYSIS_NO_ACTION, |
| 142 ON_DELAYED_ANALYSIS_ADD_INCIDENT, // Add an incident to the service. |
| 143 }; |
| 144 |
135 static const int64 kIncidentTimeMsec; | 145 static const int64 kIncidentTimeMsec; |
136 static const char kFakeOsName[]; | 146 static const char kFakeOsName[]; |
137 static const char kFakeDownloadToken[]; | 147 static const char kFakeDownloadToken[]; |
138 static const char kTestTrackedPrefPath[]; | 148 static const char kTestTrackedPrefPath[]; |
139 | 149 |
140 IncidentReportingServiceTest() | 150 IncidentReportingServiceTest() |
141 : task_runner_(new base::TestSimpleTaskRunner), | 151 : task_runner_(new base::TestSimpleTaskRunner), |
142 thread_task_runner_handle_(task_runner_), | 152 thread_task_runner_handle_(task_runner_), |
143 profile_manager_(TestingBrowserProcess::GetGlobal()), | 153 profile_manager_(TestingBrowserProcess::GetGlobal()), |
144 instance_(new TestIncidentReportingService( | 154 instance_(new TestIncidentReportingService( |
145 task_runner_, | 155 task_runner_, |
146 base::Bind(&IncidentReportingServiceTest::PreProfileAdd, | 156 base::Bind(&IncidentReportingServiceTest::PreProfileAdd, |
147 base::Unretained(this)), | 157 base::Unretained(this)), |
148 base::Bind(&IncidentReportingServiceTest::CollectEnvironmentData, | 158 base::Bind(&IncidentReportingServiceTest::CollectEnvironmentData, |
149 base::Unretained(this)), | 159 base::Unretained(this)), |
150 base::Bind(&IncidentReportingServiceTest::CreateDownloadFinder, | 160 base::Bind(&IncidentReportingServiceTest::CreateDownloadFinder, |
151 base::Unretained(this)), | 161 base::Unretained(this)), |
152 base::Bind(&IncidentReportingServiceTest::StartUpload, | 162 base::Bind(&IncidentReportingServiceTest::StartUpload, |
153 base::Unretained(this)))), | 163 base::Unretained(this)))), |
154 on_create_download_finder_action_( | 164 on_create_download_finder_action_( |
155 ON_CREATE_DOWNLOAD_FINDER_DOWNLOAD_FOUND), | 165 ON_CREATE_DOWNLOAD_FINDER_DOWNLOAD_FOUND), |
| 166 on_delayed_analysis_action_(ON_DELAYED_ANALYSIS_NO_ACTION), |
156 upload_result_(safe_browsing::IncidentReportUploader::UPLOAD_SUCCESS), | 167 upload_result_(safe_browsing::IncidentReportUploader::UPLOAD_SUCCESS), |
157 environment_collected_(), | 168 environment_collected_(), |
158 download_finder_created_(), | 169 download_finder_created_(), |
159 download_finder_destroyed_(), | 170 download_finder_destroyed_(), |
160 uploader_destroyed_() {} | 171 uploader_destroyed_(), |
| 172 delayed_analysis_ran_() {} |
161 | 173 |
162 virtual void SetUp() OVERRIDE { | 174 virtual void SetUp() OVERRIDE { |
163 testing::Test::SetUp(); | 175 testing::Test::SetUp(); |
164 ASSERT_TRUE(profile_manager_.SetUp()); | 176 ASSERT_TRUE(profile_manager_.SetUp()); |
165 } | 177 } |
166 | 178 |
167 // Sets the action to be taken by the test fixture when the service creates a | 179 // Sets the action to be taken by the test fixture when the service creates a |
168 // LastDownloadFinder. | 180 // LastDownloadFinder. |
169 void SetCreateDownloadFinderAction(OnCreateDownloadFinderAction action) { | 181 void SetCreateDownloadFinderAction(OnCreateDownloadFinderAction action) { |
170 on_create_download_finder_action_ = action; | 182 on_create_download_finder_action_ = action; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 tp_incident = incident->mutable_tracked_preference(); | 229 tp_incident = incident->mutable_tracked_preference(); |
218 tp_incident->set_path(kTestTrackedPrefPath); | 230 tp_incident->set_path(kTestTrackedPrefPath); |
219 return incident.Pass(); | 231 return incident.Pass(); |
220 } | 232 } |
221 | 233 |
222 // Adds a test incident to the service. | 234 // Adds a test incident to the service. |
223 void AddTestIncident(Profile* profile) { | 235 void AddTestIncident(Profile* profile) { |
224 instance_->GetAddIncidentCallback(profile).Run(MakeTestIncident().Pass()); | 236 instance_->GetAddIncidentCallback(profile).Run(MakeTestIncident().Pass()); |
225 } | 237 } |
226 | 238 |
| 239 // Registers the callback to be run for delayed analysis. |
| 240 void RegisterAnalysis(OnDelayedAnalysisAction on_delayed_analysis_action) { |
| 241 on_delayed_analysis_action_ = on_delayed_analysis_action; |
| 242 instance_->RegisterDelayedAnalysisCallback( |
| 243 base::Bind(&IncidentReportingServiceTest::OnDelayedAnalysis, |
| 244 base::Unretained(this))); |
| 245 } |
| 246 |
227 // Confirms that the test incident(s) was/were uploaded by the service, then | 247 // Confirms that the test incident(s) was/were uploaded by the service, then |
228 // clears the instance for subsequent incidents. | 248 // clears the instance for subsequent incidents. |
229 void ExpectTestIncidentUploaded(int incident_count) { | 249 void ExpectTestIncidentUploaded(int incident_count) { |
230 ASSERT_TRUE(uploaded_report_); | 250 ASSERT_TRUE(uploaded_report_); |
231 ASSERT_EQ(incident_count, uploaded_report_->incident_size()); | 251 ASSERT_EQ(incident_count, uploaded_report_->incident_size()); |
232 for (int i = 0; i < incident_count; ++i) { | 252 for (int i = 0; i < incident_count; ++i) { |
233 ASSERT_TRUE(uploaded_report_->incident(i).has_incident_time_msec()); | 253 ASSERT_TRUE(uploaded_report_->incident(i).has_incident_time_msec()); |
234 ASSERT_EQ(kIncidentTimeMsec, | 254 ASSERT_EQ(kIncidentTimeMsec, |
235 uploaded_report_->incident(i).incident_time_msec()); | 255 uploaded_report_->incident(i).incident_time_msec()); |
236 ASSERT_TRUE(uploaded_report_->incident(i).has_tracked_preference()); | 256 ASSERT_TRUE(uploaded_report_->incident(i).has_tracked_preference()); |
(...skipping 12 matching lines...) Expand all Loading... |
249 | 269 |
250 uploaded_report_.reset(); | 270 uploaded_report_.reset(); |
251 } | 271 } |
252 | 272 |
253 void AssertNoUpload() { ASSERT_FALSE(uploaded_report_); } | 273 void AssertNoUpload() { ASSERT_FALSE(uploaded_report_); } |
254 | 274 |
255 bool HasCollectedEnvironmentData() const { return environment_collected_; } | 275 bool HasCollectedEnvironmentData() const { return environment_collected_; } |
256 bool HasCreatedDownloadFinder() const { return download_finder_created_; } | 276 bool HasCreatedDownloadFinder() const { return download_finder_created_; } |
257 bool DownloadFinderDestroyed() const { return download_finder_destroyed_; } | 277 bool DownloadFinderDestroyed() const { return download_finder_destroyed_; } |
258 bool UploaderDestroyed() const { return uploader_destroyed_; } | 278 bool UploaderDestroyed() const { return uploader_destroyed_; } |
| 279 bool DelayedAnalysisRan() const { return delayed_analysis_ran_; } |
259 | 280 |
260 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 281 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
261 base::ThreadTaskRunnerHandle thread_task_runner_handle_; | 282 base::ThreadTaskRunnerHandle thread_task_runner_handle_; |
262 TestingProfileManager profile_manager_; | 283 TestingProfileManager profile_manager_; |
263 scoped_ptr<safe_browsing::IncidentReportingService> instance_; | 284 scoped_ptr<safe_browsing::IncidentReportingService> instance_; |
264 base::Closure on_start_upload_callback_; | 285 base::Closure on_start_upload_callback_; |
265 OnCreateDownloadFinderAction on_create_download_finder_action_; | 286 OnCreateDownloadFinderAction on_create_download_finder_action_; |
| 287 OnDelayedAnalysisAction on_delayed_analysis_action_; |
266 safe_browsing::IncidentReportUploader::Result upload_result_; | 288 safe_browsing::IncidentReportUploader::Result upload_result_; |
267 bool environment_collected_; | 289 bool environment_collected_; |
268 bool download_finder_created_; | 290 bool download_finder_created_; |
269 scoped_ptr<safe_browsing::ClientIncidentReport> uploaded_report_; | 291 scoped_ptr<safe_browsing::ClientIncidentReport> uploaded_report_; |
270 bool download_finder_destroyed_; | 292 bool download_finder_destroyed_; |
271 bool uploader_destroyed_; | 293 bool uploader_destroyed_; |
| 294 bool delayed_analysis_ran_; |
272 | 295 |
273 private: | 296 private: |
274 // A fake IncidentReportUploader that posts a task to provide a given response | 297 // A fake IncidentReportUploader that posts a task to provide a given response |
275 // back to the incident reporting service. It also reports back to the test | 298 // back to the incident reporting service. It also reports back to the test |
276 // harness via a closure when it is deleted by the incident reporting service. | 299 // harness via a closure when it is deleted by the incident reporting service. |
277 class FakeUploader : public safe_browsing::IncidentReportUploader { | 300 class FakeUploader : public safe_browsing::IncidentReportUploader { |
278 public: | 301 public: |
279 FakeUploader( | 302 FakeUploader( |
280 const base::Closure& on_deleted, | 303 const base::Closure& on_deleted, |
281 const safe_browsing::IncidentReportUploader::OnResultCallback& callback, | 304 const safe_browsing::IncidentReportUploader::OnResultCallback& callback, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 base::Bind( | 451 base::Bind( |
429 &IncidentReportingServiceTest::OnUploaderDestroyed, | 452 &IncidentReportingServiceTest::OnUploaderDestroyed, |
430 base::Unretained(this)), | 453 base::Unretained(this)), |
431 callback, | 454 callback, |
432 upload_result_)).Pass(); | 455 upload_result_)).Pass(); |
433 } | 456 } |
434 | 457 |
435 void OnDownloadFinderDestroyed() { download_finder_destroyed_ = true; } | 458 void OnDownloadFinderDestroyed() { download_finder_destroyed_ = true; } |
436 void OnUploaderDestroyed() { uploader_destroyed_ = true; } | 459 void OnUploaderDestroyed() { uploader_destroyed_ = true; } |
437 | 460 |
| 461 void OnDelayedAnalysis(const safe_browsing::AddIncidentCallback& callback) { |
| 462 delayed_analysis_ran_ = true; |
| 463 if (on_delayed_analysis_action_ == ON_DELAYED_ANALYSIS_ADD_INCIDENT) |
| 464 callback.Run(MakeTestIncident().Pass()); |
| 465 } |
| 466 |
438 // A mapping of profile name to its corresponding properties. | 467 // A mapping of profile name to its corresponding properties. |
439 std::map<std::string, ProfileProperties> profile_properties_; | 468 std::map<std::string, ProfileProperties> profile_properties_; |
440 }; | 469 }; |
441 | 470 |
442 // static | 471 // static |
443 base::LazyInstance<base::ThreadLocalPointer< | 472 base::LazyInstance<base::ThreadLocalPointer< |
444 IncidentReportingServiceTest::TestIncidentReportingService> >::Leaky | 473 IncidentReportingServiceTest::TestIncidentReportingService> >::Leaky |
445 IncidentReportingServiceTest::TestIncidentReportingService::test_instance_ = | 474 IncidentReportingServiceTest::TestIncidentReportingService::test_instance_ = |
446 LAZY_INSTANCE_INITIALIZER; | 475 LAZY_INSTANCE_INITIALIZER; |
447 | 476 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // Adding the same incident again should still result in no upload. | 702 // Adding the same incident again should still result in no upload. |
674 AddTestIncident(profile); | 703 AddTestIncident(profile); |
675 | 704 |
676 // Let all tasks run. | 705 // Let all tasks run. |
677 task_runner_->RunUntilIdle(); | 706 task_runner_->RunUntilIdle(); |
678 | 707 |
679 // No upload should have taken place. | 708 // No upload should have taken place. |
680 AssertNoUpload(); | 709 AssertNoUpload(); |
681 } | 710 } |
682 | 711 |
| 712 // Tests that no upload results from adding an incident that is not affiliated |
| 713 // with a profile. |
| 714 TEST_F(IncidentReportingServiceTest, ProcessWideNoProfileNoUpload) { |
| 715 // Add the test incident. |
| 716 AddTestIncident(NULL); |
| 717 |
| 718 // Let all tasks run. |
| 719 task_runner_->RunUntilIdle(); |
| 720 |
| 721 // No upload should have taken place. |
| 722 AssertNoUpload(); |
| 723 } |
| 724 |
| 725 // Tests that there is an upload when a profile is present for a proc-wide |
| 726 // incident and that pruning works. |
| 727 TEST_F(IncidentReportingServiceTest, ProcessWideOneUpload) { |
| 728 // Add a profile that participates in safe browsing. |
| 729 CreateProfile( |
| 730 "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION); |
| 731 |
| 732 // Add the test incident. |
| 733 AddTestIncident(NULL); |
| 734 |
| 735 // Let all tasks run. |
| 736 task_runner_->RunUntilIdle(); |
| 737 |
| 738 // An upload should have taken place. |
| 739 ExpectTestIncidentUploaded(1); |
| 740 |
| 741 // Add the incident to the service again. |
| 742 AddTestIncident(NULL); |
| 743 |
| 744 // Let all tasks run. |
| 745 task_runner_->RunUntilIdle(); |
| 746 |
| 747 // Verify that no additional report upload took place. |
| 748 AssertNoUpload(); |
| 749 } |
| 750 |
| 751 // Tests that two process-wide incidents of the same type with different |
| 752 // payloads added via the same callback lead to two uploads. |
| 753 TEST_F(IncidentReportingServiceTest, ProcessWideTwoUploads) { |
| 754 // Add a profile that participates in safe browsing. |
| 755 CreateProfile( |
| 756 "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION); |
| 757 |
| 758 // Add the test incident. |
| 759 safe_browsing::AddIncidentCallback add_incident( |
| 760 instance_->GetAddIncidentCallback(NULL)); |
| 761 add_incident.Run(MakeTestIncident().Pass()); |
| 762 |
| 763 // Let all tasks run. |
| 764 task_runner_->RunUntilIdle(); |
| 765 |
| 766 // An upload should have taken place. |
| 767 ExpectTestIncidentUploaded(1); |
| 768 |
| 769 // Add a variation on the incident to the service. |
| 770 scoped_ptr<safe_browsing::ClientIncidentReport_IncidentData> incident( |
| 771 MakeTestIncident()); |
| 772 incident->mutable_tracked_preference()->set_atomic_value("leeches"); |
| 773 add_incident.Run(incident.Pass()); |
| 774 |
| 775 // Let all tasks run. |
| 776 task_runner_->RunUntilIdle(); |
| 777 |
| 778 // Verify that an additional report upload took place. |
| 779 ExpectTestIncidentUploaded(1); |
| 780 } |
| 781 |
| 782 // Tests that there is an upload when a profile appears after a proc-wide |
| 783 // incident. |
| 784 TEST_F(IncidentReportingServiceTest, ProcessWideOneUploadAfterProfile) { |
| 785 // Add the test incident. |
| 786 AddTestIncident(NULL); |
| 787 |
| 788 // Let all tasks run. |
| 789 task_runner_->RunUntilIdle(); |
| 790 |
| 791 // Verify that no report upload took place. |
| 792 AssertNoUpload(); |
| 793 |
| 794 // Add a profile that participates in safe browsing. |
| 795 CreateProfile( |
| 796 "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION); |
| 797 |
| 798 // Let all tasks run. |
| 799 task_runner_->RunUntilIdle(); |
| 800 |
| 801 // An upload should have taken place. |
| 802 ExpectTestIncidentUploaded(1); |
| 803 } |
| 804 |
| 805 // Tests that delayed analysis callbacks are called following the addition of a |
| 806 // profile that participates in safe browsing. |
| 807 TEST_F(IncidentReportingServiceTest, AnalysisAfterProfile) { |
| 808 // Register a callback. |
| 809 RegisterAnalysis(ON_DELAYED_ANALYSIS_NO_ACTION); |
| 810 |
| 811 // Let all tasks run. |
| 812 task_runner_->RunUntilIdle(); |
| 813 |
| 814 // Not run yet. |
| 815 ASSERT_FALSE(DelayedAnalysisRan()); |
| 816 |
| 817 // Add a profile that participates in safe browsing. |
| 818 CreateProfile( |
| 819 "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION); |
| 820 |
| 821 // Let all tasks run. |
| 822 task_runner_->RunUntilIdle(); |
| 823 |
| 824 // And now they have. |
| 825 ASSERT_TRUE(DelayedAnalysisRan()); |
| 826 } |
| 827 |
| 828 // Tests that delayed analysis callbacks are called following their registration |
| 829 // when a profile that participates in safe browsing is already present. |
| 830 TEST_F(IncidentReportingServiceTest, AnalysisWhenRegisteredWithProfile) { |
| 831 // Add a profile that participates in safe browsing. |
| 832 CreateProfile( |
| 833 "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION); |
| 834 |
| 835 // Register a callback. |
| 836 RegisterAnalysis(ON_DELAYED_ANALYSIS_NO_ACTION); |
| 837 |
| 838 // Let all tasks run. |
| 839 task_runner_->RunUntilIdle(); |
| 840 |
| 841 // Confirm that the callbacks were run. |
| 842 ASSERT_TRUE(DelayedAnalysisRan()); |
| 843 } |
| 844 |
| 845 // Tests that no upload results from a delayed analysis incident when no |
| 846 // safe browsing profile is present. |
| 847 TEST_F(IncidentReportingServiceTest, DelayedAnalysisNoProfileNoUpload) { |
| 848 // Register a callback that will add an incident. |
| 849 RegisterAnalysis(ON_DELAYED_ANALYSIS_ADD_INCIDENT); |
| 850 |
| 851 // Add a profile that does not participate in safe browsing. |
| 852 CreateProfile( |
| 853 "profile1", SAFE_BROWSING_OPT_OUT, ON_PROFILE_ADDITION_NO_ACTION); |
| 854 |
| 855 // Let all tasks run. |
| 856 task_runner_->RunUntilIdle(); |
| 857 |
| 858 // The callback should not have been run. |
| 859 ASSERT_FALSE(DelayedAnalysisRan()); |
| 860 |
| 861 // No upload should have taken place. |
| 862 AssertNoUpload(); |
| 863 } |
| 864 |
| 865 // Tests that there is an upload when a profile is present for a delayed |
| 866 // analysis incident and that pruning works. |
| 867 TEST_F(IncidentReportingServiceTest, DelayedAnalysisOneUpload) { |
| 868 // Register a callback that will add an incident. |
| 869 RegisterAnalysis(ON_DELAYED_ANALYSIS_ADD_INCIDENT); |
| 870 |
| 871 // Add a profile that participates in safe browsing. |
| 872 CreateProfile( |
| 873 "profile1", SAFE_BROWSING_OPT_IN, ON_PROFILE_ADDITION_NO_ACTION); |
| 874 |
| 875 // Let all tasks run. |
| 876 task_runner_->RunUntilIdle(); |
| 877 |
| 878 // The callback should have been run. |
| 879 ASSERT_TRUE(DelayedAnalysisRan()); |
| 880 |
| 881 // An upload should have taken place. |
| 882 ExpectTestIncidentUploaded(1); |
| 883 |
| 884 // Add the incident to the service again. |
| 885 AddTestIncident(NULL); |
| 886 |
| 887 // Let all tasks run. |
| 888 task_runner_->RunUntilIdle(); |
| 889 |
| 890 // Verify that no additional report upload took place. |
| 891 AssertNoUpload(); |
| 892 } |
| 893 |
683 // Parallel uploads | 894 // Parallel uploads |
684 // Shutdown during processing | 895 // Shutdown during processing |
685 // environment colection taking longer than incident delay timer | 896 // environment colection taking longer than incident delay timer |
686 // environment colection taking longer than incident delay timer, and then | 897 // environment colection taking longer than incident delay timer, and then |
687 // another incident arriving | 898 // another incident arriving |
OLD | NEW |