diff --git a/components/attribution_reporting/aggregatable_dedup_key.cc b/components/attribution_reporting/aggregatable_dedup_key.cc index eaa617e5407d1..7759a29465fbd 100644 --- a/components/attribution_reporting/aggregatable_dedup_key.cc +++ b/components/attribution_reporting/aggregatable_dedup_key.cc @@ -36,7 +36,11 @@ AggregatableDedupKey::FromJSON(base::Value& value) { if (!filters.has_value()) { return base::unexpected(filters.error()); } - absl::optional dedup_key = ParseDeduplicationKey(*dict); + absl::optional dedup_key; + if (!ParseDeduplicationKey(*dict, dedup_key)) { + return base::unexpected( + TriggerRegistrationError::kAggregatableDedupKeyValueInvalid); + } return AggregatableDedupKey(dedup_key, std::move(*filters)); } diff --git a/components/attribution_reporting/aggregatable_dedup_key_unittest.cc b/components/attribution_reporting/aggregatable_dedup_key_unittest.cc index fb2fa5949da48..f171287b506de 100644 --- a/components/attribution_reporting/aggregatable_dedup_key_unittest.cc +++ b/components/attribution_reporting/aggregatable_dedup_key_unittest.cc @@ -45,12 +45,14 @@ TEST(AggregatableDedupKeyTest, FromJSON) { { "dedup_key_wrong_type", R"json({"deduplication_key":123})json", - AggregatableDedupKey(), + base::unexpected( + TriggerRegistrationError::kAggregatableDedupKeyValueInvalid), }, { "dedup_key_invalid", R"json({"deduplication_key":"abc"})json", - AggregatableDedupKey(), + base::unexpected( + TriggerRegistrationError::kAggregatableDedupKeyValueInvalid), }, { "filters_valid", diff --git a/components/attribution_reporting/event_trigger_data.cc b/components/attribution_reporting/event_trigger_data.cc index 803dec31cab6f..aadd176b3a8c7 100644 --- a/components/attribution_reporting/event_trigger_data.cc +++ b/components/attribution_reporting/event_trigger_data.cc @@ -37,11 +37,26 @@ EventTriggerData::FromJSON(base::Value& value) { if (!filters.has_value()) return base::unexpected(filters.error()); - uint64_t data = ParseUint64(*dict, kTriggerData).value_or(0); - int64_t priority = ParsePriority(*dict); - absl::optional dedup_key = ParseDeduplicationKey(*dict); + absl::optional data; + if (!ParseUint64(*dict, kTriggerData, data)) { + return base::unexpected( + TriggerRegistrationError::kEventTriggerDataValueInvalid); + } + + absl::optional priority; + if (!ParsePriority(*dict, priority)) { + return base::unexpected( + TriggerRegistrationError::kEventPriorityValueInvalid); + } + + absl::optional dedup_key; + if (!ParseDeduplicationKey(*dict, dedup_key)) { + return base::unexpected( + TriggerRegistrationError::kEventDedupKeyValueInvalid); + } - return EventTriggerData(data, priority, dedup_key, std::move(*filters)); + return EventTriggerData(data.value_or(0), priority.value_or(0), dedup_key, + std::move(*filters)); } EventTriggerData::EventTriggerData() = default; diff --git a/components/attribution_reporting/event_trigger_data_unittest.cc b/components/attribution_reporting/event_trigger_data_unittest.cc index 81bf4f08f2964..662c96d85e066 100644 --- a/components/attribution_reporting/event_trigger_data_unittest.cc +++ b/components/attribution_reporting/event_trigger_data_unittest.cc @@ -44,12 +44,14 @@ TEST(EventTriggerDataTest, FromJSON) { { "trigger_data_wrong_type", R"json({"trigger_data":123})json", - EventTriggerData(), + base::unexpected( + TriggerRegistrationError::kEventTriggerDataValueInvalid), }, { "trigger_data_invalid", R"json({"trigger_data":"-5"})json", - EventTriggerData(), + base::unexpected( + TriggerRegistrationError::kEventTriggerDataValueInvalid), }, { "priority_valid", @@ -60,12 +62,14 @@ TEST(EventTriggerDataTest, FromJSON) { { "priority_wrong_type", R"json({"priority":123})json", - EventTriggerData(), + base::unexpected( + TriggerRegistrationError::kEventPriorityValueInvalid), }, { "priority_invalid", R"json({"priority":"abc"})json", - EventTriggerData(), + base::unexpected( + TriggerRegistrationError::kEventPriorityValueInvalid), }, { "dedup_key_valid", @@ -76,12 +80,14 @@ TEST(EventTriggerDataTest, FromJSON) { { "dedup_key_wrong_type", R"json({"deduplication_key":123})json", - EventTriggerData(), + base::unexpected( + TriggerRegistrationError::kEventDedupKeyValueInvalid), }, { "dedup_key_invalid", R"json({"deduplication_key":"abc"})json", - EventTriggerData(), + base::unexpected( + TriggerRegistrationError::kEventDedupKeyValueInvalid), }, { "filters_valid", diff --git a/components/attribution_reporting/parsing_utils.cc b/components/attribution_reporting/parsing_utils.cc index 151092d65ef7e..93d5297453ad8 100644 --- a/components/attribution_reporting/parsing_utils.cc +++ b/components/attribution_reporting/parsing_utils.cc @@ -51,38 +51,63 @@ std::string HexEncodeAggregationKey(absl::uint128 value) { return out.str(); } -absl::optional ParseUint64(const base::Value::Dict& dict, - base::StringPiece key) { - const std::string* s = dict.FindString(key); - if (!s) - return absl::nullopt; +bool ParseUint64(const base::Value::Dict& dict, + base::StringPiece key, + absl::optional& out) { + const base::Value* value = dict.Find(key); + if (!value) { + out = absl::nullopt; + return true; + } + + const std::string* str = value->GetIfString(); + if (!str) { + out = absl::nullopt; + return false; + } - uint64_t value; - return base::StringToUint64(*s, &value) ? absl::make_optional(value) - : absl::nullopt; + uint64_t parsed_val; + out = base::StringToUint64(*str, &parsed_val) + ? absl::make_optional(parsed_val) + : absl::nullopt; + return out.has_value(); } -absl::optional ParseInt64(const base::Value::Dict& dict, - base::StringPiece key) { - const std::string* s = dict.FindString(key); - if (!s) - return absl::nullopt; +bool ParseInt64(const base::Value::Dict& dict, + base::StringPiece key, + absl::optional& out) { + const base::Value* value = dict.Find(key); + if (!value) { + out = absl::nullopt; + return true; + } + + const std::string* str = value->GetIfString(); + if (!str) { + out = absl::nullopt; + return false; + } - int64_t value; - return base::StringToInt64(*s, &value) ? absl::make_optional(value) - : absl::nullopt; + int64_t parsed_val; + out = base::StringToInt64(*str, &parsed_val) ? absl::make_optional(parsed_val) + : absl::nullopt; + return out.has_value(); } -int64_t ParsePriority(const base::Value::Dict& dict) { - return ParseInt64(dict, kPriority).value_or(0); +bool ParsePriority(const base::Value::Dict& dict, + absl::optional& out) { + return ParseInt64(dict, kPriority, out); } absl::optional ParseDebugKey(const base::Value::Dict& dict) { - return ParseUint64(dict, kDebugKey); + absl::optional debug_key; + std::ignore = ParseUint64(dict, kDebugKey, debug_key); + return debug_key; } -absl::optional ParseDeduplicationKey(const base::Value::Dict& dict) { - return ParseUint64(dict, kDeduplicationKey); +bool ParseDeduplicationKey(const base::Value::Dict& dict, + absl::optional& out) { + return ParseUint64(dict, kDeduplicationKey, out); } bool ParseDebugReporting(const base::Value::Dict& dict) { diff --git a/components/attribution_reporting/parsing_utils.h b/components/attribution_reporting/parsing_utils.h index c2750e92823a1..1a028f71a2106 100644 --- a/components/attribution_reporting/parsing_utils.h +++ b/components/attribution_reporting/parsing_utils.h @@ -29,21 +29,38 @@ std::string HexEncodeAggregationKey(absl::uint128); COMPONENT_EXPORT(ATTRIBUTION_REPORTING) bool AggregationKeyIdHasValidLength(const std::string& key); -COMPONENT_EXPORT(ATTRIBUTION_REPORTING) -absl::optional ParseUint64(const base::Value::Dict& dict, - base::StringPiece key); - -COMPONENT_EXPORT(ATTRIBUTION_REPORTING) -absl::optional ParseInt64(const base::Value::Dict& dict, - base::StringPiece key); - -int64_t ParsePriority(const base::Value::Dict& dict); - +// Returns false if `dict` contains `key` but the value is invalid (e.g. not a +// string, negative), returns true otherwise. +[[nodiscard]] COMPONENT_EXPORT(ATTRIBUTION_REPORTING) bool ParseUint64( + const base::Value::Dict& dict, + base::StringPiece key, + absl::optional& out); + +// Returns false if `dict` contains `key` but the value is invalid (e.g. not a +// string, int64 overflow), returns true otherwise. +[[nodiscard]] COMPONENT_EXPORT(ATTRIBUTION_REPORTING) bool ParseInt64( + const base::Value::Dict& dict, + base::StringPiece key, + absl::optional& out); + +// Returns false if `dict` contains `priority` key but the value is invalid, +// returns true otherwise. +[[nodiscard]] bool ParsePriority(const base::Value::Dict& dict, + absl::optional& out); + +// Returns `debug_key` value as we do not need to fail the source registration +// if the value is invalid, see +// https://github.com/WICG/attribution-reporting-api/issues/793 for context. absl::optional ParseDebugKey(const base::Value::Dict& dict); -bool ParseDebugReporting(const base::Value::Dict& dict); +// Returns false if `dict` contains `debug_reporting` key but the value is +// invalid, returns true otherwise. +[[nodiscard]] bool ParseDebugReporting(const base::Value::Dict& dict); -absl::optional ParseDeduplicationKey(const base::Value::Dict& dict); +// Returns false if `dict` contains `deduplication_key` key but the value is +// invalid, returns true otherwise. +[[nodiscard]] bool ParseDeduplicationKey(const base::Value::Dict& dict, + absl::optional& out); void SerializeUint64(base::Value::Dict&, base::StringPiece key, uint64_t value); diff --git a/components/attribution_reporting/parsing_utils_unittest.cc b/components/attribution_reporting/parsing_utils_unittest.cc index 3c4d9e02732bd..dc9e3cd2b33d0 100644 --- a/components/attribution_reporting/parsing_utils_unittest.cc +++ b/components/attribution_reporting/parsing_utils_unittest.cc @@ -47,44 +47,54 @@ TEST(AttributionReportingParsingUtilsTest, ParseUint64) { const struct { const char* description; const char* json; - absl::optional expected; + absl::optional expected_out; + bool expected_return; } kTestCases[] = { { "missing_key", R"json({})json", absl::nullopt, + true, }, { "not_string", R"json({"key":123})json", absl::nullopt, + false, }, { "negative", R"json({"key":"-1"})json", absl::nullopt, + false, }, { "zero", R"json({"key":"0"})json", 0, + true, }, { "max", R"json({"key":"18446744073709551615"})json", std::numeric_limits::max(), + true, }, { "out_of_range", R"json({"key":"18446744073709551616"})json", absl::nullopt, + false, }, }; for (const auto& test_case : kTestCases) { base::Value value = base::test::ParseJson(test_case.json); - EXPECT_EQ(ParseUint64(value.GetDict(), "key"), test_case.expected) + absl::optional out; + EXPECT_EQ(ParseUint64(value.GetDict(), "key", out), + test_case.expected_return) << test_case.description; + EXPECT_EQ(out, test_case.expected_out) << test_case.description; } } @@ -92,44 +102,54 @@ TEST(AttributionReportingParsingUtilsTest, ParseInt64) { const struct { const char* description; const char* json; - absl::optional expected; + absl::optional expected_out; + bool expected_return; } kTestCases[] = { { "missing_key", R"json({})json", absl::nullopt, + true, }, { "not_string", R"json({"key":123})json", absl::nullopt, + false, }, { "zero", R"json({"key":"0"})json", 0, + true, }, { "min", R"json({"key":"-9223372036854775808"})json", std::numeric_limits::min(), + true, }, { "max", R"json({"key":"9223372036854775807"})json", std::numeric_limits::max(), + true, }, { "out_of_range", R"json({"key":"9223372036854775808"})json", absl::nullopt, + false, }, }; for (const auto& test_case : kTestCases) { base::Value value = base::test::ParseJson(test_case.json); - EXPECT_EQ(ParseInt64(value.GetDict(), "key"), test_case.expected) + absl::optional out; + EXPECT_EQ(ParseInt64(value.GetDict(), "key", out), + test_case.expected_return) << test_case.description; + EXPECT_EQ(out, test_case.expected_out) << test_case.description; } } diff --git a/components/attribution_reporting/source_registration.cc b/components/attribution_reporting/source_registration.cc index 0b86c79970995..88810ceacc000 100644 --- a/components/attribution_reporting/source_registration.cc +++ b/components/attribution_reporting/source_registration.cc @@ -40,12 +40,18 @@ constexpr char kExpiry[] = "expiry"; constexpr char kFilterData[] = "filter_data"; constexpr char kSourceEventId[] = "source_event_id"; -absl::optional ParseTimeDeltaInSeconds( +[[nodiscard]] bool ParseTimeDeltaInSeconds( const base::Value::Dict& registration, - base::StringPiece key) { - if (absl::optional seconds = ParseInt64(registration, key)) - return base::Seconds(*seconds); - return absl::nullopt; + base::StringPiece key, + absl::optional& out) { + absl::optional value; + if (ParseInt64(registration, key, value)) { + out = value ? absl::make_optional(base::Seconds(*value)) : absl::nullopt; + return true; + } else { + out = absl::nullopt; + return false; + } } void SerializeTimeDeltaInSeconds(base::Value::Dict& dict, @@ -59,7 +65,7 @@ void SerializeTimeDeltaInSeconds(base::Value::Dict& dict, } // namespace void RecordSourceRegistrationError(mojom::SourceRegistrationError error) { - base::UmaHistogramEnumeration("Conversions.SourceRegistrationError2", error); + base::UmaHistogramEnumeration("Conversions.SourceRegistrationError3", error); } SourceRegistration::SourceRegistration(mojo::DefaultConstruct::Tag tag) @@ -92,8 +98,9 @@ SourceRegistration::Parse(base::Value::Dict registration) { base::expected filter_data = FilterData::FromJSON(registration.Find(kFilterData)); - if (!filter_data.has_value()) + if (!filter_data.has_value()) { return base::unexpected(filter_data.error()); + } result.filter_data = std::move(*filter_data); base::expected aggregation_keys = @@ -102,18 +109,34 @@ SourceRegistration::Parse(base::Value::Dict registration) { return base::unexpected(aggregation_keys.error()); result.aggregation_keys = std::move(*aggregation_keys); - result.source_event_id = - ParseUint64(registration, kSourceEventId).value_or(0); + absl::optional source_event_id; + if (!ParseUint64(registration, kSourceEventId, source_event_id)) { + return base::unexpected( + SourceRegistrationError::kSourceEventIdValueInvalid); + } + result.source_event_id = source_event_id.value_or(0); - result.priority = ParsePriority(registration); + absl::optional priority; + if (!ParsePriority(registration, priority)) { + return base::unexpected(SourceRegistrationError::kPriorityValueInvalid); + } + result.priority = priority.value_or(0); - result.expiry = ParseTimeDeltaInSeconds(registration, kExpiry); + if (!ParseTimeDeltaInSeconds(registration, kExpiry, result.expiry)) { + return base::unexpected(SourceRegistrationError::kExpiryValueInvalid); + } - result.event_report_window = - ParseTimeDeltaInSeconds(registration, kEventReportWindow); + if (!ParseTimeDeltaInSeconds(registration, kEventReportWindow, + result.event_report_window)) { + return base::unexpected( + SourceRegistrationError::kEventReportWindowValueInvalid); + } - result.aggregatable_report_window = - ParseTimeDeltaInSeconds(registration, kAggregatableReportWindow); + if (!ParseTimeDeltaInSeconds(registration, kAggregatableReportWindow, + result.aggregatable_report_window)) { + return base::unexpected( + SourceRegistrationError::kAggregatableReportWindowValueInvalid); + } result.debug_key = ParseDebugKey(registration); diff --git a/components/attribution_reporting/source_registration_error.mojom b/components/attribution_reporting/source_registration_error.mojom index b5ac82318ead7..4fc44be57d9ca 100644 --- a/components/attribution_reporting/source_registration_error.mojom +++ b/components/attribution_reporting/source_registration_error.mojom @@ -29,4 +29,10 @@ enum SourceRegistrationError { kAggregationKeysKeyTooLong = 15, kAggregationKeysValueWrongType = 16, kAggregationKeysValueWrongFormat = 17, + + kSourceEventIdValueInvalid = 19, + kPriorityValueInvalid = 20, + kExpiryValueInvalid = 21, + kEventReportWindowValueInvalid = 22, + kAggregatableReportWindowValueInvalid = 23, }; diff --git a/components/attribution_reporting/source_registration_unittest.cc b/components/attribution_reporting/source_registration_unittest.cc index 1e07c56782f84..f69070259e94c 100644 --- a/components/attribution_reporting/source_registration_unittest.cc +++ b/components/attribution_reporting/source_registration_unittest.cc @@ -69,12 +69,12 @@ TEST(SourceRegistrationTest, Parse) { { "source_event_id_wrong_type", R"json({"source_event_id":1,"destination":"https://d.example"})json", - SourceRegistration(destination), + base::unexpected(SourceRegistrationError::kSourceEventIdValueInvalid), }, { - "source_event_id_invalid_defaults_to_0", + "source_event_id_invalid", R"json({"source_event_id":"-1","destination":"https://d.example"})json", - SourceRegistration(destination), + base::unexpected(SourceRegistrationError::kSourceEventIdValueInvalid), }, { "destination_missing", @@ -88,14 +88,14 @@ TEST(SourceRegistrationTest, Parse) { destination, [](SourceRegistration& r) { r.priority = -5; }), }, { - "priority_wrong_type_defaults_to_0", + "priority_wrong_type", R"json({"priority":-5,"destination":"https://d.example"})json", - SourceRegistration(destination), + base::unexpected(SourceRegistrationError::kPriorityValueInvalid), }, { - "priority_invalid_defaults_to_0", + "priority_invalid", R"json({"priority":"abc","destination":"https://d.example"})json", - SourceRegistration(destination), + base::unexpected(SourceRegistrationError::kPriorityValueInvalid), }, { "expiry_valid", @@ -107,12 +107,12 @@ TEST(SourceRegistrationTest, Parse) { { "expiry_wrong_type", R"json({"expiry":172800,"destination":"https://d.example"})json", - SourceRegistration(destination), + base::unexpected(SourceRegistrationError::kExpiryValueInvalid), }, { "expiry_invalid", R"json({"expiry":"abc","destination":"https://d.example"})json", - SourceRegistration(destination), + base::unexpected(SourceRegistrationError::kExpiryValueInvalid), }, { "event_report_window_valid", @@ -128,17 +128,15 @@ TEST(SourceRegistrationTest, Parse) { "event_report_window_wrong_type", R"json({"expiry":"172801","event_report_window":86401, "destination":"https://d.example"})json", - SourceRegistrationWith( - destination, - [](SourceRegistration& r) { r.expiry = base::Seconds(172801); }), + base::unexpected( + SourceRegistrationError::kEventReportWindowValueInvalid), }, { "event_report_window_invalid", R"json({"expiry":"172801","event_report_window":"abc", "destination":"https://d.example"})json", - SourceRegistrationWith( - destination, - [](SourceRegistration& r) { r.expiry = base::Seconds(172801); }), + base::unexpected( + SourceRegistrationError::kEventReportWindowValueInvalid), }, { "aggregatable_report_window_valid", @@ -155,17 +153,15 @@ TEST(SourceRegistrationTest, Parse) { "aggregatable_report_window_wrong_type", R"json({"expiry":"172801","aggregatable_report_window":86401, "destination":"https://d.example"})json", - SourceRegistrationWith( - destination, - [](SourceRegistration& r) { r.expiry = base::Seconds(172801); }), + base::unexpected( + SourceRegistrationError::kAggregatableReportWindowValueInvalid), }, { "aggregatable_report_window_invalid", R"json({"expiry":"172801","aggregatable_report_window":"abc", "destination":"https://d.example"})json", - SourceRegistrationWith( - destination, - [](SourceRegistration& r) { r.expiry = base::Seconds(172801); }), + base::unexpected( + SourceRegistrationError::kAggregatableReportWindowValueInvalid), }, { "debug_key_valid", @@ -227,7 +223,7 @@ TEST(SourceRegistrationTest, Parse) { }; static constexpr char kSourceRegistrationErrorMetric[] = - "Conversions.SourceRegistrationError2"; + "Conversions.SourceRegistrationError3"; for (const auto& test_case : kTestCases) { base::HistogramTester histograms; diff --git a/components/attribution_reporting/trigger_registration.cc b/components/attribution_reporting/trigger_registration.cc index d78bc3042af8c..04d5b3ed61075 100644 --- a/components/attribution_reporting/trigger_registration.cc +++ b/components/attribution_reporting/trigger_registration.cc @@ -237,7 +237,7 @@ TriggerRegistration::Parse(base::StringPiece json) { } if (!trigger.has_value()) { - base::UmaHistogramEnumeration("Conversions.TriggerRegistrationError5", + base::UmaHistogramEnumeration("Conversions.TriggerRegistrationError6", trigger.error()); } diff --git a/components/attribution_reporting/trigger_registration_error.mojom b/components/attribution_reporting/trigger_registration_error.mojom index 61bb5efbc670b..3aa82d62894a4 100644 --- a/components/attribution_reporting/trigger_registration_error.mojom +++ b/components/attribution_reporting/trigger_registration_error.mojom @@ -31,14 +31,19 @@ enum TriggerRegistrationError { kAggregatableTriggerDataSourceKeysKeyTooLong = 23, kEventTriggerDataListWrongType = 24, + kEventTriggerDataValueInvalid = 25, kEventTriggerDataWrongType = 26, - kAggregationCoordinatorWrongType = 27, - kAggregationCoordinatorUnknownValue = 28, + kEventPriorityValueInvalid = 27, + kEventDedupKeyValueInvalid = 28, - kAggregatableDedupKeyListWrongType = 29, - kAggregatableDedupKeyWrongType = 31, + kAggregationCoordinatorWrongType = 29, + kAggregationCoordinatorUnknownValue = 30, - kAggregatableSourceRegistrationTimeWrongType = 32, - kAggregatableSourceRegistrationTimeUnknownValue = 33, + kAggregatableDedupKeyListWrongType = 31, + kAggregatableDedupKeyValueInvalid = 32, + kAggregatableDedupKeyWrongType = 33, + + kAggregatableSourceRegistrationTimeWrongType = 34, + kAggregatableSourceRegistrationTimeUnknownValue = 35, }; diff --git a/components/attribution_reporting/trigger_registration_unittest.cc b/components/attribution_reporting/trigger_registration_unittest.cc index 6b8f25d20a7eb..c466e306cf62b 100644 --- a/components/attribution_reporting/trigger_registration_unittest.cc +++ b/components/attribution_reporting/trigger_registration_unittest.cc @@ -127,6 +127,32 @@ TEST(TriggerRegistrationTest, Parse) { base::unexpected( TriggerRegistrationError::kEventTriggerDataWrongType), }, + { + "event_triggers_data_invalid", + R"json({"event_trigger_data":[{"trigger_data":5}]})json", + base::unexpected( + TriggerRegistrationError::kEventTriggerDataValueInvalid), + }, + { + "event_triggers_priority_invalid", + R"json({"event_trigger_data": [ + { + "priority":0 + } + ]})json", + base::unexpected( + TriggerRegistrationError::kEventPriorityValueInvalid), + }, + { + "event_triggers_dedup_keys_invalid", + R"json({"event_trigger_data": [ + { + "deduplication_key": 1 + } + ]})json", + base::unexpected( + TriggerRegistrationError::kEventDedupKeyValueInvalid), + }, { "aggregatable_trigger_data_valid", R"json({ @@ -213,6 +239,15 @@ TEST(TriggerRegistrationTest, Parse) { base::unexpected( TriggerRegistrationError::kAggregatableDedupKeyWrongType), }, + { + "aggregatable_dedup_key_invalid", + R"json({"aggregatable_deduplication_keys":[ + {}, + {"deduplication_key":5} + ]})json", + base::unexpected( + TriggerRegistrationError::kAggregatableDedupKeyValueInvalid), + }, { "aggregatable_source_registration_time_include", R"json({"aggregatable_source_registration_time":"include"})json", @@ -244,7 +279,7 @@ TEST(TriggerRegistrationTest, Parse) { }; static constexpr char kTriggerRegistrationErrorMetric[] = - "Conversions.TriggerRegistrationError5"; + "Conversions.TriggerRegistrationError6"; for (const auto& test_case : kTestCases) { base::HistogramTester histograms; @@ -336,7 +371,7 @@ TEST(TriggerRegistrationTest, ParseAggregationCoordinator) { }; static constexpr char kTriggerRegistrationErrorMetric[] = - "Conversions.TriggerRegistrationError5"; + "Conversions.TriggerRegistrationError6"; base::test::ScopedFeatureList scoped_feature_list( aggregation_service::kAggregationServiceMultipleCloudProviders); diff --git a/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc b/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc index 0dba19ea16f17..f0eca7a853ebe 100644 --- a/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc +++ b/content/browser/attribution_reporting/attribution_data_host_manager_impl_unittest.cc @@ -1436,7 +1436,7 @@ TEST_F(AttributionDataHostManagerImplTest, // Wait for parsing to finish. task_environment_.FastForwardBy(base::TimeDelta()); - histograms.ExpectUniqueSample("Conversions.SourceRegistrationError2", + histograms.ExpectUniqueSample("Conversions.SourceRegistrationError3", SourceRegistrationError::kInvalidJson, 1); } diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index daeaff81fdab5..8b4d47c4f45df 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml @@ -19868,6 +19868,11 @@ Called by update_net_error_codes.py.--> + + + + + @@ -19948,13 +19953,17 @@ Called by update_net_error_codes.py.--> + - - - - - - + + + + + + + + diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index 9e269d461911c..ffec301e4aa51 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml @@ -4073,10 +4073,10 @@ chromium-metrics-reviews@google.com. - + tquintanilla@chromium.org linnan@chromium.org - johnidel@chromium.org measurement-api-dev+metrics@google.com Measures how often source registration parsing failed and why. Recorded only @@ -4162,10 +4162,10 @@ chromium-metrics-reviews@google.com. - + tquintanilla@chromium.org linnan@chromium.org - johnidel@chromium.org measurement-api-dev+metrics@google.com Measures how often trigger registration parsing failed and why. Recorded