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/incident_reporting_ser
vice.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser
vice.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 TEST_F(IncidentReportingServiceTest, CleanLegacyPruneState) { | 1306 TEST_F(IncidentReportingServiceTest, CleanLegacyPruneState) { |
1307 CreateIncidentReportingService(); | 1307 CreateIncidentReportingService(); |
1308 const std::string omnibox_type(base::IntToString( | 1308 const std::string omnibox_type(base::IntToString( |
1309 static_cast<int32_t>(safe_browsing::IncidentType::OMNIBOX_INTERACTION))); | 1309 static_cast<int32_t>(safe_browsing::IncidentType::OMNIBOX_INTERACTION))); |
1310 const std::string preference_type(base::IntToString( | 1310 const std::string preference_type(base::IntToString( |
1311 static_cast<int32_t>(safe_browsing::IncidentType::TRACKED_PREFERENCE))); | 1311 static_cast<int32_t>(safe_browsing::IncidentType::TRACKED_PREFERENCE))); |
1312 | 1312 |
1313 // Set up a prune state dict with data to be cleared (and not). | 1313 // Set up a prune state dict with data to be cleared (and not). |
1314 std::unique_ptr<base::DictionaryValue> incidents_sent( | 1314 std::unique_ptr<base::DictionaryValue> incidents_sent( |
1315 new base::DictionaryValue()); | 1315 new base::DictionaryValue()); |
1316 base::DictionaryValue* type_dict = new base::DictionaryValue(); | 1316 auto type_dict = base::MakeUnique<base::DictionaryValue>(); |
1317 type_dict->SetStringWithoutPathExpansion("foo", "47"); | 1317 type_dict->SetStringWithoutPathExpansion("foo", "47"); |
1318 incidents_sent->SetWithoutPathExpansion(omnibox_type, type_dict); | 1318 incidents_sent->SetWithoutPathExpansion(omnibox_type, std::move(type_dict)); |
1319 type_dict = new base::DictionaryValue(); | 1319 type_dict = base::MakeUnique<base::DictionaryValue>(); |
1320 type_dict->SetStringWithoutPathExpansion("bar", "43"); | 1320 type_dict->SetStringWithoutPathExpansion("bar", "43"); |
1321 incidents_sent->SetWithoutPathExpansion(preference_type, type_dict); | 1321 incidents_sent->SetWithoutPathExpansion(preference_type, |
| 1322 std::move(type_dict)); |
1322 | 1323 |
1323 // Add a profile. | 1324 // Add a profile. |
1324 Profile* profile = | 1325 Profile* profile = |
1325 CreateProfile("profile1", SAFE_BROWSING_AND_EXTENDED_REPORTING, | 1326 CreateProfile("profile1", SAFE_BROWSING_AND_EXTENDED_REPORTING, |
1326 ON_PROFILE_ADDITION_NO_ACTION, std::move(incidents_sent)); | 1327 ON_PROFILE_ADDITION_NO_ACTION, std::move(incidents_sent)); |
1327 | 1328 |
1328 // Let all tasks run. | 1329 // Let all tasks run. |
1329 mock_time_task_runner_->FastForwardUntilNoTasksRemain(); | 1330 mock_time_task_runner_->FastForwardUntilNoTasksRemain(); |
1330 | 1331 |
1331 const base::DictionaryValue* new_state = | 1332 const base::DictionaryValue* new_state = |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 | 1403 |
1403 // Ensure that no report processing remains. | 1404 // Ensure that no report processing remains. |
1404 ASSERT_FALSE(instance_->IsProcessingReport()); | 1405 ASSERT_FALSE(instance_->IsProcessingReport()); |
1405 } | 1406 } |
1406 | 1407 |
1407 // Parallel uploads | 1408 // Parallel uploads |
1408 // Shutdown during processing | 1409 // Shutdown during processing |
1409 // environment colection taking longer than incident delay timer | 1410 // environment colection taking longer than incident delay timer |
1410 // environment colection taking longer than incident delay timer, and then | 1411 // environment colection taking longer than incident delay timer, and then |
1411 // another incident arriving | 1412 // another incident arriving |
OLD | NEW |