Update measurement interop tests
Also made some system health params testable.
Bug: 269814656
Test: atest E2EInteropMockTest
Change-Id: I0065bd5d4cabed4c32f75956fe0551404d76a46c
diff --git a/adservices/service-core/java/com/android/adservices/service/measurement/AsyncRegistrationQueueRunner.java b/adservices/service-core/java/com/android/adservices/service/measurement/AsyncRegistrationQueueRunner.java
index b8a19a3..8e979fc 100644
--- a/adservices/service-core/java/com/android/adservices/service/measurement/AsyncRegistrationQueueRunner.java
+++ b/adservices/service-core/java/com/android/adservices/service/measurement/AsyncRegistrationQueueRunner.java
@@ -369,10 +369,10 @@
return false;
}
- if (numOfSourcesPerPublisher >= SystemHealthParams.MAX_SOURCES_PER_PUBLISHER) {
+ if (numOfSourcesPerPublisher >= SystemHealthParams.getMaxSourcesPerPublisher()) {
LogUtil.d(
"insertSources: Max limit of %s sources for publisher - %s reached.",
- SystemHealthParams.MAX_SOURCES_PER_PUBLISHER, publisher);
+ SystemHealthParams.getMaxSourcesPerPublisher(), publisher);
return false;
}
if (source.getAppDestinations() != null) {
diff --git a/adservices/service-core/java/com/android/adservices/service/measurement/SystemHealthParams.java b/adservices/service-core/java/com/android/adservices/service/measurement/SystemHealthParams.java
index d079dcf..6d0e800 100644
--- a/adservices/service-core/java/com/android/adservices/service/measurement/SystemHealthParams.java
+++ b/adservices/service-core/java/com/android/adservices/service/measurement/SystemHealthParams.java
@@ -31,7 +31,11 @@
public static final long MAX_TRIGGER_REGISTERS_PER_DESTINATION = 1024L;
/** Max number of sources per publisher. */
- public static final long MAX_SOURCES_PER_PUBLISHER = 1024L;
+ private static final int MAX_SOURCES_PER_PUBLISHER = 1024;
+
+ public static int getMaxSourcesPerPublisher() {
+ return MAX_SOURCES_PER_PUBLISHER;
+ }
/** Max number of redirects per registration. */
public static final int MAX_REDIRECTS_PER_REGISTRATION = 5;
@@ -45,10 +49,18 @@
public static final int MAX_ATTRIBUTIONS_PER_INVOCATION = 100;
/** Max number of aggregate reports in storage per destination */
- public static final long MAX_AGGREGATE_REPORTS_PER_DESTINATION = 1024;
+ private static final int MAX_AGGREGATE_REPORTS_PER_DESTINATION = 1024;
+
+ public static int getMaxAggregateReportsPerDestination() {
+ return MAX_AGGREGATE_REPORTS_PER_DESTINATION;
+ }
/** Max number of event reports in storage per destination */
- public static final long MAX_EVENT_REPORTS_PER_DESTINATION = 1024;
+ private static final int MAX_EVENT_REPORTS_PER_DESTINATION = 1024;
+
+ public static int getMaxEventReportsPerDestination() {
+ return MAX_EVENT_REPORTS_PER_DESTINATION;
+ }
/**
* Maximum event report upload retry window.
diff --git a/adservices/service-core/java/com/android/adservices/service/measurement/attribution/AttributionJobHandler.java b/adservices/service-core/java/com/android/adservices/service/measurement/attribution/AttributionJobHandler.java
index 80bccec..ba7101d 100644
--- a/adservices/service-core/java/com/android/adservices/service/measurement/attribution/AttributionJobHandler.java
+++ b/adservices/service-core/java/com/android/adservices/service/measurement/attribution/AttributionJobHandler.java
@@ -172,14 +172,14 @@
measurementDao.getNumAggregateReportsPerDestination(
trigger.getAttributionDestination(), trigger.getDestinationType());
- if (numReports >= SystemHealthParams.MAX_AGGREGATE_REPORTS_PER_DESTINATION) {
+ if (numReports >= SystemHealthParams.getMaxAggregateReportsPerDestination()) {
LogUtil.d(
String.format(
Locale.ENGLISH,
"Aggregate reports for destination %1$s exceeds system health limit of"
+ " %2$d.",
trigger.getAttributionDestination(),
- SystemHealthParams.MAX_AGGREGATE_REPORTS_PER_DESTINATION));
+ SystemHealthParams.getMaxAggregateReportsPerDestination()));
return false;
}
@@ -389,14 +389,14 @@
measurementDao.getNumEventReportsPerDestination(
trigger.getAttributionDestination(), trigger.getDestinationType());
- if (numReports >= SystemHealthParams.MAX_EVENT_REPORTS_PER_DESTINATION) {
+ if (numReports >= SystemHealthParams.getMaxEventReportsPerDestination()) {
LogUtil.d(
String.format(
Locale.ENGLISH,
"Event reports for destination %1$s exceeds system health limit of"
+ " %2$d.",
trigger.getAttributionDestination(),
- SystemHealthParams.MAX_EVENT_REPORTS_PER_DESTINATION));
+ SystemHealthParams.getMaxEventReportsPerDestination()));
return false;
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_budget.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_budget.json
index aa47080..5504fd2 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_budget.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_budget.json
@@ -18,7 +18,9 @@
"aggregation_keys": {
"a": "0x159",
"b": "0x5"
- }
+ },
+ // Will be cleared as debug_permission is not set.
+ "source_debug_key": "12345"
}
}
}]
@@ -33,14 +35,16 @@
},
"responses": [{
"url": "https://reporter.test/register-source",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Source": {
"destination": "https://destination.test",
- "source_event_id": "123",
+ "source_event_id": "456",
"aggregation_keys": {
"a": "0x159",
"b": "0x5"
- }
+ },
+ "debug_key": "54321"
}
}
}]
@@ -56,6 +60,7 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
"aggregatable_trigger_data": [
@@ -71,7 +76,9 @@
"aggregatable_values": {
"a": 65530,
"b": 7
- }
+ },
+ "debug_key": "6789",
+ "debug_reporting": true
}
}
}]
@@ -101,7 +108,8 @@
}
}]
},
- // Should be dropped due to insufficient aggregatable budget.
+ // Should be dropped due to insufficient aggregatable budget and verbose
+ // debug report is not created as debug_permission is not set.
{
"timestamp": "1643235576000",
"registration_request": {
@@ -120,7 +128,8 @@
],
"aggregatable_values": {
"a": 2
- }
+ },
+ "debug_reporting": true
}
}
}]
@@ -174,6 +183,33 @@
}
}
}]
+ },
+ // Should not result in an aggregatable report due to insufficient
+ // aggregatable budget.
+ {
+ "timestamp": "1643235585000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["b"],
+ "key_piece": "0xa81"
+ }
+ ],
+ "aggregatable_values": {
+ "b": 1
+ },
+ "debug_reporting": true
+ }
+ }
+ }]
}
]
},
@@ -213,11 +249,42 @@
"key": "0xa85",
"value": 65536
}
- ]
+ ],
+ "source_debug_key": "54321"
},
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution",
"report_time": "1643239184000"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "limit": "65536",
+ "source_event_id": "123",
+ "source_site": "https://source.test",
+ "trigger_debug_key": "6789"
+ },
+ "type": "trigger-aggregate-insufficient-budget"
+ } ],
+ "report_time": "1643235574000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ },
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "limit": "65536",
+ "source_debug_key": "54321",
+ "source_event_id": "456",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-aggregate-insufficient-budget"
+ } ],
+ "report_time": "1643235585000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_contributions_creation.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_contributions_creation.json
index 04d2024..cce2ec7 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_contributions_creation.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_contributions_creation.json
@@ -172,6 +172,47 @@
}
}
}]
+ },
+ // Should not result in an aggregatable report due to no contributions.
+ {
+ "timestamp": "1643235577000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "aggregatable_values": {
+ "d": 987
+ },
+ "debug_reporting": true
+ }
+ }
+ }]
+ },
+ // Should not result in an aggregatable report due to no contributions
+ // and verbose debug report is not created as debug_reporting is not set.
+ {
+ "timestamp": "1643235578000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "aggregatable_trigger_data": [{
+ "source_keys": ["a"],
+ "key_piece": "0x1"
+ }]
+ }
+ }
+ }]
}
]
},
@@ -228,6 +269,20 @@
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution",
"report_time": "1643239176000"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "source_event_id": "123",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-aggregate-no-contributions"
+ } ],
+ "report_time": "1643235577000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_report_window.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_report_window.json
index e1d47e0..fd8c432 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_report_window.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_report_window.json
@@ -93,6 +93,7 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
"event_trigger_data": [
@@ -108,7 +109,8 @@
],
"aggregatable_values": {
"a": 789
- }
+ },
+ "debug_reporting": true
}
}
}]
@@ -181,6 +183,20 @@
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution",
"report_time": "1643325573000"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "source_event_id": "123",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-aggregate-report-window-passed"
+ } ],
+ "report_time": "1643321974000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_storage_limit.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_storage_limit.json
new file mode 100644
index 0000000..ce2fba3
--- /dev/null
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/aggregatable_storage_limit.json
@@ -0,0 +1,241 @@
+{
+ "description": "Aggregatable report not created due to storage limit",
+ "api_config": {
+ "max_aggregatable_reports_per_destination": "1"
+ },
+ "input": {
+ "sources": [
+ {
+ "timestamp": "1643235573000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://destination.test",
+ "source_event_id": "111",
+ "aggregation_keys": {
+ "a": "0x1"
+ }
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643235574000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://another-reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://another-reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://destination.test",
+ "source_event_id": "222",
+ "aggregation_keys": {
+ "a": "0x2"
+ }
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643235575000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://another-destination.test",
+ "source_event_id": "333",
+ "aggregation_keys": {
+ "a": "0x3"
+ }
+ }
+ }
+ }]
+ }
+ ],
+ "triggers": [
+ {
+ "timestamp": "1643235576000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "1"
+ }
+ ],
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["a"],
+ "key_piece": "0x10"
+ }
+ ],
+ "aggregatable_values": {
+ "a": 111
+ }
+ }
+ }
+ }]
+ },
+ // Should not result in an aggregatable report due to storage limit
+ // regardless of reporting origin.
+ {
+ "timestamp": "1643235577000",
+ "registration_request": {
+ "attribution_src_url": "https://another-reporter.test/register-trigger",
+ "destination_origin": "https://example.destination.test"
+ },
+ "responses": [{
+ "url": "https://another-reporter.test/register-trigger",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
+ "event_trigger_data": [
+ {
+ "trigger_data": "2"
+ }
+ ],
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["a"],
+ "key_piece": "0x20"
+ }
+ ],
+ "aggregatable_values": {
+ "a": 222
+ }
+ }
+ }
+ }]
+ },
+ // Should result in an aggregatable report as the destination site is
+ // different.
+ {
+ "timestamp": "1643235578000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://another-destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "3"
+ }
+ ],
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["a"],
+ "key_piece": "0x30"
+ }
+ ],
+ "aggregatable_values": {
+ "a": 333
+ }
+ }
+ }
+ }]
+ }
+ ]
+ },
+ "output": {
+ "event_level_results": [
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411973",
+ "source_event_id": "111",
+ "source_type": "navigation",
+ "trigger_data": "1"
+ },
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
+ "report_time": "1643411973000"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411974",
+ "source_event_id": "222",
+ "source_type": "navigation",
+ "trigger_data": "2"
+ },
+ "report_time": "1643411974000",
+ "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-event-attribution"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://another-destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411975",
+ "source_event_id": "333",
+ "source_type": "navigation",
+ "trigger_data": "3"
+ },
+ "report_time": "1643411975000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
+ }
+ ],
+ "aggregatable_results": [
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "histograms": [ {
+ "key": "0x11",
+ "value": 111
+ } ]
+ },
+ "report_time": "1643239176000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://another-destination.test",
+ "histograms": [ {
+ "key": "0x33",
+ "value": 333
+ } ]
+ },
+ "report_time": "1643239178000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
+ }
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "limit": "1",
+ "source_event_id": "222",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-aggregate-storage-limit"
+ } ],
+ "report_time": "1643235577000",
+ "report_url": "https://another-reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
+ ]
+ }
+}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/dedup_key.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/dedup_key.json
index 43b5844..577ea3b 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/dedup_key.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/dedup_key.json
@@ -29,8 +29,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "1",
@@ -49,8 +51,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "2",
@@ -69,8 +73,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "3",
@@ -80,6 +86,27 @@
}
}
}]
+ },
+ // Deduplicated as well after the report was sent.
+ {
+ "timestamp": "1643411974000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "4",
+ "deduplication_key": "1"
+ }
+ ]
+ }
+ }
+ }]
}
]
},
@@ -92,23 +119,37 @@
"scheduled_report_time": "1643411973",
"source_event_id": "123",
"source_type": "navigation",
- "trigger_data": "1"
+ "trigger_data": "3"
},
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
"report_time": "1643411973000"
},
{
"payload": {
- "attribution_destination": "https://destination.test",
"randomized_trigger_rate": 0.0024,
+ "attribution_destination": "https://destination.test",
"scheduled_report_time": "1643411973",
"source_event_id": "123",
"source_type": "navigation",
- "trigger_data": "3"
+ "trigger_data": "1"
},
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
"report_time": "1643411973000"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "source_event_id": "123",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-event-deduplicated"
+ } ],
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose",
+ "report_time": "1643235575000"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/destination_limit.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/destination_limit.json
index e8f49e6..f6720ba 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/destination_limit.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/destination_limit.json
@@ -8,7 +8,7 @@
{
"timestamp": "1643235573000",
"registration_request": {
- "source_origin": "https://source1.test",
+ "source_origin": "https://example.source1.test",
"attribution_src_url": "https://reporter1.test/register-source",
"source_type": "navigation"
},
@@ -16,7 +16,8 @@
"url": "https://reporter1.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
- "destination": "https://destination1.test",
+ "debug_reporting": true,
+ "destination": "https://example.destination1.test",
"source_event_id": "111",
"expiry": "86400"
}
@@ -35,8 +36,33 @@
"url": "https://reporter1.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
+ "debug_reporting": true,
"destination": "https://destination2.test",
- "source_event_id": "222"
+ "source_event_id": "222",
+ "debug_key": "12345"
+ }
+ }
+ }]
+ },
+ // Should be dropped due to destination limit regardless of source type.
+ // source_debug_key is included in the verbose debug report as
+ // debug_permission is set.
+ {
+ "timestamp": "1643235575001",
+ "registration_request": {
+ "source_origin": "https://source1.test",
+ "attribution_src_url": "https://reporter1.test/register-source",
+ "source_type": "event"
+ },
+ "responses": [{
+ "url": "https://reporter1.test/register-source",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "debug_reporting": true,
+ "destination": "https://destination2.test",
+ "source_event_id": "123",
+ "debug_key": "54321"
}
}
}]
@@ -53,6 +79,7 @@
"url": "https://reporter2.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
+ "debug_reporting": true,
"destination": "https://destination2.test",
"source_event_id": "333"
}
@@ -71,12 +98,31 @@
"url": "https://reporter1.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
+ "debug_reporting": true,
"destination": "https://destination2.test",
"source_event_id": "444"
}
}
}]
},
+ // Should be registered as the destination site is the same as previous one.
+ {
+ "timestamp": "1643235581000",
+ "registration_request": {
+ "source_origin": "https://source2.test",
+ "attribution_src_url": "https://reporter1.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://reporter1.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://example.destination2.test",
+ "source_event_id": "666"
+ }
+ }
+ }]
+ },
// Should be registered as the first source has expired.
{
"timestamp": "1643321973000",
@@ -89,6 +135,7 @@
"url": "https://reporter1.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
+ "debug_reporting": true,
"destination": "https://destination3.test",
"source_event_id": "555"
}
@@ -179,6 +226,26 @@
},
// Should result in an event-level report.
{
+ "timestamp": "1643235582000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter1.test/register-trigger",
+ "destination_origin": "https://destination2.test"
+ },
+ "responses": [{
+ "url": "https://reporter1.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "6"
+ }
+ ]
+ }
+ }
+ }]
+ },
+ // Should result in an event-level report.
+ {
"timestamp": "1643321974000",
"registration_request": {
"attribution_src_url": "https://reporter1.test/register-trigger",
@@ -239,6 +306,18 @@
},
{
"payload": {
+ "attribution_destination": "https://destination2.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411981",
+ "source_event_id": "666",
+ "source_type": "navigation",
+ "trigger_data": "6"
+ },
+ "report_time": "1643411981000",
+ "report_url": "https://reporter1.test/.well-known/attribution-reporting/report-event-attribution"
+ },
+ {
+ "payload": {
"attribution_destination": "https://destination3.test",
"randomized_trigger_rate": 0.0024,
"scheduled_report_time": "1643498373",
@@ -249,6 +328,35 @@
"report_time": "1643498373000",
"report_url": "https://reporter1.test/.well-known/attribution-reporting/report-event-attribution"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [{
+ "body": {
+ "attribution_destination": "https://destination2.test",
+ "limit": "1",
+ "source_event_id": "222",
+ "source_site": "https://source1.test"
+ },
+ "type": "source-destination-limit"
+ }],
+ "report_time": "1643235575000",
+ "report_url": "https://reporter1.test/.well-known/attribution-reporting/debug/verbose"
+ },
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination2.test",
+ "limit": "1",
+ "source_debug_key": "54321",
+ "source_event_id": "123",
+ "source_site": "https://source1.test"
+ },
+ "type": "source-destination-limit"
+ } ],
+ "report_time": "1643235575001",
+ "report_url": "https://reporter1.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_storage_limit.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_storage_limit.json
new file mode 100644
index 0000000..5fd079f
--- /dev/null
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_storage_limit.json
@@ -0,0 +1,240 @@
+{
+ "description": "Event-level report not created due to storage limit",
+ "api_config": {
+ "max_event_level_reports_per_destination": "1"
+ },
+ "input": {
+ "sources": [
+ {
+ "timestamp": "1643235573000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://destination.test",
+ "source_event_id": "111",
+ "aggregation_keys": {
+ "a": "0x1"
+ }
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643235574000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://another-reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://another-reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://destination.test",
+ "source_event_id": "222",
+ "aggregation_keys": {
+ "a": "0x2"
+ }
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643235575000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://another-destination.test",
+ "source_event_id": "333",
+ "aggregation_keys": {
+ "a": "0x3"
+ }
+ }
+ }
+ }]
+ }
+ ],
+ "triggers": [
+ {
+ "timestamp": "1643235576000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "1"
+ }
+ ],
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["a"],
+ "key_piece": "0x10"
+ }
+ ],
+ "aggregatable_values": {
+ "a": 111
+ }
+ }
+ }
+ }]
+ },
+ // Should not result in an event-level report due to storage limit
+ // regardless of reporting origin.
+ {
+ "timestamp": "1643235577000",
+ "registration_request": {
+ "attribution_src_url": "https://another-reporter.test/register-trigger",
+ "destination_origin": "https://example.destination.test"
+ },
+ "responses": [{
+ "url": "https://another-reporter.test/register-trigger",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
+ "event_trigger_data": [
+ {
+ "trigger_data": "2"
+ }
+ ],
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["a"],
+ "key_piece": "0x20"
+ }
+ ],
+ "aggregatable_values": {
+ "a": 222
+ }
+ }
+ }
+ }]
+ },
+ // Should result in an event-level report as the destination site is
+ // different.
+ {
+ "timestamp": "1643235578000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://another-destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "3"
+ }
+ ],
+ "aggregatable_trigger_data": [
+ {
+ "source_keys": ["a"],
+ "key_piece": "0x30"
+ }
+ ],
+ "aggregatable_values": {
+ "a": 333
+ }
+ }
+ }
+ }]
+ }
+ ]
+ },
+ "output": {
+ "event_level_results": [
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411973",
+ "source_event_id": "111",
+ "source_type": "navigation",
+ "trigger_data": "1"
+ },
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
+ "report_time": "1643411973000"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://another-destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411975",
+ "source_event_id": "333",
+ "source_type": "navigation",
+ "trigger_data": "3"
+ },
+ "report_time": "1643411975000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
+ }
+ ],
+ "aggregatable_results": [
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "histograms": [ {
+ "key": "0x11",
+ "value": 111
+ } ]
+ },
+ "report_time": "1643239176000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "histograms": [ {
+ "key": "0x22",
+ "value": 222
+ } ]
+ },
+ "report_time": "1643239177000",
+ "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://another-destination.test",
+ "histograms": [ {
+ "key": "0x33",
+ "value": 333
+ } ]
+ },
+ "report_time": "1643239178000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
+ }
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "limit": "1",
+ "source_event_id": "222",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-event-storage-limit"
+ } ],
+ "report_time": "1643235577000",
+ "report_url": "https://another-reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
+ ]
+ }
+}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_filter_data.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_filter_data.json
index 4584639..2595972 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_filter_data.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_filter_data.json
@@ -24,7 +24,7 @@
}]
},
{
- "timestamp": "1643235573000",
+ "timestamp": "1643235573001",
"registration_request": {
"source_origin": "https://source.test",
"attribution_src_url": "https://reporter.test/register-source",
@@ -190,6 +190,8 @@
}
}]
},
+ // Should not result in an event-level report as there's no matching
+ // configuration.
{
"timestamp": "1643235577000",
"registration_request": {
@@ -198,6 +200,30 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
+ "event_trigger_data": [
+ {
+ "trigger_data": "0",
+ "filters": {
+ "source_type": ["navigation"]
+ }
+ }
+ ]
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643235578000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://another-destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
"response": {
"Attribution-Reporting-Register-Trigger": {
"event_trigger_data": [
@@ -268,7 +294,21 @@
"trigger_data": "1"
},
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1645831173000"
+ "report_time": "1645831173001"
+ }
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://another-destination.test",
+ "source_event_id": "456",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-event-no-matching-configurations"
+ } ],
+ "report_time": "1643235577000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
}
]
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_priority.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_priority.json
index 30d79af..50d2a8d 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_priority.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_level_trigger_priority.json
@@ -21,6 +21,7 @@
}
],
"triggers": [
+ // Will result in an event-level report.
{
"timestamp": "1643235574000",
"registration_request": {
@@ -41,6 +42,7 @@
}
}]
},
+ // Will result in an event-level report but be replaced later.
{
"timestamp": "1643235575000",
"registration_request": {
@@ -61,6 +63,7 @@
}
}]
},
+ // Will result in an event-level report but be replaced later.
{
"timestamp": "1643235576000",
"registration_request": {
@@ -81,6 +84,7 @@
}
}]
},
+ // Will not result in an event-level report as the priority is not higher.
{
"timestamp": "1643235577000",
"registration_request": {
@@ -89,8 +93,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "4",
@@ -101,6 +107,7 @@
}
}]
},
+ // Will replace the third event-level report as its trigger time is latest.
{
"timestamp": "1643235578000",
"registration_request": {
@@ -121,6 +128,8 @@
}
}]
},
+ // Will replace the second event-level report as its trigger time is latest
+ // among the lowest priority reports.
{
"timestamp": "1643404774000",
"registration_request": {
@@ -141,6 +150,8 @@
}
}]
},
+ // Will not result in an event-level report as it's in a different report
+ // window.
{
"timestamp": "1643408374000",
"registration_request": {
@@ -150,8 +161,10 @@
"responses": [
{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "7",
@@ -203,6 +216,38 @@
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
"report_time": "1643411973000"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643411973",
+ "source_event_id": "123",
+ "source_type": "navigation",
+ "trigger_data": "4"
+ },
+ "type": "trigger-event-low-priority"
+ } ],
+ "report_time": "1643235577000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ },
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643843973",
+ "source_event_id": "123",
+ "source_type": "navigation",
+ "trigger_data": "7"
+ },
+ "type": "trigger-event-excessive-reports"
+ } ],
+ "report_time": "1643408374000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_report_window.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_report_window.json
index c192c47..6d0cb0c 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_report_window.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/event_report_window.json
@@ -93,8 +93,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "3"
@@ -166,18 +168,32 @@
},
"report_time": "1643325573000",
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
- },
- {
- "payload": {
+ },
+ {
+ "payload": {
"attribution_destination": "https://destination.test",
"histograms": [ {
"key": "0x559",
"value": 789
} ]
- },
- "report_time": "1643325574000",
- "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
- }
+ },
+ "report_time": "1643325574000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-aggregate-attribution"
+ }
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "source_event_id": "123",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-event-report-window-passed"
+ } ],
+ "report_time": "1643321974000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/expired_source.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/expired_source.json
index 716b30e..b2fa852 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/expired_source.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/expired_source.json
@@ -15,13 +15,93 @@
"Attribution-Reporting-Register-Source": {
"destination": "https://destination.test",
"source_event_id": "123",
- "expiry": "86400"
+ // Clamped to one day (86400 seconds).
+ "expiry": "86390"
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643321974000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://reporter.test/register-source",
+ "source_type": "event"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://destination.test",
+ "source_event_id": "456",
+ // Rounded to one day (86400 seconds).
+ "expiry": "88400"
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643321974001",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://reporter.test/register-source",
+ "source_type": "event"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://another-destination.test",
+ "source_event_id": "654",
+ // Rounded to two days (172800 seconds).
+ "expiry": "172600"
+ }
+ }
+ }]
+ },
+ {
+ "timestamp": "1643321975000",
+ "registration_request": {
+ "source_origin": "https://source.test",
+ "attribution_src_url": "https://another-reporter.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://another-reporter.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
+ "destination": "https://destination.test",
+ "source_event_id": "789",
+ "expiry": "88400"
}
}
}]
}
],
"triggers": [
+ // Should result in an event-level report as the expiry time was clamped
+ // to one day.
+ {
+ "timestamp": "1643321963000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "0"
+ }
+ ]
+ }
+ }
+ }]
+ },
+ // Should not result in an event-level report as the source expired at
+ // one day.
{
"timestamp": "1643321973000",
"registration_request": {
@@ -40,8 +120,109 @@
}
}
}]
+ },
+ // Should not result in an event-level report as the expiry time was
+ // rounded to one day.
+ {
+ "timestamp": "1643408374000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "6"
+ }
+ ]
+ }
+ }
+ }]
+ },
+ // Should result in an event-level report as the expiry time was not rounded.
+ {
+ "timestamp": "1643410374999",
+ "registration_request": {
+ "attribution_src_url": "https://another-reporter.test/register-trigger",
+ "destination_origin": "https://destination.test"
+ },
+ "responses": [{
+ "url": "https://another-reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "5"
+ }
+ ]
+ }
+ }
+ }]
+ },
+ // Should result in an event-level report as the expiry time was rounded
+ // to two days.
+ {
+ "timestamp": "1643494774000",
+ "registration_request": {
+ "attribution_src_url": "https://reporter.test/register-trigger",
+ "destination_origin": "https://another-destination.test"
+ },
+ "responses": [{
+ "url": "https://reporter.test/register-trigger",
+ "response": {
+ "Attribution-Reporting-Register-Trigger": {
+ "event_trigger_data": [
+ {
+ "trigger_data": "1"
+ }
+ ]
+ }
+ }
+ }]
}
]
},
- "output": {}
+ "output": {
+ "event_level_results": [
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643325573",
+ "source_event_id": "123",
+ "source_type": "navigation",
+ "trigger_data": "0"
+ },
+ "report_time": "1643325573000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://destination.test",
+ "randomized_trigger_rate": 0.0024,
+ "scheduled_report_time": "1643413975",
+ "source_event_id": "789",
+ "source_type": "navigation",
+ "trigger_data": "5"
+ },
+ "report_time": "1643413975000",
+ "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-event-attribution"
+ },
+ {
+ "payload": {
+ "attribution_destination": "https://another-destination.test",
+ "randomized_trigger_rate": 0.0000025,
+ "scheduled_report_time": "1643498374",
+ "source_event_id": "654",
+ "source_type": "event",
+ "trigger_data": "1"
+ },
+ "report_time": "1643498374001",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
+ }
+ ]
+ }
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_attribution_reporting_endpoints.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_attribution_reporting_endpoints.json
deleted file mode 100644
index e8959c5..0000000
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_attribution_reporting_endpoints.json
+++ /dev/null
@@ -1,227 +0,0 @@
-{
- "description": "Max attribution reporting endpoints per rate-limit window",
- "api_config": {
- "rate_limit_max_attribution_reporting_origins": "1"
- },
- "input": {
- "sources": [
- {
- "timestamp": "1643235573000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "111"
- }
- }
- }]
- },
- {
- "timestamp": "1643235575000",
- "registration_request": {
- "source_origin": "https://another-source.test",
- "attribution_src_url": "https://another-reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "222"
- }
- }
- }]
- },
- {
- "timestamp": "1643235577000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://another-reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://another-destination.test",
- "source_event_id": "333"
- }
- }
- }]
- },
- {
- "timestamp": "1643235579000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://another-reporter.test/register-source",
- "source_type": "event"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "444"
- }
- }
- }]
- }
- ],
- "triggers": [
- {
- "timestamp": "1643235574000",
- "registration_request": {
- "attribution_src_url": "https://reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "7"
- }
- ]
- }
- }
- }]
- },
- {
- "timestamp": "1643235576000",
- "registration_request": {
- "attribution_src_url": "https://another-reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "6"
- }
- ]
- }
- }
- }]
- },
- {
- "timestamp": "1643235578000",
- "registration_request": {
- "attribution_src_url": "https://another-reporter.test/register-trigger",
- "destination_origin": "https://another-destination.test"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "5"
- }
- ]
- }
- }
- }]
- },
- {
- "timestamp": "1643235580000",
- "registration_request": {
- "attribution_src_url": "https://another-reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "4"
- }
- ]
- }
- }
- }]
- },
- {
- "timestamp": "1645827574000",
- "registration_request": {
- "attribution_src_url": "https://another-reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "3"
- }
- ]
- }
- }
- }]
- }
- ]
- },
- "output": {
- "event_level_results": [
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411973",
- "source_event_id": "111",
- "source_type": "navigation",
- "trigger_data": "7"
- },
- "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411973000"
- },
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411975",
- "source_event_id": "222",
- "source_type": "navigation",
- "trigger_data": "6"
- },
- "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411975000"
- },
- {
- "payload": {
- "attribution_destination": "https://another-destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411977",
- "source_event_id": "333",
- "source_type": "navigation",
- "trigger_data": "5"
- },
- "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411977000"
- },
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0000025,
- "scheduled_report_time": "1645831179",
- "source_event_id": "444",
- "source_type": "event",
- "trigger_data": "1"
- },
- "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1645831179000"
- }
- ]
- }
-}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_attributions.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_attributions.json
deleted file mode 100644
index 570ee05..0000000
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_attributions.json
+++ /dev/null
@@ -1,289 +0,0 @@
-{
- "description": "Max attributions per rate-limit window",
- "api_config": {
- "rate_limit_max_attributions": "1"
- },
- "input": {
- "sources": [
- {
- "timestamp": "1643235573000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "123",
- "expiry": "86400"
- }
- }
- }]
- },
- // Should be preferred over the first source as it's more recent.
- {
- "timestamp": "1643235575000",
- "registration_request": {
- "source_origin": "https://another-source.test",
- "attribution_src_url": "https://reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "123"
- }
- }
- }]
- },
- {
- "timestamp": "1643235577000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://another-destination.test",
- "source_event_id": "123"
- }
- }
- }]
- },
- {
- "timestamp": "1643235579000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://another-reporter.test/register-source",
- "source_type": "navigation"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "123"
- }
- }
- }]
- },
- // Should be preferred over the second source as it's more recent.
- {
- "timestamp": "1643235581000",
- "registration_request": {
- "source_origin": "https://source.test",
- "attribution_src_url": "https://reporter.test/register-source",
- "source_type": "event"
- },
- "responses": [{
- "url": "https://reporter.test/register-source",
- "response": {
- "Attribution-Reporting-Register-Source": {
- "destination": "https://destination.test",
- "source_event_id": "123"
- }
- }
- }]
- }
- ],
- "triggers": [
- // Should result in an event-level report because the attribution limit
- // is not reached.
- {
- "timestamp": "1643235574000",
- "registration_request": {
- "attribution_src_url": "https://reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "1"
- }
- ]
- }
- }
- }]
- },
- // Should result in an event-level report because the attribution limit
- // is separate for a different source site.
- {
- "timestamp": "1643235576000",
- "registration_request": {
- "attribution_src_url": "https://reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "2"
- }
- ]
- }
- }
- }]
- },
- // Should result in an event-level report because the attribution limit
- // is separate for a different destination site.
- {
- "timestamp": "1643235578000",
- "registration_request": {
- "attribution_src_url": "https://reporter.test/register-trigger",
- "destination_origin": "https://another-destination.test"
- },
- "responses": [{
- "url": "https://reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "3"
- }
- ]
- }
- }
- }]
- },
- // Should result in an event-level report because the attribution limit
- // is separate for a different reporting origin.
- {
- "timestamp": "1643235580000",
- "registration_request": {
- "attribution_src_url": "https://another-reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://another-reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "4"
- }
- ]
- }
- }
- }]
- },
- // Should be dropped due to attribution limit that ignores source type.
- {
- "timestamp": "1643235582000",
- "registration_request": {
- "attribution_src_url": "https://reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "5"
- }
- ]
- }
- }
- }]
- },
- // Should result in an event-level report because the first report falls
- // outside the rate limit window.
- {
- "timestamp": "1645827574000",
- "registration_request": {
- "attribution_src_url": "https://reporter.test/register-trigger",
- "destination_origin": "https://destination.test"
- },
- "responses": [{
- "url": "https://reporter.test/register-trigger",
- "response": {
- "Attribution-Reporting-Register-Trigger": {
- "event_trigger_data": [
- {
- "trigger_data": "6"
- }
- ]
- }
- }
- }]
- }
- ]
- },
- "output": {
- "event_level_results": [
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643325573",
- "source_event_id": "123",
- "source_type": "navigation",
- "trigger_data": "1"
- },
- "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643325573000"
- },
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411975",
- "source_event_id": "123",
- "source_type": "navigation",
- "trigger_data": "2"
- },
- "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411975000"
- },
- {
- "payload": {
- "attribution_destination": "https://another-destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411977",
- "source_event_id": "123",
- "source_type": "navigation",
- "trigger_data": "3"
- },
- "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411977000"
- },
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411979",
- "source_event_id": "123",
- "source_type": "navigation",
- "trigger_data": "4"
- },
- "report_url": "https://another-reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411979000"
- },
- {
- "payload": {
- "attribution_destination": "https://destination.test",
- "randomized_trigger_rate": 0.0000025,
- "scheduled_report_time": "1645831181",
- "source_event_id": "123",
- "source_type": "event",
- "trigger_data": "0"
- },
- "report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1645831181000"
- }
- ]
- }
-}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_source_registration_reporting_origin_endpoints.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_source_registration_reporting_origin_endpoints.json
index b787475..f3cfc25 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_source_registration_reporting_origin_endpoints.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/rate_limit_max_source_registration_reporting_origin_endpoints.json
@@ -8,7 +8,7 @@
{
"timestamp": "1643235573000",
"registration_request": {
- "source_origin": "https://source1.test",
+ "source_origin": "https://example.source1.test",
"attribution_src_url": "https://reporter1.test/register-source",
"source_type": "navigation"
},
@@ -16,12 +16,13 @@
"url": "https://reporter1.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
- "destination": "https://destination1.test",
+ "destination": "https://example.destination1.test",
"source_event_id": "111"
}
}
}]
},
+ // Should be registered as the source site is different.
{
"timestamp": "1643235574000",
"registration_request": {
@@ -39,6 +40,7 @@
}
}]
},
+ // Should be dropped due to the unattributed reporting origin limit.
{
"timestamp": "1643235575000",
"registration_request": {
@@ -50,14 +52,33 @@
"url": "https://reporter2.test/register-source",
"response": {
"Attribution-Reporting-Register-Source": {
+ "destination": "https://destination1.test",
+ "source_event_id": "999"
+ }
+ }
+ }]
+ },
+ // Should be registered as the destination site is different.
+ {
+ "timestamp": "1643235576000",
+ "registration_request": {
+ "source_origin": "https://source1.test",
+ "attribution_src_url": "https://reporter2.test/register-source",
+ "source_type": "navigation"
+ },
+ "responses": [{
+ "url": "https://reporter2.test/register-source",
+ "response": {
+ "Attribution-Reporting-Register-Source": {
"destination": "https://destination2.test",
"source_event_id": "333"
}
}
}]
},
+ // Should be dropped due to the unattributed reporting origin limit.
{
- "timestamp": "1643235576000",
+ "timestamp": "1643235577000",
"registration_request": {
"source_origin": "https://source1.test",
"attribution_src_url": "https://reporter3.test/register-source",
@@ -73,6 +94,7 @@
}
}]
},
+ // Should be registered as the first source is outside the rate limit window.
{
"timestamp": "1645827573000",
"registration_request": {
@@ -92,6 +114,7 @@
}
],
"triggers": [
+ // Should result in an event-level report.
{
"timestamp": "1643235583000",
"registration_request": {
@@ -111,6 +134,7 @@
}
}]
},
+ // Should result in an event-level report.
{
"timestamp": "1643235584000",
"registration_request": {
@@ -130,6 +154,7 @@
}
}]
},
+ // Should result in an event-level report.
{
"timestamp": "1643235585000",
"registration_request": {
@@ -149,8 +174,9 @@
}
}]
},
+ // Should not result in an event-level report due to no matching source.
{
- "timestamp": "1643235585000",
+ "timestamp": "1643235585001",
"registration_request": {
"attribution_src_url": "https://reporter3.test/register-trigger",
"destination_origin": "https://destination1.test"
@@ -168,6 +194,7 @@
}
}]
},
+ // Should result in an event-level report.
{
"timestamp": "1645827574000",
"registration_request": {
@@ -219,13 +246,13 @@
"payload": {
"attribution_destination": "https://destination2.test",
"randomized_trigger_rate": 0.0024,
- "scheduled_report_time": "1643411975",
+ "scheduled_report_time": "1643411976",
"source_event_id": "333",
"source_type": "navigation",
"trigger_data": "5"
},
"report_url": "https://reporter2.test/.well-known/attribution-reporting/report-event-attribution",
- "report_time": "1643411975000"
+ "report_time": "1643411976000"
},
{
"payload": {
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/same_destination_site.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/same_destination_site.json
index 8b2ed23..b074063 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/same_destination_site.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/same_destination_site.json
@@ -48,8 +48,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "6"
@@ -75,6 +77,18 @@
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution",
"report_time": "1643411973000"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://another-destination.test"
+ },
+ "type": "trigger-no-matching-source"
+ } ],
+ "report_time": "1643235575000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/top_level_filter_data.json b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/top_level_filter_data.json
index c8fe7e2..b240dfb 100644
--- a/adservices/tests/unittest/service-core/assets/msmt_interop_tests/top_level_filter_data.json
+++ b/adservices/tests/unittest/service-core/assets/msmt_interop_tests/top_level_filter_data.json
@@ -24,7 +24,7 @@
}]
},
{
- "timestamp": "1643235573000",
+ "timestamp": "1643235573001",
"registration_request": {
"source_origin": "https://source.test",
"attribution_src_url": "https://reporter.test/register-source",
@@ -50,8 +50,10 @@
},
"responses": [{
"url": "https://reporter.test/register-trigger",
+ "debug_permission": true,
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "1"
@@ -75,6 +77,7 @@
"url": "https://reporter.test/register-trigger",
"response": {
"Attribution-Reporting-Register-Trigger": {
+ "debug_reporting": true,
"event_trigger_data": [
{
"trigger_data": "2"
@@ -160,7 +163,7 @@
}]
},
{
- "timestamp": "1643235578000",
+ "timestamp": "1643235578001",
"registration_request": {
"attribution_src_url": "https://reporter.test/register-trigger",
"destination_origin": "https://destination.test"
@@ -235,7 +238,7 @@
}]
},
{
- "timestamp": "1643235580000",
+ "timestamp": "1643235580001",
"registration_request": {
"attribution_src_url": "https://reporter.test/register-trigger",
"destination_origin": "https://destination.test"
@@ -352,9 +355,23 @@
"source_type": "event",
"trigger_data": "1"
},
- "report_time": "1645831173000",
+ "report_time": "1645831173001",
"report_url": "https://reporter.test/.well-known/attribution-reporting/report-event-attribution"
}
+ ],
+ "verbose_debug_reports": [
+ {
+ "payload": [ {
+ "body": {
+ "attribution_destination": "https://destination.test",
+ "source_event_id": "123",
+ "source_site": "https://source.test"
+ },
+ "type": "trigger-no-matching-filter-data"
+ } ],
+ "report_time": "1643235574000",
+ "report_url": "https://reporter.test/.well-known/attribution-reporting/debug/verbose"
+ }
]
}
}
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/AsyncRegistrationQueueRunnerTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/AsyncRegistrationQueueRunnerTest.java
index 8b20528..77eaa3d 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/AsyncRegistrationQueueRunnerTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/AsyncRegistrationQueueRunnerTest.java
@@ -1560,7 +1560,7 @@
mDebugReportApi));
// Execution
- doReturn(SystemHealthParams.MAX_SOURCES_PER_PUBLISHER)
+ doReturn((long) SystemHealthParams.getMaxSourcesPerPublisher())
.when(mMeasurementDao)
.getNumSourcesPerPublisher(any(), anyInt());
boolean status =
@@ -1704,7 +1704,7 @@
mEnrollmentDao,
new FakeDatastoreManager(),
mDebugReportApi));
- doReturn(SystemHealthParams.MAX_SOURCES_PER_PUBLISHER)
+ doReturn((long) SystemHealthParams.getMaxSourcesPerPublisher())
.when(mMeasurementDao)
.getNumSourcesPerPublisher(any(), anyInt());
@@ -1735,7 +1735,7 @@
new FakeDatastoreManager(),
mDebugReportApi));
- doReturn(SystemHealthParams.MAX_SOURCES_PER_PUBLISHER)
+ doReturn((long) SystemHealthParams.getMaxSourcesPerPublisher())
.when(mMeasurementDao)
.getNumSourcesPerPublisher(any(), anyInt());
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EDenoisedMockTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EDenoisedMockTest.java
index 89b6dda..71908cf 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EDenoisedMockTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EDenoisedMockTest.java
@@ -41,8 +41,8 @@
}
public E2EDenoisedMockTest(Collection<Action> actions, ReportObjects expectedOutput,
- PrivacyParamsProvider privacyParamsProvider, String name) throws DatastoreException {
- super(actions, expectedOutput, privacyParamsProvider, name);
+ ParamsProvider paramsProvider, String name) throws DatastoreException {
+ super(actions, expectedOutput, paramsProvider, name);
mAttributionHelper = TestObjectProvider.getAttributionJobHandler(sDatastoreManager, mFlags);
mMeasurementImpl =
TestObjectProvider.getMeasurementImpl(
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EImpressionNoiseMockTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EImpressionNoiseMockTest.java
index 883704b..79f3b07 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EImpressionNoiseMockTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EImpressionNoiseMockTest.java
@@ -60,8 +60,8 @@
}
public E2EImpressionNoiseMockTest(Collection<Action> actions, ReportObjects expectedOutput,
- PrivacyParamsProvider privacyParamsProvider, String name) throws DatastoreException {
- super(actions, expectedOutput, privacyParamsProvider, name);
+ ParamsProvider paramsProvider, String name) throws DatastoreException {
+ super(actions, expectedOutput, paramsProvider, name);
mAttributionHelper = TestObjectProvider.getAttributionJobHandler(sDatastoreManager, mFlags);
mMeasurementImpl =
TestObjectProvider.getMeasurementImpl(
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EInteropMockTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EInteropMockTest.java
index 0029a42..872a0c1 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EInteropMockTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EInteropMockTest.java
@@ -44,9 +44,9 @@
* End-to-end test from source and trigger registration to attribution reporting, using mocked HTTP
* requests.
*
- * Tests in assets/msmt_interop_tests/ directory were copied from
- * https://github.com/chromium/chromium/tree/main/content/test/data/attribution_reporting/interop
- * commit 8ff1e4f84ea36f339d440252ab36559263cf540c
+ * Tests in assets/msmt_interop_tests/ directory were copied from Chromium
+ * src/content/test/data/attribution_reporting/interop
+ * Friday February 17, 2023
*/
@RunWith(Parameterized.class)
public class E2EInteropMockTest extends E2EMockTest {
@@ -69,8 +69,8 @@
}
public E2EInteropMockTest(Collection<Action> actions, ReportObjects expectedOutput,
- PrivacyParamsProvider privacyParamsProvider, String name) throws DatastoreException {
- super(actions, expectedOutput, privacyParamsProvider, name);
+ ParamsProvider paramsProvider, String name) throws DatastoreException {
+ super(actions, expectedOutput, paramsProvider, name);
mAttributionHelper = TestObjectProvider.getAttributionJobHandler(sDatastoreManager, mFlags);
mMeasurementImpl =
TestObjectProvider.getMeasurementImpl(
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockStatic.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockStatic.java
index 372558b..ee4d26a 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockStatic.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockStatic.java
@@ -30,10 +30,10 @@
*/
public final class E2EMockStatic implements StaticMockFixture {
- private final E2ETest.PrivacyParamsProvider mPrivacyParams;
+ private final E2ETest.ParamsProvider mParams;
- public E2EMockStatic(E2ETest.PrivacyParamsProvider privacyParamsProvider) {
- mPrivacyParams = privacyParamsProvider;
+ public E2EMockStatic(E2ETest.ParamsProvider paramsProvider) {
+ mParams = paramsProvider;
}
/**
* {@inheritDoc}
@@ -42,6 +42,7 @@
public StaticMockitoSessionBuilder setUpMockedClasses(
StaticMockitoSessionBuilder sessionBuilder) {
sessionBuilder.spyStatic(PrivacyParams.class);
+ sessionBuilder.spyStatic(SystemHealthParams.class);
return sessionBuilder;
}
@@ -50,24 +51,35 @@
*/
@Override
public void setUpMockBehaviors() {
+ // Privacy params
doAnswer((Answer<Integer>) invocation ->
- mPrivacyParams.getMaxAttributionPerRateLimitWindow())
+ mParams.getMaxAttributionPerRateLimitWindow())
.when(() -> PrivacyParams.getMaxAttributionPerRateLimitWindow());
doAnswer((Answer<Integer>) invocation ->
- mPrivacyParams.getNavigationTriggerDataCardinality())
+ mParams.getNavigationTriggerDataCardinality())
.when(() -> PrivacyParams.getNavigationTriggerDataCardinality());
doAnswer((Answer<Integer>) invocation ->
- mPrivacyParams.getMaxDistinctEnrollmentsPerPublisherXDestinationInAttribution())
+ mParams.getMaxDistinctEnrollmentsPerPublisherXDestinationInAttribution())
.when(() -> PrivacyParams
.getMaxDistinctEnrollmentsPerPublisherXDestinationInAttribution());
doAnswer((Answer<Integer>) invocation ->
- mPrivacyParams.getMaxDistinctDestinationsPerPublisherXEnrollmentInActiveSource())
+ mParams.getMaxDistinctDestinationsPerPublisherXEnrollmentInActiveSource())
.when(() -> PrivacyParams
.getMaxDistinctDestinationsPerPublisherXEnrollmentInActiveSource());
doAnswer((Answer<Integer>) invocation ->
- mPrivacyParams.getMaxDistinctEnrollmentsPerPublisherXDestinationInSource())
+ mParams.getMaxDistinctEnrollmentsPerPublisherXDestinationInSource())
.when(() -> PrivacyParams
.getMaxDistinctEnrollmentsPerPublisherXDestinationInSource());
+ // System health params
+ doAnswer((Answer<Integer>) invocation ->
+ mParams.getMaxSourcesPerPublisher())
+ .when(() -> SystemHealthParams.getMaxSourcesPerPublisher());
+ doAnswer((Answer<Integer>) invocation ->
+ mParams.getMaxEventReportsPerDestination())
+ .when(() -> SystemHealthParams.getMaxEventReportsPerDestination());
+ doAnswer((Answer<Integer>) invocation ->
+ mParams.getMaxAggregateReportsPerDestination())
+ .when(() -> SystemHealthParams.getMaxAggregateReportsPerDestination());
}
/**
@@ -77,8 +89,8 @@
public void tearDown() { }
public static class E2EMockStaticRule extends StaticMockFixtureRule {
- public E2EMockStaticRule(E2ETest.PrivacyParamsProvider privacyParamsProvider) {
- super(TestableDeviceConfig::new, () -> new E2EMockStatic(privacyParamsProvider));
+ public E2EMockStaticRule(E2ETest.ParamsProvider paramsProvider) {
+ super(TestableDeviceConfig::new, () -> new E2EMockStatic(paramsProvider));
}
}
}
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockTest.java
index d223a9f..53e52fe 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EMockTest.java
@@ -126,12 +126,12 @@
E2EMockTest(
Collection<Action> actions,
ReportObjects expectedOutput,
- PrivacyParamsProvider privacyParamsProvider,
+ ParamsProvider paramsProvider,
String name) {
super(actions, expectedOutput, name);
mClickVerifier = mock(ClickVerifier.class);
mFlags = mock(Flags.class);
- mE2EMockStaticRule = new E2EMockStatic.E2EMockStaticRule(privacyParamsProvider);
+ mE2EMockStaticRule = new E2EMockStatic.E2EMockStaticRule(paramsProvider);
mMeasurementDataDeleter = spy(new MeasurementDataDeleter(sDatastoreManager));
mAsyncSourceFetcher =
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2ETest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2ETest.java
index c625849..f29e05a 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2ETest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2ETest.java
@@ -173,6 +173,7 @@
}
private interface ApiConfigKeys {
+ // Privacy params
String RATE_LIMIT_MAX_ATTRIBUTIONS = "rate_limit_max_attributions";
String NAVIGATION_SOURCE_TRIGGER_DATA_CARDINALITY =
"navigation_source_trigger_data_cardinality";
@@ -182,16 +183,28 @@
"max_destinations_per_source_site_reporting_origin";
String RATE_LIMIT_MAX_SOURCE_REGISTRATION_REPORTING_ORIGINS =
"rate_limit_max_source_registration_reporting_origins";
+ // System health params
+ String MAX_SOURCES_PER_ORIGIN = "max_sources_per_origin";
+ String MAX_EVENT_LEVEL_REPORTS_PER_DESTINATION =
+ "max_event_level_reports_per_destination";
+ String MAX_AGGREGATABLE_REPORTS_PER_DESTINATION =
+ "max_aggregatable_reports_per_destination";
}
- public static class PrivacyParamsProvider {
+ public static class ParamsProvider {
+ // Privacy params
private Integer mMaxAttributionPerRateLimitWindow;
private Integer mNavigationTriggerDataCardinality;
private Integer mMaxDistinctEnrollmentsPerPublisherXDestinationInAttribution;
private Integer mMaxDistinctDestinationsPerPublisherXEnrollmentInActiveSource;
private Integer mMaxDistinctEnrollmentsPerPublisherXDestinationInSource;
+ // System health params
+ private Integer mMaxSourcesPerPublisher;
+ private Integer mMaxEventReportsPerDestination;
+ private Integer mMaxAggregateReportsPerDestination;
- public PrivacyParamsProvider(JSONObject json) throws JSONException {
+ public ParamsProvider(JSONObject json) throws JSONException {
+ // Privacy params
if (!json.isNull(ApiConfigKeys.RATE_LIMIT_MAX_ATTRIBUTIONS)) {
mMaxAttributionPerRateLimitWindow = json.getInt(
ApiConfigKeys.RATE_LIMIT_MAX_ATTRIBUTIONS);
@@ -233,8 +246,29 @@
PrivacyParams
.getMaxDistinctEnrollmentsPerPublisherXDestinationInSource();
}
+ // System health params
+ if (!json.isNull(ApiConfigKeys.MAX_SOURCES_PER_ORIGIN)) {
+ mMaxSourcesPerPublisher = json.getInt(ApiConfigKeys.MAX_SOURCES_PER_ORIGIN);
+ } else {
+ mMaxSourcesPerPublisher = SystemHealthParams.getMaxSourcesPerPublisher();
+ }
+ if (!json.isNull(ApiConfigKeys.MAX_EVENT_LEVEL_REPORTS_PER_DESTINATION)) {
+ mMaxEventReportsPerDestination = json.getInt(
+ ApiConfigKeys.MAX_EVENT_LEVEL_REPORTS_PER_DESTINATION);
+ } else {
+ mMaxEventReportsPerDestination =
+ SystemHealthParams.getMaxEventReportsPerDestination();
+ }
+ if (!json.isNull(ApiConfigKeys.MAX_AGGREGATABLE_REPORTS_PER_DESTINATION)) {
+ mMaxAggregateReportsPerDestination = json.getInt(
+ ApiConfigKeys.MAX_AGGREGATABLE_REPORTS_PER_DESTINATION);
+ } else {
+ mMaxAggregateReportsPerDestination =
+ SystemHealthParams.getMaxAggregateReportsPerDestination();
+ }
}
+ // Privacy params
public Integer getMaxAttributionPerRateLimitWindow() {
return mMaxAttributionPerRateLimitWindow;
}
@@ -254,6 +288,19 @@
public Integer getMaxDistinctEnrollmentsPerPublisherXDestinationInSource() {
return mMaxDistinctEnrollmentsPerPublisherXDestinationInSource;
}
+
+ // System health params
+ public Integer getMaxSourcesPerPublisher() {
+ return mMaxSourcesPerPublisher;
+ }
+
+ public Integer getMaxEventReportsPerDestination() {
+ return mMaxEventReportsPerDestination;
+ }
+
+ public Integer getMaxAggregateReportsPerDestination() {
+ return mMaxAggregateReportsPerDestination;
+ }
}
static Collection<Object[]> data(String testDirName, Function<String, String> preprocessor)
@@ -832,7 +879,7 @@
*
* @return A collection of Object arrays, each with
* {@code [Collection<Object> actions, ReportObjects expectedOutput,
- * PrivacyParamsProvider privacyParamsProvider, String name]}
+ * ParamsProvider paramsProvider, String name]}
*/
private static Collection<Object[]> getTestCasesFrom(List<InputStream> inputStreams,
String[] filenames, Function<String, String> preprocessor)
@@ -867,9 +914,9 @@
? new JSONObject()
: testObj.getJSONObject(TestFormatJsonMapping.API_CONFIG_KEY);
- PrivacyParamsProvider privacyParamsProvider = new PrivacyParamsProvider(ApiConfigObj);
+ ParamsProvider paramsProvider = new ParamsProvider(ApiConfigObj);
- testCases.add(new Object[] {actions, expectedOutput, privacyParamsProvider, name});
+ testCases.add(new Object[] {actions, expectedOutput, paramsProvider, name});
}
return testCases;