summaryrefslogtreecommitdiff
path: root/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement
diff options
context:
space:
mode:
Diffstat (limited to 'adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement')
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/E2EInteropMockTest.java13
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/EventReportTest.java33
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/SourceTest.java22
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerIntegrationTest.java2
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerTest.java23
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerAttributionProbabilityTest.java335
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerTest.java67
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueJobServiceTest.java38
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueRunnerTest.java705
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncSourceFetcherTest.java1129
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncTriggerFetcherTest.java1149
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/EnqueueAsyncRegistrationTest.java34
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/AggregateReportingJobHandlerTest.java159
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/DebugReportApiTest.java194
-rw-r--r--adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportWindowCalcDelegateTest.java573
15 files changed, 2697 insertions, 1779 deletions
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 0e5544e830..74f8761d6d 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
@@ -21,7 +21,6 @@ import static java.util.Map.entry;
import android.adservices.measurement.RegistrationRequest;
import android.net.Uri;
import android.os.RemoteException;
-import android.provider.DeviceConfig;
import com.android.adservices.service.measurement.actions.Action;
import com.android.adservices.service.measurement.actions.RegisterSource;
@@ -35,7 +34,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Assert;
-import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -160,17 +158,6 @@ public class E2EInteropMockTest extends E2EMockTest {
mFlags);
}
- @Before
- public void setup() {
- // Chromium does not have a flag at dynamic noising based on expiry but Android does, so it
- // needs to be enabled.
- DeviceConfig.setProperty(
- DeviceConfig.NAMESPACE_ADSERVICES,
- "measurement_enable_configurable_event_reporting_windows",
- "true",
- false);
- }
-
@Override
void processAction(RegisterSource sourceRegistration) throws JSONException, IOException {
RegistrationRequest request = sourceRegistration.mRegistrationRequest;
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/EventReportTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/EventReportTest.java
index f0be0f6766..ca528c9a38 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/EventReportTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/EventReportTest.java
@@ -15,11 +15,7 @@
*/
package com.android.adservices.service.measurement;
-import static com.android.adservices.service.Flags.MEASUREMENT_EVENT_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY;
import static com.android.adservices.service.Flags.MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS;
-import static com.android.adservices.service.Flags.MEASUREMENT_NAVIGATION_NOISE_PROBABILITY;
import static com.android.adservices.service.measurement.PrivacyParams.INSTALL_ATTR_NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS;
import static com.android.adservices.service.measurement.PrivacyParams.NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS;
import static com.android.adservices.service.measurement.SourceFixture.ValidSourceParams;
@@ -67,6 +63,11 @@ public final class EventReportTest {
public final TestableDeviceConfig.TestableDeviceConfigRule mDeviceConfigRule =
new TestableDeviceConfig.TestableDeviceConfigRule();
+ private static final double EVENT_NOISE_PROBABILITY = 0.0000025D;
+ private static final double INSTALL_ATTR_EVENT_NOISE_PROBABILITY = 0.0000125D;
+ private static final double INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY = 0.0024263D;
+ private static final double NAVIGATION_NOISE_PROBABILITY = 0.0024263D;
+
private static final double DOUBLE_MAX_DELTA = 0.0000001D;
private static final long TRIGGER_PRIORITY = 345678L;
@@ -288,7 +289,7 @@ public final class EventReportTest {
assertEquals(source.getEventReportWindow() + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
report.getReportTime());
assertEquals(source.getSourceType(), report.getSourceType());
- assertEquals(MEASUREMENT_EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ assertEquals(EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -297,7 +298,6 @@ public final class EventReportTest {
@Test
public void populate_eventSourceAppDestWithoutInstallConfigured() throws JSONException {
long baseTime = System.currentTimeMillis();
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
String earlyReportingWindows1h1d =
String.join(
",",
@@ -306,7 +306,6 @@ public final class EventReportTest {
doReturn(earlyReportingWindows1h1d)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(true).when(mFlags).getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(3).when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
Source source =
createSourceForTest(
@@ -390,7 +389,7 @@ public final class EventReportTest {
report.getReportTime());
assertEquals(Source.SourceType.NAVIGATION, report.getSourceType());
assertEquals(
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -430,7 +429,7 @@ public final class EventReportTest {
assertEquals(source.getEventReportWindow() + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
report.getReportTime());
assertEquals(Source.SourceType.EVENT, report.getSourceType());
- assertEquals(MEASUREMENT_EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ assertEquals(EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -468,7 +467,7 @@ public final class EventReportTest {
report.getReportTime());
assertEquals(Source.SourceType.EVENT, report.getSourceType());
assertEquals(
- MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY,
+ INSTALL_ATTR_EVENT_NOISE_PROBABILITY,
report.getRandomizedTriggerRate(),
DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
@@ -507,7 +506,7 @@ public final class EventReportTest {
assertEquals(source.getEventReportWindow() + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
report.getReportTime());
assertEquals(Source.SourceType.EVENT, report.getSourceType());
- assertEquals(MEASUREMENT_EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ assertEquals(EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -548,7 +547,7 @@ public final class EventReportTest {
report.getReportTime());
assertEquals(Source.SourceType.NAVIGATION, report.getSourceType());
assertEquals(
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -589,7 +588,7 @@ public final class EventReportTest {
report.getReportTime());
assertEquals(source.getSourceType(), report.getSourceType());
assertEquals(
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -633,7 +632,7 @@ public final class EventReportTest {
report.getReportTime());
assertEquals(Source.SourceType.NAVIGATION, report.getSourceType());
assertEquals(
- MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY,
+ INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY,
report.getRandomizedTriggerRate(),
DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
@@ -679,7 +678,7 @@ public final class EventReportTest {
report.getReportTime());
assertEquals(source.getSourceType(), report.getSourceType());
assertEquals(
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ NAVIGATION_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -698,6 +697,7 @@ public final class EventReportTest {
.setEnrollmentId("enrollment-id")
.setAppDestinations(Collections.singletonList(APP_DESTINATION))
.setWebDestinations(Collections.singletonList(WEB_DESTINATION))
+ .setExpiryTime(baseTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(baseTime + TimeUnit.DAYS.toMillis(10))
.setCoarseEventReportDestinations(true)
.build();
@@ -738,7 +738,7 @@ public final class EventReportTest {
assertEquals(source.getEventReportWindow() + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
report.getReportTime());
assertEquals(Source.SourceType.EVENT, report.getSourceType());
- assertEquals(MEASUREMENT_EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
+ assertEquals(EVENT_NOISE_PROBABILITY, report.getRandomizedTriggerRate(), DOUBLE_MAX_DELTA);
assertEquals(SOURCE_ID, report.getSourceId());
assertEquals(TRIGGER_ID, report.getTriggerId());
assertEquals(REGISTRATION_ORIGIN, report.getRegistrationOrigin());
@@ -855,6 +855,7 @@ public final class EventReportTest {
.setEnrollmentId("enrollment-id")
.setAppDestinations(getNullableUriList(appDestination))
.setWebDestinations(getNullableUriList(webDestination))
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(10))
.build();
}
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/SourceTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/SourceTest.java
index 458efd4f06..f75c65e24a 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/SourceTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/SourceTest.java
@@ -1521,13 +1521,13 @@ public class SourceTest {
}
@Test
- public void getOrDefaultEventReportWindows() throws JSONException {
+ public void getOrDefaultEventReportWindowsForFlex() throws JSONException {
Flags flags = mock(Flags.class);
JSONObject windowsObj = new JSONObject("{'start_time': '2000000', 'end_times': "
+ "[3600000, 86400000, 172000000]}");
// Provided Windows
List<Pair<Long, Long>> eventReportWindows =
- Source.getOrDefaultEventReportWindows(
+ Source.getOrDefaultEventReportWindowsForFlex(
windowsObj,
Source.SourceType.EVENT,
8640000,
@@ -1543,7 +1543,7 @@ public class SourceTest {
when(flags.getMeasurementEventReportsCtcEarlyReportingWindows())
.thenReturn("172800,604800");
eventReportWindows =
- Source.getOrDefaultEventReportWindows(
+ Source.getOrDefaultEventReportWindowsForFlex(
null, Source.SourceType.EVENT, TimeUnit.DAYS.toMillis(15), flags);
assertNotNull(eventReportWindows);
assertEquals(2, eventReportWindows.size());
@@ -1552,7 +1552,7 @@ public class SourceTest {
// Default Windows - Navigation
eventReportWindows =
- Source.getOrDefaultEventReportWindows(
+ Source.getOrDefaultEventReportWindowsForFlex(
null, Source.SourceType.NAVIGATION, TimeUnit.DAYS.toMillis(15), flags);
assertNotNull(eventReportWindows);
assertEquals(3, eventReportWindows.size());
@@ -1608,29 +1608,31 @@ public class SourceTest {
}
@Test
- public void getProcessedEventReportWindow() {
+ public void getEffectiveEventReportWindow() {
+ long expiryTime = 7654321L;
// null eventReportWindow
Source sourceNullEventReportWindow =
SourceFixture.getMinimalValidSourceBuilder()
.setEventTime(10)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(null)
.build();
- assertNull(sourceNullEventReportWindow.getProcessedEventReportWindow());
+ assertEquals(expiryTime, sourceNullEventReportWindow.getEffectiveEventReportWindow());
// eventReportWindow Value < eventTime
Source sourceNewEventReportWindow =
SourceFixture.getMinimalValidSourceBuilder()
- .setEventTime(10)
+ .setEventTime(10L)
.setEventReportWindow(4L)
.build();
- assertEquals(Long.valueOf(14L), sourceNewEventReportWindow.getProcessedEventReportWindow());
+ assertEquals(14L, sourceNewEventReportWindow.getEffectiveEventReportWindow());
// eventReportWindow Value > eventTime
Source sourceOldEventReportWindow =
SourceFixture.getMinimalValidSourceBuilder()
- .setEventTime(10)
+ .setEventTime(10L)
.setEventReportWindow(15L)
.build();
- assertEquals(Long.valueOf(15L), sourceOldEventReportWindow.getProcessedEventReportWindow());
+ assertEquals(15L, sourceOldEventReportWindow.getEffectiveEventReportWindow());
}
}
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerIntegrationTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerIntegrationTest.java
index 6b8e4567a9..39f46f31e3 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerIntegrationTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerIntegrationTest.java
@@ -77,7 +77,7 @@ public class AttributionJobHandlerIntegrationTest extends AbstractDbIntegrationT
(new AttributionJobHandler(
datastoreManager,
FlagsFactory.getFlags(),
- new DebugReportApi(sContext, FlagsFactory.getFlagsForTest()),
+ new DebugReportApi(sContext, FlagsFactory.getFlags()),
new EventReportWindowCalcDelegate(FlagsFactory.getFlags()),
new SourceNoiseHandler(FlagsFactory.getFlags()),
mLogger,
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerTest.java
index b34950e84c..c1cbe2ba85 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/attribution/AttributionJobHandlerTest.java
@@ -218,6 +218,12 @@ public class AttributionJobHandlerTest {
when(mFlags.getMeasurementNullAggReportRateInclSourceRegistrationTime()).thenReturn(0f);
when(mFlags.getMeasurementMinEventReportDelayMillis())
.thenReturn(Flags.MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS);
+ when(mFlags.getMeasurementVtcConfigurableMaxEventReportsCount())
+ .thenReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT);
+ when(mFlags.getMeasurementEventReportsVtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS);
+ when(mFlags.getMeasurementEventReportsCtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS);
}
@Test
@@ -659,7 +665,6 @@ public class AttributionJobHandlerTest {
public void performPendingAttributions_vtcWithConfiguredReportsCount_attributeUptoConfigLimit()
throws DatastoreException {
// Setup
- doReturn(true).when(mFlags).getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(3).when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
Source source =
SourceFixture.getMinimalValidSourceBuilder()
@@ -1385,6 +1390,9 @@ public class AttributionJobHandlerTest {
doReturn(5L)
.when(mEventReportWindowCalcDelegate)
.getReportingTime(any(Source.class), anyLong(), anyInt());
+ doReturn(EventReportWindowCalcDelegate.MomentPlacement.WITHIN)
+ .when(mEventReportWindowCalcDelegate)
+ .fallsWithinWindow(any(Source.class), anyLong(), anyInt());
when(mMeasurementDao.getPendingTriggerIds())
.thenReturn(Collections.singletonList(trigger.getId()));
when(mMeasurementDao.getTrigger(trigger.getId())).thenReturn(trigger);
@@ -1658,6 +1666,7 @@ public class AttributionJobHandlerTest {
.setAttributionMode(Source.AttributionMode.TRUTHFULLY)
.setInstallAttributed(true)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(10))
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(28))
.setEventTime(eventTime - TimeUnit.DAYS.toMillis(2))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
@@ -1737,6 +1746,7 @@ public class AttributionJobHandlerTest {
.setInstallAttributed(true)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(3))
.setEventTime(eventTime - TimeUnit.DAYS.toMillis(2))
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -1747,6 +1757,7 @@ public class AttributionJobHandlerTest {
.setPriority(200L)
.setAttributionMode(Source.AttributionMode.TRUTHFULLY)
.setEventTime(eventTime)
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.build();
when(mMeasurementDao.getPendingTriggerIds())
@@ -3341,6 +3352,7 @@ public class AttributionJobHandlerTest {
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
.setId("sourceId")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -3436,6 +3448,7 @@ public class AttributionJobHandlerTest {
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
.setId("sourceId")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -3533,6 +3546,7 @@ public class AttributionJobHandlerTest {
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
.setId("sourceId")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -3628,6 +3642,7 @@ public class AttributionJobHandlerTest {
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
.setId("sourceId")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -3726,6 +3741,7 @@ public class AttributionJobHandlerTest {
+ "}\n")
.setId("sourceId")
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -3961,6 +3977,7 @@ public class AttributionJobHandlerTest {
+ " \"key_1\": [\"value_1\", \"value_2\"],\n"
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -4039,6 +4056,7 @@ public class AttributionJobHandlerTest {
+ " \"key_1\": [\"value_1\", \"value_2\"],\n"
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -4116,6 +4134,7 @@ public class AttributionJobHandlerTest {
+ " \"key_1\": [\"value_1\", \"value_2\"],\n"
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -4338,6 +4357,7 @@ public class AttributionJobHandlerTest {
+ " \"key_1\": [\"value_1\", \"value_2\"],\n"
+ " \"key_2\": [\"value_1\", \"value_2\"]\n"
+ "}\n")
+ .setExpiryTime(triggerTime + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(triggerTime + 1L)
.setAggregatableReportWindow(triggerTime + 1L)
.build();
@@ -6129,6 +6149,7 @@ public class AttributionJobHandlerTest {
.setId("sourceId")
.setEventTime(TRIGGER_TIME - TimeUnit.SECONDS.toMillis(LOOKBACK_WINDOW - 1))
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(TRIGGER_TIME + TimeUnit.DAYS.toMillis(28))
.setEventReportWindow(TRIGGER_TIME + 1)
.setAggregatableReportWindow(TRIGGER_TIME + 1)
.build();
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerAttributionProbabilityTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerAttributionProbabilityTest.java
index ef24154acd..a9fa269095 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerAttributionProbabilityTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerAttributionProbabilityTest.java
@@ -16,14 +16,6 @@
package com.android.adservices.service.measurement.noising;
-import static com.android.adservices.service.Flags.MEASUREMENT_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_EVENT_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY;
-import static com.android.adservices.service.Flags.MEASUREMENT_NAVIGATION_NOISE_PROBABILITY;
import static com.android.adservices.service.measurement.SourceFixture.ValidSourceParams.ATTRIBUTION_DESTINATIONS;
import static com.android.adservices.service.measurement.SourceFixture.ValidSourceParams.WEB_DESTINATIONS;
@@ -61,18 +53,22 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
private static final String DELIMITER = ",";
private static final long CURRENT_TIME = System.currentTimeMillis();
+ private static final double INSTALL_ATTR_EVENT_NOISE_PROBABILITY = 0.0000125D;
+ private static final double INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY = 0.0024263D;
+ private static final double EVENT_NOISE_PROBABILITY = 0.0000025D;
+ private static final double NAVIGATION_NOISE_PROBABILITY = 0.0024263D;
+ private static final double INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY =
+ 0.0170218D;
+
private final String mDescription;
- private final boolean mIsEnableConfigurableEventReportingWindows;
private final Source mSource;
private final Long[] mEarlyReportingWindows;
private final double mExpectedProbability;
- private final boolean mEnableConfiguredMaxEventReports;
private final int mConfiguredMaxEventReportsCount;
/**
- * The data format is measurement_enable_configurable_event_reporting_windows flag, sourceType,
- * sourceEventReportWindow (limit), cooldown window, appDestination, webDestination
- * configuredEarlyReportingWindows, coarse destination, enable configured conversions,
+ * The data format is sourceType, sourceEventReportWindow (limit), cooldown window,
+ * appDestination, webDestination, configuredEarlyReportingWindows, coarse destination,
* configured conversions and expectedProbability. Each test description has numbers like 1-1-1,
* 2-1-2, 3-3-3 etc. These signify max reports, trigger data bits and reporting windows count
* respectively. For e.g., 2-1-2 stands for 2 maximum conversions, 1 trigger data bit (0 or 1)
@@ -85,7 +81,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
{
"non-configured reporting windows, EVENT, 1-1-1, app, fine "
+ "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -93,15 +88,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configured max reports
1, // configured max reports
- MEASUREMENT_EVENT_NOISE_PROBABILITY, // probability
+ EVENT_NOISE_PROBABILITY, // probability
},
{
"non-configured reporting windows, EVENT, 2-1-2, app, install "
+ "detection, fine "
+ "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -109,14 +102,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configured max reports
1, // configured max reports
- MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY, // probability
+ INSTALL_ATTR_EVENT_NOISE_PROBABILITY, // probability
},
{
"non-configured reporting windows, EVENT, 1-1-1, web, fine "
+ "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -124,14 +115,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configured max reports
1, // configured max reports
- MEASUREMENT_EVENT_NOISE_PROBABILITY, // probability
+ EVENT_NOISE_PROBABILITY, // probability
},
{
"non-configured reporting windows, EVENT, 1-1-1, app and web, "
+ "fine destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -139,155 +128,56 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configured max reports
1, // configured max reports
- MEASUREMENT_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY, // probability
+ 0.0000042, // probability
},
{
- "non-configured reporting windows, EVENT, 2-1-2, app & web, "
+ "non-configured reporting windows, EVENT, 2-1-2, app, "
+ "install "
+ "detection, fine"
+ " destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
ATTRIBUTION_DESTINATIONS, // app destination
- WEB_DESTINATIONS, // app destination
+ null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configured max reports
1, // configured max reports
- MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY,
+ 0.0000125,
},
{
- "non-configured reporting windows, EVENT, 2-1-2, app & web, "
+ "non-configured reporting windows, EVENT, 2-1-1, app, "
+ "install "
- + "detection, coarse"
+ + "detection, fine"
+ " destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
- DAYS.toMillis(10), // source event report window
+ DAYS.toMillis(1), // source event report window
DAYS.toMillis(1), // install cooldown window
ATTRIBUTION_DESTINATIONS, // app destination
- WEB_DESTINATIONS, // app destination
- new Long[] {}, // early reporting windows
- true, // coarse destinations
- false, // enable configurable max reports
- 1, // configured max reports
- MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY,
- },
- {
- "non-configured reporting windows, NAVIGATION, 3-3-3, app, fine "
- + "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
- DAYS.toMillis(10), // source event report window
- 0, // install cooldown window
- ATTRIBUTION_DESTINATIONS, // app destination
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configured max reports
- 3, // configured max reports
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, // probability
+ 1, // configured max reports
+ 0.000005,
},
{
- "non-configured reporting windows, NAVIGATION, 3-3-3, app, install "
- + "detection, fine "
- + "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
+ "non-configured reporting windows, EVENT, 2-1-2, app, "
+ + "install "
+ + "detection, coarse"
+ + " destinations",
+ Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
ATTRIBUTION_DESTINATIONS, // app destination
null, // web destination
new Long[] {}, // early reporting windows
- false, // coarse destinations
- false, // enable configured max reports
- 3, // configured max reports
- MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY, // probability
- },
- {
- "non-configured reporting windows, NAVIGATION, 3-3-3, web, fine "
- + "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
- DAYS.toMillis(10), // source event report window
- 0, // install cooldown window
- null,
- WEB_DESTINATIONS, // web destination
- new Long[] {}, // early reporting windows
- false, // coarse destinations
- false, // enable configurable max reports
- 3, // configured max reports
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, // probability
- },
- {
- "non-configured reporting windows, NAVIGATION, 3-3-3, app & web, "
- + "fine destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
- DAYS.toMillis(10), // source event report window
- 0, // install cooldown window
- ATTRIBUTION_DESTINATIONS, // app destination
- WEB_DESTINATIONS, // web destination
- new Long[] {}, // early reporting windows
- false, // coarse destinations
- false, // enable configurable max reports
- 3, // configured max reports
- MEASUREMENT_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY, // probability
- },
- {
- "non-configured reporting windows, NAVIGATION, 3-3-3, app & web, "
- + "coarse destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
- DAYS.toMillis(10), // source event report window
- 0, // install cooldown window
- ATTRIBUTION_DESTINATIONS, // app destination
- WEB_DESTINATIONS, // web destination
- new Long[] {}, // early reporting windows
true, // coarse destinations
- false, // enable configurable max reports
- 3, // configured max reports
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, // probability
- },
- {
- "non-configured reporting windows, NAVIGATION, 3-3-3, app & web, "
- + "install detection,"
- + " fine destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
- DAYS.toMillis(10), // source event report window
- DAYS.toMillis(1), // install cooldown window
- ATTRIBUTION_DESTINATIONS, // app destination
- WEB_DESTINATIONS, // web destination
- new Long[] {}, // early reporting windows
- false, // coarse destinations
- false, // enable configurable max reports
- 3, // configured max reports
- MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY,
- },
- {
- "non-configured reporting windows, NAVIGATION, 3-3-3, app & web, "
- + "install detection,"
- + " coarse destinations",
- false, // measurement_enable_configurable_event_reporting_windows
- Source.SourceType.NAVIGATION, // source type
- DAYS.toMillis(10), // source event report window
- DAYS.toMillis(1), // install cooldown window
- ATTRIBUTION_DESTINATIONS, // app destination
- WEB_DESTINATIONS, // web destination
- new Long[] {}, // early reporting windows
- true, // coarse destinations
- false, // enable configurable max reports
- 3, // configured max reports
- MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY,
+ 1, // configured max reports
+ INSTALL_ATTR_EVENT_NOISE_PROBABILITY,
},
{
"configured reporting windows, EVENT, 1-1-1, app, fine " + "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -295,13 +185,11 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_EVENT_NOISE_PROBABILITY, // probability
+ EVENT_NOISE_PROBABILITY, // probability
},
{
"configured reporting windows, EVENT, 1-1-2, app, fine " + "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -309,13 +197,11 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1)}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
0.0000042,
},
{
"configured reporting windows, EVENT, 1-1-3, app, fine " + "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -323,7 +209,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
0.0000058, // probability
},
@@ -331,7 +216,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, EVENT, 1-1-2(1 effective window), "
+ "app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -339,15 +223,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {DAYS.toSeconds(15)}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_EVENT_NOISE_PROBABILITY, // probability
+ EVENT_NOISE_PROBABILITY, // probability
},
{
"configured reporting windows, EVENT, 1-1-3(2 effective window), "
+ "app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
HOURS.toMillis(6), // source event report window
0, // install cooldown window
@@ -355,15 +237,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
0.0000042,
},
{
- "configured reporting windows, EVENT, 2-1-3(2 effective windows), "
+ "configured reporting windows, EVENT, 1-1-2 (2 effective window), "
+ "app, install "
+ "detection, fine destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
HOURS.toMillis(6), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -373,15 +253,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY, // probability
+ 0.0000042, // probability
},
{
- "configured reporting windows, EVENT, 2-1-3, app, install "
+ "configured reporting windows, EVENT, 1-1-3, app, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(6), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -391,15 +269,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- 0.0000233, // probability
+ 0.0000058, // probability
},
{
- "configured reporting windows, EVENT, 2-1-3, app & web, install "
+ "configured reporting windows, EVENT, 1-1-3, app & web, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(6), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -409,15 +285,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- 0.0000757, // probability
+ 0.0000108, // probability
},
{
- "configured reporting windows, EVENT, 2-1-3, app & web, install "
+ "configured reporting windows, EVENT, 1-1-3, app & web, install "
+ "detection, coarse "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(6), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -427,16 +301,14 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
true, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- 0.0000233, // probability
+ 0.0000058, // probability
},
{
"configured reporting windows, EVENT, 1-1-1, web, (install "
+ "cooldown -"
+ " unused), fine"
+ " destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -444,21 +316,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_EVENT_NOISE_PROBABILITY, // probability
+ EVENT_NOISE_PROBABILITY, // probability
},
{
- // It is different from "non-configured reporting windows, 2-1-2,
- // app
- // & web, install
- // detection" because we reject 20 states resulting into only 25
- // states in
- // that case. Here we assume all 45 states to be valid.
- "configured reporting windows, EVENT, 2-1-2, app & web, install "
+ "configured reporting windows, EVENT, 1-1-2, app & web, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -466,21 +330,13 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {HOURS.toSeconds(1)}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- 0.0000374, // probability
+ 0.0000075, // probability
},
{
- // It is different from "non-configured reporting windows, 2-1-2,
- // app
- // & web, install
- // detection, coarse destinations" because we reject 20 states
- // resulting into only 25 states in that case. Here we assume all
- // 45 states to be valid.
- "configured reporting windows, EVENT, 2-1-2, app & web, install "
+ "configured reporting windows, EVENT, 1-1-2, app & web, install "
+ "detection, coarse "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -488,14 +344,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {HOURS.toSeconds(1)}, // early reporting windows
true, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- 0.0000125, // probability
+ 0.0000042, // probability
},
{
"configured (ignored due to empty), EVENT, 2-1-2, app, install "
+ "detection, fine destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -503,14 +357,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY, // probability
+ INSTALL_ATTR_EVENT_NOISE_PROBABILITY, // probability
},
{
"configured reporting windows, EVENT, 1-1-1, app & web, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -518,14 +370,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY, // probability
+ 0.0000042, // probability
},
{
"configured reporting windows, EVENT, 1-1-1, app & web, coarse "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -533,14 +383,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
true, // coarse destinations
- false, // enable configurable max reports
1, // configured max reports
- MEASUREMENT_EVENT_NOISE_PROBABILITY, // probability
+ EVENT_NOISE_PROBABILITY, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-1, app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -548,14 +396,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0001372, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-2, app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -563,14 +409,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1)}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0008051, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-3, app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -578,16 +422,14 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, // probability
+ NAVIGATION_NOISE_PROBABILITY, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-2 (1 effective "
+ "window)"
+ ", app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(2), // source event report window
0, // install cooldown window
@@ -595,7 +437,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {DAYS.toMillis(3)}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0001372, // probability
},
@@ -603,7 +444,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, NAVIGATION, 3-3-3 (2 effective "
+ "windows), app, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
HOURS.toMillis(6), // source event report window
0, // install cooldown window
@@ -611,7 +451,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0008051, // probability
},
@@ -619,7 +458,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, NAVIGATION, 3-3-1, app, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -627,7 +465,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0001372, // probability
},
@@ -635,7 +472,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, NAVIGATION, 3-3-1, web, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -643,14 +479,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0001372, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-1, app & web, fine"
+ " destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -658,14 +492,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0008051, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-1, app & web, "
+ "coarse destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -673,7 +505,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
true, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0001372, // probability
},
@@ -682,7 +513,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
+ "install "
+ "detection, "
+ "fine destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -690,7 +520,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0008051, // probability
},
@@ -699,7 +528,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
+ "install "
+ "detection, "
+ "coarse destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -707,7 +535,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // app destination
new Long[] {}, // early reporting windows
true, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
0.0001372, // probability
},
@@ -716,7 +543,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
+ "install "
+ "detection, fine"
+ " destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -724,16 +550,14 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {HOURS.toSeconds(2), DAYS.toSeconds(2)},
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
- MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY,
+ INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY,
},
{
"configured reporting windows, NAVIGATION, 3-3-3, app & web, "
+ "install "
+ "detection, "
+ "coarse destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -741,14 +565,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {HOURS.toSeconds(2), DAYS.toSeconds(2)},
true, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
- MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY,
+ INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY,
},
{
"configured reporting windows, NAVIGATION, 3-3-3, app, install "
+ "detection, fine destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -756,14 +578,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(2), DAYS.toSeconds(2)},
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
- MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY, // probability
+ INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-3, app & web, fine"
+ " destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -771,14 +591,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {HOURS.toSeconds(2), DAYS.toSeconds(2)},
false, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
- MEASUREMENT_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY, // probability
+ 0.0170218, // probability
},
{
"configured reporting windows, NAVIGATION, 3-3-3, app & web, "
+ "coarse destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.NAVIGATION, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -786,14 +604,12 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
WEB_DESTINATIONS, // web destination
new Long[] {HOURS.toSeconds(2), DAYS.toSeconds(2)},
true, // coarse destinations
- false, // enable configurable max reports
3, // configured max reports
- MEASUREMENT_NAVIGATION_NOISE_PROBABILITY, // probability
+ NAVIGATION_NOISE_PROBABILITY, // probability
},
{
"non-configured reporting windows, EVENT, 3-1-1, app, fine "
+ "destinations",
- false, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -801,13 +617,11 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {}, // early reporting windows
false, // coarse destinations
- true, // enable configured max reports
3, // configured max reports
0.0000083, // probability
},
{
"configured reporting windows, EVENT, 3-1-3, app, fine " + "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -815,13 +629,11 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- true, // enable configurable max reports
3, // configured max reports
0.0000698, // probability
},
{
"configured reporting windows, EVENT, 2-1-3, app, fine " + "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -829,7 +641,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- true, // enable configurable max reports
2, // configured max reports
0.0000233, // probability
},
@@ -837,7 +648,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, EVENT, 3-1-3, app, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(6), // source event report window
// not honored because conversions and windows are overridden
@@ -848,7 +658,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
false, // coarse destinations
- true, // enable configurable max reports
3, // configured max reports
0.0000698, // probability
},
@@ -856,7 +665,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, EVENT, 3-1-3, app & web, install "
+ "detection, fine "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(6), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -866,7 +674,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
false, // coarse destinations
- true, // enable configurable max reports
3, // configured max reports
0.0003782, // probability
},
@@ -874,7 +681,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
"configured reporting windows, EVENT, 3-1-3, app & web, install "
+ "detection, coarse "
+ "destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(6), // source event report window
DAYS.toMillis(1), // install cooldown window
@@ -884,13 +690,11 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
HOURS.toSeconds(1), DAYS.toSeconds(1)
}, // early reporting windows
true, // coarse destinations
- true, // enable configurable max reports
3, // configured max reports
0.0000698, // probability
},
{
"configured reporting windows, EVENT, 1-1-3, app, fine" + " destinations",
- true, // measurement_enable_configurable_event_reporting_windows
Source.SourceType.EVENT, // source type
DAYS.toMillis(10), // source event report window
0, // install cooldown window
@@ -898,7 +702,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
null, // web destination
new Long[] {HOURS.toSeconds(1), DAYS.toSeconds(1)},
false, // coarse destinations
- true, // enable configurable max reports
1, // configured max reports
0.0000058, // probability
},
@@ -907,7 +710,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
public SourceNoiseHandlerAttributionProbabilityTest(
String description,
- boolean isEnableConfigurableEventReportingWindows,
Source.SourceType sourceType,
long sourceEventReportWindow,
long coolDownWindow,
@@ -915,11 +717,9 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
List<Uri> webDestinations,
Long[] earlyReportingWindows,
boolean coarseDestination,
- boolean isEnableConfigurableMaxEventReports,
int configuredMaxEventReportsCount,
double expectedProbability) {
mDescription = description;
- mIsEnableConfigurableEventReportingWindows = isEnableConfigurableEventReportingWindows;
mSource =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(sourceType)
@@ -936,7 +736,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
BigDecimal.valueOf(expectedProbability)
.setScale(7, RoundingMode.HALF_UP)
.doubleValue();
- mEnableConfiguredMaxEventReports = isEnableConfigurableMaxEventReports;
mConfiguredMaxEventReportsCount = configuredMaxEventReportsCount;
}
@@ -944,9 +743,6 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
public void getRandomAttributionProbability_withParameterizedData() {
// Setup
Flags flags = mock(Flags.class);
- doReturn(mIsEnableConfigurableEventReportingWindows)
- .when(flags)
- .getMeasurementEnableConfigurableEventReportingWindows();
doReturn(convertEarlyReportingWindowFlagString(mEarlyReportingWindows))
.when(flags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -954,36 +750,9 @@ public class SourceNoiseHandlerAttributionProbabilityTest {
.when(flags)
.getMeasurementEventReportsCtcEarlyReportingWindows();
doReturn(true).when(flags).getMeasurementEnableCoarseEventReportDestinations();
- doReturn(mEnableConfiguredMaxEventReports)
- .when(flags)
- .getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(mConfiguredMaxEventReportsCount)
.when(flags)
.getMeasurementVtcConfigurableMaxEventReportsCount();
- doReturn(MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementInstallAttrDualDestinationEventNoiseProbability();
- doReturn(MEASUREMENT_INSTALL_ATTR_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementInstallAttrDualDestinationNavigationNoiseProbability();
- doReturn(MEASUREMENT_DUAL_DESTINATION_NAVIGATION_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementDualDestinationNavigationNoiseProbability();
- doReturn(MEASUREMENT_DUAL_DESTINATION_EVENT_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementDualDestinationEventNoiseProbability();
- doReturn(MEASUREMENT_INSTALL_ATTR_EVENT_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementInstallAttrEventNoiseProbability();
- doReturn(MEASUREMENT_INSTALL_ATTR_NAVIGATION_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementInstallAttrNavigationNoiseProbability();
- doReturn(MEASUREMENT_EVENT_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementEventNoiseProbability();
- doReturn(MEASUREMENT_NAVIGATION_NOISE_PROBABILITY)
- .when(flags)
- .getMeasurementNavigationNoiseProbability();
// Execution
double actualProbability =
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerTest.java
index 06a3dc6ae7..c9d0cf23a7 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/noising/SourceNoiseHandlerTest.java
@@ -50,49 +50,17 @@ public class SourceNoiseHandlerTest {
@Before
public void setup() {
mFlags = mock(Flags.class);
- doReturn(false).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
+ doReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT)
+ .when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
+ doReturn(Flags.MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS)
+ .when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
+ doReturn(Flags.MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS)
+ .when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
mSourceNoiseHandler =
spy(new SourceNoiseHandler(mFlags, new EventReportWindowCalcDelegate(mFlags)));
}
@Test
- public void fakeReports_eventSourceDualDestPostInstallMode_generatesFromStaticReportStates() {
- long expiry = System.currentTimeMillis();
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setWebDestinations(SourceFixture.ValidSourceParams.WEB_DESTINATIONS)
- .setEventReportWindow(expiry)
- .setInstallCooldownWindow(
- SourceFixture.ValidSourceParams.INSTALL_COOLDOWN_WINDOW)
- .build();
- // Force increase the probability of random attribution.
- doReturn(0.50D).when(mSourceNoiseHandler).getRandomAttributionProbability(source);
- int falseCount = 0;
- int neverCount = 0;
- int truthCount = 0;
- for (int i = 0; i < 500; i++) {
- List<Source.FakeReport> fakeReports =
- mSourceNoiseHandler.assignAttributionModeAndGenerateFakeReports(source);
- if (source.getAttributionMode() == Source.AttributionMode.FALSELY) {
- falseCount++;
- assertNotEquals(0, fakeReports.size());
- assertTrue(
- isValidEventSourceDualDestPostInstallModeFakeReportState(
- source, fakeReports));
- } else if (source.getAttributionMode() == Source.AttributionMode.NEVER) {
- neverCount++;
- assertEquals(0, fakeReports.size());
- } else {
- truthCount++;
- }
- }
- assertNotEquals(0, falseCount);
- assertNotEquals(0, neverCount);
- assertNotEquals(0, truthCount);
- }
-
- @Test
public void fakeReports_flexEventReport_generatesFromStaticReportStates() {
Source source = SourceFixture.getValidSourceWithFlexEventReportWithFewerState();
// Force increase the probability of random attribution.
@@ -167,6 +135,7 @@ public class SourceNoiseHandlerTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(30))
.build();
assertEquals(
@@ -181,6 +150,7 @@ public class SourceNoiseHandlerTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(7))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(7))
.build();
assertEquals(
@@ -195,6 +165,7 @@ public class SourceNoiseHandlerTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(2))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
@@ -302,6 +273,7 @@ public class SourceNoiseHandlerTest {
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(30))
.build();
assertEquals(
@@ -318,6 +290,7 @@ public class SourceNoiseHandlerTest {
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(7))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(7))
.build();
assertEquals(
@@ -334,6 +307,7 @@ public class SourceNoiseHandlerTest {
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(2))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
@@ -350,6 +324,7 @@ public class SourceNoiseHandlerTest {
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(30))
.build();
assertEquals(
@@ -366,6 +341,7 @@ public class SourceNoiseHandlerTest {
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(7))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(7))
.build();
assertEquals(
@@ -382,6 +358,7 @@ public class SourceNoiseHandlerTest {
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(2))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
@@ -393,11 +370,11 @@ public class SourceNoiseHandlerTest {
mSourceNoiseHandler.getImpressionNoiseParams(navigationSource2dExpiry));
Source eventSourceWith2Destinations30dExpiry =
SourceFixture.getMinimalValidSourceBuilder()
- .setWebDestinations(SourceFixture.ValidSourceParams.WEB_DESTINATIONS)
.setSourceType(Source.SourceType.EVENT)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(2))
.setInstallAttributionWindow(TimeUnit.DAYS.toMillis(10))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(30))
.build();
assertEquals(
@@ -405,7 +382,7 @@ public class SourceNoiseHandlerTest {
/* reportCount= */ 2,
/* triggerDataCardinality= */ 2,
/* reportingWindowCount= */ 2,
- /* destinationMultiplier */ 2),
+ /* destinationMultiplier */ 1),
mSourceNoiseHandler.getImpressionNoiseParams(
eventSourceWith2Destinations30dExpiry));
}
@@ -491,14 +468,6 @@ public class SourceNoiseHandlerTest {
PrivacyParams.EVENT_TRIGGER_DATA_CARDINALITY);
}
- private boolean isValidEventSourceDualDestPostInstallModeFakeReportState(
- Source source, List<Source.FakeReport> fakeReportsState) {
- // Generated fake reports state matches one of the states
- return Arrays.stream(ImpressionNoiseUtil.DUAL_DESTINATION_POST_INSTALL_FAKE_REPORT_CONFIG)
- .map(reportsState -> convertToReportsState(reportsState, source))
- .anyMatch(fakeReportsState::equals);
- }
-
private List<Source.FakeReport> convertToReportsState(int[][] reportsState, Source source) {
return Arrays.stream(reportsState)
.map(
@@ -507,7 +476,7 @@ public class SourceNoiseHandlerTest {
new UnsignedLong(Long.valueOf(reportState[0])),
new EventReportWindowCalcDelegate(mFlags)
.getReportingTimeForNoising(
- source, reportState[1], true),
+ source, reportState[1]),
reportState[2] == 0
? source.getAppDestinations()
: source.getWebDestinations()))
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueJobServiceTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueJobServiceTest.java
index ee87776c5e..632838e411 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueJobServiceTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueJobServiceTest.java
@@ -20,7 +20,6 @@ import static com.android.adservices.mockito.ExtendedMockitoExpectations.mockGet
import static com.android.adservices.mockito.ExtendedMockitoExpectations.mockGetFlags;
import static com.android.adservices.mockito.MockitoExpectations.mockBackgroundJobsLoggingKillSwitch;
import static com.android.adservices.mockito.MockitoExpectations.syncLogExecutionStats;
-import static com.android.adservices.mockito.MockitoExpectations.syncPersistJobExecutionData;
import static com.android.adservices.mockito.MockitoExpectations.verifyBackgroundJobsSkipLogged;
import static com.android.adservices.mockito.MockitoExpectations.verifyLoggingNotHappened;
import static com.android.adservices.spe.AdservicesJobInfo.MEASUREMENT_ASYNC_REGISTRATION_JOB;
@@ -33,7 +32,6 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
@@ -79,7 +77,6 @@ import org.mockito.internal.stubbing.answers.CallsRealMethods;
import org.mockito.quality.Strictness;
import java.util.Optional;
-import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class AsyncRegistrationQueueJobServiceTest {
@@ -168,9 +165,6 @@ public class AsyncRegistrationQueueJobServiceTest {
runWithMocks(
() -> {
mockBackgroundJobsLoggingKillSwitch(mMockFlags, /* overrideValue= */ false);
- JobServiceLoggingCallback onStartJobCallback =
- syncPersistJobExecutionData(mSpyLogger);
- JobServiceLoggingCallback onJobDoneCallback = syncLogExecutionStats(mSpyLogger);
doReturn(
AsyncRegistrationQueueRunner.ProcessingResult
.SUCCESS_ALL_RECORDS_PROCESSED)
@@ -179,8 +173,7 @@ public class AsyncRegistrationQueueJobServiceTest {
onStartJob_killSwitchOff();
- verify(mSpyLogger).recordOnStartJob(anyInt());
- verify(mSpyLogger).persistJobExecutionData(anyInt(), anyLong());
+ verify(mSpyLogger, timeout(WAIT_IN_MILLIS)).recordOnStartJob(anyInt());
});
}
@@ -364,7 +357,7 @@ public class AsyncRegistrationQueueJobServiceTest {
// Validate jobInfo params to run immediately
ArgumentCaptor<JobInfo> captorJobInfo = ArgumentCaptor.forClass(JobInfo.class);
- verify(jobScheduler, times(1)).schedule(captorJobInfo.capture());
+ verify(jobScheduler, timeout(WAIT_IN_MILLIS).times(1)).schedule(captorJobInfo.capture());
JobInfo jobInfo = captorJobInfo.getValue();
assertNotNull(jobInfo);
assertNull(jobInfo.getTriggerContentUris());
@@ -559,8 +552,8 @@ public class AsyncRegistrationQueueJobServiceTest {
// Validate
ExtendedMockito.verify(
() -> AsyncRegistrationQueueJobService.schedule(any(), any()),
- times(1));
- verify(mMockJobScheduler, times(1))
+ timeout(WAIT_IN_MILLIS).times(1));
+ verify(mMockJobScheduler, timeout(WAIT_IN_MILLIS).times(1))
.getPendingJob(eq(MEASUREMENT_ASYNC_REGISTRATION_JOB_ID));
});
}
@@ -589,7 +582,8 @@ public class AsyncRegistrationQueueJobServiceTest {
times(1));
ArgumentCaptor<JobInfo> jobInfoArgumentCaptor =
ArgumentCaptor.forClass(JobInfo.class);
- verify(mMockJobScheduler, times(1)).schedule(jobInfoArgumentCaptor.capture());
+ verify(mMockJobScheduler, timeout(WAIT_IN_MILLIS).times(1))
+ .schedule(jobInfoArgumentCaptor.capture());
JobInfo job = jobInfoArgumentCaptor.getValue();
assertEquals(JOB_TRIGGER_MIN_DELAY_MS, job.getTriggerContentUpdateDelay());
assertEquals(JOB_TRIGGER_MAX_DELAY_MS, job.getTriggerContentMaxDelay());
@@ -612,7 +606,8 @@ public class AsyncRegistrationQueueJobServiceTest {
boolean onStopJobResult =
mSpyService.onStopJob(Mockito.mock(JobParameters.class));
- verify(mSpyService, times(0)).jobFinished(any(), anyBoolean());
+ verify(mSpyService, timeout(WAIT_IN_MILLIS).times(0))
+ .jobFinished(any(), anyBoolean());
assertTrue(onStopJobResult);
assertTrue(mSpyService.getFutureForTesting().isCancelled());
});
@@ -633,8 +628,9 @@ public class AsyncRegistrationQueueJobServiceTest {
assertFalse(result);
// Allow background thread to execute
Thread.sleep(WAIT_IN_MILLIS);
- verify(mSpyService, times(1)).jobFinished(any(), eq(false));
- verify(mMockJobScheduler, times(1)).cancel(eq(MEASUREMENT_ASYNC_REGISTRATION_JOB_ID));
+ verify(mSpyService, timeout(WAIT_IN_MILLIS).times(1)).jobFinished(any(), eq(false));
+ verify(mMockJobScheduler, timeout(WAIT_IN_MILLIS).times(1))
+ .cancel(eq(MEASUREMENT_ASYNC_REGISTRATION_JOB_ID));
}
private void onStartJob_killSwitchOn() throws Exception {
@@ -646,10 +642,9 @@ public class AsyncRegistrationQueueJobServiceTest {
// Validate
assertFalse(result);
- // Allow background thread to execute
- Thread.sleep(WAIT_IN_MILLIS);
- verify(mSpyService, times(1)).jobFinished(any(), eq(false));
- verify(mMockJobScheduler, times(1)).cancel(eq(MEASUREMENT_ASYNC_REGISTRATION_JOB_ID));
+ verify(mSpyService, timeout(WAIT_IN_MILLIS).times(1)).jobFinished(any(), eq(false));
+ verify(mMockJobScheduler, timeout(WAIT_IN_MILLIS).times(1))
+ .cancel(eq(MEASUREMENT_ASYNC_REGISTRATION_JOB_ID));
}
private void onStartJob_killSwitchOff() throws Exception {
@@ -701,9 +696,4 @@ public class AsyncRegistrationQueueJobServiceTest {
ExtendedMockito.doReturn(mMockFlags).when(FlagsFactory::getFlags);
ExtendedMockito.doReturn(value).when(mMockFlags).getAsyncRegistrationJobQueueKillSwitch();
}
-
- private Object countDown(CountDownLatch countDownLatch) {
- countDownLatch.countDown();
- return null;
- }
}
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueRunnerTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueRunnerTest.java
index 3322190ddb..2cfc9e6c46 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueRunnerTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncRegistrationQueueRunnerTest.java
@@ -33,7 +33,6 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import android.adservices.measurement.RegistrationRequest;
import android.adservices.measurement.WebSourceParams;
import android.adservices.measurement.WebSourceRegistrationRequest;
import android.content.ContentProviderClient;
@@ -96,6 +95,7 @@ import org.mockito.stubbing.Answer;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -125,6 +125,10 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
private static final String LIST_TYPE_REDIRECT_URI_1 = WebUtil.validUrl("https://foo.test");
private static final String LIST_TYPE_REDIRECT_URI_2 = WebUtil.validUrl("https://bar.test");
private static final String LOCATION_TYPE_REDIRECT_URI = WebUtil.validUrl("https://baz.test");
+ private static final String LOCATION_TYPE_REDIRECT_URI_2 = WebUtil.validUrl("https://qux.test");
+ private static final String LOCATION_TYPE_REDIRECT_URI_3 =
+ WebUtil.validUrl("https://quux.test");
+
private static final Uri WEB_DESTINATION = WebUtil.validUri("https://web-destination.test");
private static final Uri APP_DESTINATION = Uri.parse("android-app://com.app_destination");
private static final Source SOURCE_1 =
@@ -265,6 +269,12 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mFlags.getMeasurementFlexApiMaxInformationGainDualDestinationNavigation())
.thenReturn(Flags
.MEASUREMENT_FLEX_API_MAX_INFORMATION_GAIN_DUAL_DESTINATION_NAVIGATION);
+ when(mFlags.getMeasurementVtcConfigurableMaxEventReportsCount())
+ .thenReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT);
+ when(mFlags.getMeasurementEventReportsVtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS);
+ when(mFlags.getMeasurementEventReportsCtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS);
when(mMeasurementDao.insertSource(any())).thenReturn(DEFAULT_SOURCE_ID);
mContext = spy(sDefaultContext);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
@@ -277,17 +287,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedSource);
};
doAnswer(answerAsyncSourceFetcher)
@@ -305,14 +316,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -339,17 +343,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedSource);
};
doAnswer(answerAsyncSourceFetcher)
@@ -367,14 +372,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
Thread.currentThread().interrupt();
@@ -420,16 +418,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(LIST_TYPE_REDIRECT_URI_1, LIST_TYPE_REDIRECT_URI_2));
Answer<Optional<Source>> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- Uri.parse(LIST_TYPE_REDIRECT_URI_1),
- Uri.parse(LIST_TYPE_REDIRECT_URI_2)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedSource);
};
doAnswer(answerAsyncSourceFetcher)
@@ -444,14 +442,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -496,14 +487,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LOCATION,
+ List.of(LOCATION_TYPE_REDIRECT_URI));
Answer<Optional<Source>> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LOCATION,
- List.of(Uri.parse(LOCATION_TYPE_REDIRECT_URI)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedSource);
};
doAnswer(answerAsyncSourceFetcher)
@@ -518,14 +511,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -562,14 +548,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LOCATION,
+ List.of(LOCATION_TYPE_REDIRECT_URI));
Answer<Optional<Source>> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LOCATION,
- List.of(Uri.parse(LOCATION_TYPE_REDIRECT_URI)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedSource);
};
doAnswer(answerAsyncSourceFetcher)
@@ -621,6 +609,338 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
}
@Test
+ public void runAsyncRegistrationQueueWorker_appSrc_defaultReg_redirectWellKnown_typeLocation()
+ throws DatastoreException {
+ // Setup
+ AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
+ getSpyAsyncRegistrationQueueRunner();
+ AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ Answer<Optional<Source>> answerAsyncSourceFetcher =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ LOCATION_TYPE_REDIRECT_URI, validAsyncRegistration);
+ doAnswer(answerAsyncSourceFetcher)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+
+ List<Source.FakeReport> eventReportList =
+ Collections.singletonList(
+ new Source.FakeReport(new UnsignedLong(1L), 1L, List.of(APP_DESTINATION)));
+ when(mSourceNoiseHandler.assignAttributionModeAndGenerateFakeReports(mMockedSource))
+ .thenReturn(eventReportList);
+ when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
+ .thenReturn(validAsyncRegistration);
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
+ when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
+
+ // Execution
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ ArgumentCaptor<AsyncRegistration> asyncRegistrationArgumentCaptor =
+ ArgumentCaptor.forClass(AsyncRegistration.class);
+
+ // Assertions
+ verify(mAsyncSourceFetcher, times(1))
+ .fetchSource(any(AsyncRegistration.class), any(), any());
+ verify(mMeasurementDao, times(1)).insertEventReport(any(EventReport.class));
+ verify(mMeasurementDao, times(1)).insertSource(any(Source.class));
+ verify(mMeasurementDao, times(1))
+ .insertAsyncRegistration(asyncRegistrationArgumentCaptor.capture());
+
+ Assert.assertEquals(1, asyncRegistrationArgumentCaptor.getAllValues().size());
+ AsyncRegistration asyncReg = asyncRegistrationArgumentCaptor.getAllValues().get(0);
+ Assert.assertEquals(
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI), LOCATION_TYPE_REDIRECT_URI),
+ asyncReg.getRegistrationUri());
+
+ ArgumentCaptor<KeyValueData> redirectCountCaptor =
+ ArgumentCaptor.forClass(KeyValueData.class);
+ verify(mMeasurementDao, times(1)).insertOrUpdateKeyValueData(redirectCountCaptor.capture());
+ assertEquals(2, redirectCountCaptor.getValue().getRegistrationRedirectCount());
+
+ verify(mMeasurementDao, times(1)).deleteAsyncRegistration(any(String.class));
+ }
+
+ @Test
+ public void runAsyncRegistrationQueueWorker_appSrc_defaultReg_redirectChain_typeLocation()
+ throws DatastoreException {
+ // Setup
+ AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
+ getSpyAsyncRegistrationQueueRunner();
+ AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ Answer<Optional<Source>> answerAsyncSourceFetcher =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ LOCATION_TYPE_REDIRECT_URI, validAsyncRegistration);
+ doAnswer(answerAsyncSourceFetcher)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+
+ List<Source.FakeReport> eventReportList =
+ Collections.singletonList(
+ new Source.FakeReport(new UnsignedLong(1L), 1L, List.of(APP_DESTINATION)));
+ when(mSourceNoiseHandler.assignAttributionModeAndGenerateFakeReports(mMockedSource))
+ .thenReturn(eventReportList);
+ when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
+ .thenReturn(validAsyncRegistration);
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
+ when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
+
+ // Execution
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+ // Set up the second invocation.
+ Answer<Optional<Source>> answerAsyncSourceFetcher2 =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ LOCATION_TYPE_REDIRECT_URI_2, validAsyncRegistration);
+ doAnswer(answerAsyncSourceFetcher2)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ // Set up the third invocation.
+ Answer<Optional<Source>> answerAsyncSourceFetcher3 =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ LOCATION_TYPE_REDIRECT_URI_3, validAsyncRegistration);
+
+ doAnswer(answerAsyncSourceFetcher3)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ // Assertions for all invocations
+ ArgumentCaptor<AsyncRegistration> asyncRegistrationArgumentCaptor =
+ ArgumentCaptor.forClass(AsyncRegistration.class);
+ verify(mMeasurementDao, times(3))
+ .insertAsyncRegistration(asyncRegistrationArgumentCaptor.capture());
+ Assert.assertEquals(3, asyncRegistrationArgumentCaptor.getAllValues().size());
+
+ ArgumentCaptor<KeyValueData> redirectCountCaptor =
+ ArgumentCaptor.forClass(KeyValueData.class);
+ verify(mMeasurementDao, times(3)).insertOrUpdateKeyValueData(redirectCountCaptor.capture());
+ assertEquals(4, redirectCountCaptor.getValue().getRegistrationRedirectCount());
+
+ // Assertions for first invocation
+ assertRepeatedAsyncRegistration(
+ asyncRegistrationArgumentCaptor,
+ 0,
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI),
+ LOCATION_TYPE_REDIRECT_URI.toString()));
+
+ // Assertions for second invocation
+ assertRepeatedAsyncRegistration(
+ asyncRegistrationArgumentCaptor,
+ 1,
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI_2),
+ LOCATION_TYPE_REDIRECT_URI_2.toString()));
+
+ // Assertions for third invocation
+ assertRepeatedAsyncRegistration(
+ asyncRegistrationArgumentCaptor,
+ 2,
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI_3),
+ LOCATION_TYPE_REDIRECT_URI_3.toString()));
+ }
+
+ @Test
+ public void runAsyncRegistrationQueueWorker_appSrc_defaultReg_redirectWithExistingPathAndQuery()
+ throws DatastoreException {
+ // Setup
+ AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
+ getSpyAsyncRegistrationQueueRunner();
+ AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ String redirectWithExistingPath = LOCATION_TYPE_REDIRECT_URI + "/path?key=value";
+ Answer<Optional<Source>> answerAsyncSourceFetcher =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ redirectWithExistingPath, validAsyncRegistration);
+ doAnswer(answerAsyncSourceFetcher)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+
+ List<Source.FakeReport> eventReportList =
+ Collections.singletonList(
+ new Source.FakeReport(new UnsignedLong(1L), 1L, List.of(APP_DESTINATION)));
+ when(mSourceNoiseHandler.assignAttributionModeAndGenerateFakeReports(mMockedSource))
+ .thenReturn(eventReportList);
+ when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
+ .thenReturn(validAsyncRegistration);
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
+ when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
+
+ // Execution
+
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ ArgumentCaptor<AsyncRegistration> asyncRegistrationArgumentCaptor =
+ ArgumentCaptor.forClass(AsyncRegistration.class);
+
+ // Assertions
+ verify(mAsyncSourceFetcher, times(1))
+ .fetchSource(any(AsyncRegistration.class), any(), any());
+ verify(mMeasurementDao, times(1)).insertEventReport(any(EventReport.class));
+ verify(mMeasurementDao, times(1)).insertSource(any(Source.class));
+ verify(mMeasurementDao, times(1))
+ .insertAsyncRegistration(asyncRegistrationArgumentCaptor.capture());
+
+ Assert.assertEquals(1, asyncRegistrationArgumentCaptor.getAllValues().size());
+ AsyncRegistration asyncReg = asyncRegistrationArgumentCaptor.getAllValues().get(0);
+
+ Uri expectedUri =
+ Uri.parse(
+ LOCATION_TYPE_REDIRECT_URI
+ + "/"
+ + AsyncRedirects.WELL_KNOWN_PATH_SEGMENT
+ + "?"
+ + AsyncRedirects.WELL_KNOWN_QUERY_PARAM
+ + "="
+ + Uri.encode(redirectWithExistingPath));
+ Assert.assertEquals(expectedUri, asyncReg.getRegistrationUri());
+ }
+
+ @Test
+ public void runAsyncRegistrationQueueWorker_noSourceReg_RedirectHasSource()
+ throws DatastoreException {
+ // Setup
+ AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
+ getSpyAsyncRegistrationQueueRunner();
+ AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+
+ // Create an empty response for fetchSource. This is necessary because we need to mock the
+ // addition of a redirect, despite a failing initial source registration.
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LOCATION,
+ List.of(LOCATION_TYPE_REDIRECT_URI));
+ redirectHeaders.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+ Answer<Optional<Source>> answerEmptySource =
+ invocation -> {
+ AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
+ asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
+ return Optional.empty();
+ };
+
+ doAnswer(answerEmptySource).when(mAsyncSourceFetcher).fetchSource(any(), any(), any());
+
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+
+ List<Source.FakeReport> eventReportList =
+ Collections.singletonList(
+ new Source.FakeReport(new UnsignedLong(1L), 1L, List.of(APP_DESTINATION)));
+ when(mSourceNoiseHandler.assignAttributionModeAndGenerateFakeReports(mMockedSource))
+ .thenReturn(eventReportList);
+ when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
+ .thenReturn(validAsyncRegistration);
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
+ when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
+
+ // Execution
+
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ // Set up second invocation of runner. This time, do return a valid source.
+ Answer<Optional<Source>> answerAsyncSourceFetcher =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ LOCATION_TYPE_REDIRECT_URI_2, validAsyncRegistration);
+
+ doAnswer(answerAsyncSourceFetcher)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ ArgumentCaptor<AsyncRegistration> asyncRegistrationArgumentCaptor =
+ ArgumentCaptor.forClass(AsyncRegistration.class);
+
+ // Assertions
+ verify(mAsyncSourceFetcher, times(2))
+ .fetchSource(any(AsyncRegistration.class), any(), any());
+ verify(mMeasurementDao, times(1)).insertEventReport(any(EventReport.class));
+ verify(mMeasurementDao, times(1)).insertSource(any(Source.class));
+ verify(mMeasurementDao, times(2))
+ .insertAsyncRegistration(asyncRegistrationArgumentCaptor.capture());
+
+ Assert.assertEquals(2, asyncRegistrationArgumentCaptor.getAllValues().size());
+ AsyncRegistration asyncReg = asyncRegistrationArgumentCaptor.getAllValues().get(0);
+
+ // Assert first invocation's redirect
+ Uri expectedUri =
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI),
+ LOCATION_TYPE_REDIRECT_URI.toString());
+ Assert.assertEquals(expectedUri, asyncReg.getRegistrationUri());
+
+ AsyncRegistration asyncReg2 = asyncRegistrationArgumentCaptor.getAllValues().get(1);
+
+ // Assert second invocation's redirect
+ expectedUri =
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI_2),
+ LOCATION_TYPE_REDIRECT_URI_2.toString());
+ Assert.assertEquals(expectedUri, asyncReg2.getRegistrationUri());
+ }
+
+ @Test
+ public void runAsyncRegistrationQueueWorker_appSrc_defaultReg_redirectAlreadyWellKnown()
+ throws DatastoreException {
+ // Setup
+ AsyncRegistrationQueueRunner asyncRegistrationQueueRunner =
+ getSpyAsyncRegistrationQueueRunner();
+ AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
+ String redirectAlreadyWellKnown =
+ LOCATION_TYPE_REDIRECT_URI + "/" + AsyncRedirects.WELL_KNOWN_PATH_SEGMENT;
+ Answer<Optional<Source>> answerAsyncSourceFetcher =
+ getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ redirectAlreadyWellKnown, validAsyncRegistration);
+ doAnswer(answerAsyncSourceFetcher)
+ .when(mAsyncSourceFetcher)
+ .fetchSource(any(), any(), any());
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+
+ List<Source.FakeReport> eventReportList =
+ Collections.singletonList(
+ new Source.FakeReport(new UnsignedLong(1L), 1L, List.of(APP_DESTINATION)));
+ when(mSourceNoiseHandler.assignAttributionModeAndGenerateFakeReports(mMockedSource))
+ .thenReturn(eventReportList);
+ when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
+ .thenReturn(validAsyncRegistration);
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
+ when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
+
+ // Execution
+
+ asyncRegistrationQueueRunner.runAsyncRegistrationQueueWorker();
+
+ ArgumentCaptor<AsyncRegistration> asyncRegistrationArgumentCaptor =
+ ArgumentCaptor.forClass(AsyncRegistration.class);
+
+ // Assertions
+ verify(mAsyncSourceFetcher, times(1))
+ .fetchSource(any(AsyncRegistration.class), any(), any());
+ verify(mMeasurementDao, times(1)).insertEventReport(any(EventReport.class));
+ verify(mMeasurementDao, times(1)).insertSource(any(Source.class));
+ verify(mMeasurementDao, times(1))
+ .insertAsyncRegistration(asyncRegistrationArgumentCaptor.capture());
+
+ Assert.assertEquals(1, asyncRegistrationArgumentCaptor.getAllValues().size());
+ AsyncRegistration asyncReg = asyncRegistrationArgumentCaptor.getAllValues().get(0);
+ // Assert .well-known isn't duplicated in path.
+ Assert.assertEquals(
+ getRegistrationRedirectToWellKnownUri(
+ Uri.parse(LOCATION_TYPE_REDIRECT_URI), redirectAlreadyWellKnown.toString()),
+ asyncReg.getRegistrationUri());
+ }
+
+ @Test
public void runAsyncRegistrationQueueWorker_appInstalled_markToBeDeleted()
throws DatastoreException, PackageManager.NameNotFoundException {
// Setup
@@ -639,17 +959,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
mLogger);
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(
SourceFixture.getValidSourceBuilder()
.setDropSourceIfInstalled(true)
@@ -670,14 +991,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -713,17 +1027,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
mLogger);
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(
SourceFixture.getValidSourceBuilder()
.setDropSourceIfInstalled(true)
@@ -744,14 +1059,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -786,17 +1094,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
mLogger);
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(
SourceFixture.getValidSourceBuilder()
.setDropSourceIfInstalled(false)
@@ -817,14 +1126,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -860,17 +1162,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
mLogger);
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppSource();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncSourceFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(
SourceFixture.getValidSourceBuilder()
.setDropSourceIfInstalled(false)
@@ -891,14 +1194,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -922,17 +1218,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(LIST_TYPE_REDIRECT_URI_1, LIST_TYPE_REDIRECT_URI_2));
Answer<Optional<Trigger>> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- Uri.parse(LIST_TYPE_REDIRECT_URI_1),
- Uri.parse(LIST_TYPE_REDIRECT_URI_2)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedTrigger);
};
doAnswer(answerAsyncTriggerFetcher)
@@ -942,14 +1237,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -996,15 +1284,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LOCATION,
+ List.of(LOCATION_TYPE_REDIRECT_URI));
Answer<Optional<Trigger>> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LOCATION,
- List.of(Uri.parse(LOCATION_TYPE_REDIRECT_URI)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedTrigger);
};
doAnswer(answerAsyncTriggerFetcher)
@@ -1014,14 +1303,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
when(mMeasurementDao.fetchNextQueuedAsyncRegistration(anyInt(), any()))
.thenReturn(validAsyncRegistration)
.thenReturn(null);
- KeyValueData redirectCount =
- new KeyValueData.Builder()
- .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
- .setKey(
- AsyncRegistrationFixture.ValidAsyncRegistrationParams
- .REGISTRATION_ID)
- .setValue(null) // Should default to 1
- .build();
+ KeyValueData redirectCount = getKeyValueDataRedirectCount();
when(mMeasurementDao.getKeyValueData(anyString(), any())).thenReturn(redirectCount);
// Execution
@@ -1059,15 +1341,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LOCATION,
+ List.of(LOCATION_TYPE_REDIRECT_URI));
Answer<Optional<Trigger>> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LOCATION,
- List.of(Uri.parse(LOCATION_TYPE_REDIRECT_URI)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedTrigger);
};
doAnswer(answerAsyncTriggerFetcher)
@@ -1120,17 +1403,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ IntStream.range(1, 10)
+ .mapToObj((i) -> LIST_TYPE_REDIRECT_URI_1 + "/" + i)
+ .collect(Collectors.toList()));
Answer<Optional<Trigger>> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- IntStream.range(1, 10)
- .mapToObj((i) -> Uri.parse(LIST_TYPE_REDIRECT_URI_1 + "/" + i))
- .collect(Collectors.toList()));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedTrigger);
};
doAnswer(answerAsyncTriggerFetcher)
@@ -1189,15 +1473,16 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LOCATION,
+ Collections.singletonList((LOCATION_TYPE_REDIRECT_URI)));
Answer<Optional<Trigger>> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LOCATION,
- Collections.singletonList(Uri.parse(LOCATION_TYPE_REDIRECT_URI)));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedTrigger);
};
doAnswer(answerAsyncTriggerFetcher)
@@ -1433,17 +1718,18 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.of(mMockedTrigger);
};
doAnswer(answerAsyncTriggerFetcher)
@@ -1610,18 +1896,19 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
getSpyAsyncRegistrationQueueRunner();
AsyncRegistration validAsyncRegistration = createAsyncRegistrationForAppTrigger();
-
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(
+ AsyncRegistration.RedirectType.LIST,
+ List.of(
+ WebUtil.validUri("https://example.test/sF1").toString(),
+ WebUtil.validUri("https://example.test/sF2").toString()));
Answer<?> answerAsyncTriggerFetcher =
invocation -> {
AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
asyncFetchStatus.setEntityStatus(AsyncFetchStatus.EntityStatus.PARSING_ERROR);
- AsyncRedirect asyncRedirect = invocation.getArgument(2);
- asyncRedirect.addToRedirects(
- AsyncRegistration.RedirectType.LIST,
- List.of(
- WebUtil.validUri("https://example.test/sF1"),
- WebUtil.validUri("https://example.test/sF2")));
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, validAsyncRegistration);
return Optional.empty();
};
doAnswer(answerAsyncTriggerFetcher)
@@ -3285,12 +3572,56 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
assertTrue(status);
}
- private RegistrationRequest buildRequest(String registrationUri) {
- return new RegistrationRequest.Builder(
- RegistrationRequest.REGISTER_SOURCE,
- Uri.parse(registrationUri),
- sDefaultContext.getAttributionSource().getPackageName(),
- SDK_PACKAGE_NAME)
+ private static KeyValueData getKeyValueDataRedirectCount() {
+ return new KeyValueData.Builder()
+ .setDataType(KeyValueData.DataType.REGISTRATION_REDIRECT_COUNT)
+ .setKey(AsyncRegistrationFixture.ValidAsyncRegistrationParams.REGISTRATION_ID)
+ .setValue(null) // Should default to 1
+ .build();
+ }
+
+ private Map<String, List<String>> getRedirectHeaders(
+ AsyncRegistration.RedirectType redirectType, List<String> uris) {
+ Map<String, List<String>> headers = new HashMap<>();
+ if (redirectType.equals(AsyncRegistration.RedirectType.LOCATION)) {
+ headers.put(AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, uris);
+ } else {
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, uris);
+ }
+
+ return headers;
+ }
+
+ private void assertRepeatedAsyncRegistration(
+ ArgumentCaptor<AsyncRegistration> asyncRegistrationArgumentCaptor,
+ int index,
+ Uri redirectUri) {
+ AsyncRegistration asyncReg = asyncRegistrationArgumentCaptor.getAllValues().get(index);
+ Assert.assertEquals(redirectUri, asyncReg.getRegistrationUri());
+ }
+
+ private Answer<Optional<Source>> getAsyncSourceAnswerForLocationTypeRedirectToWellKnown(
+ String redirectUri, AsyncRegistration asyncRegistration) {
+ Map<String, List<String>> redirectHeaders =
+ getRedirectHeaders(AsyncRegistration.RedirectType.LOCATION, List.of(redirectUri));
+ redirectHeaders.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+ return invocation -> {
+ AsyncFetchStatus asyncFetchStatus = invocation.getArgument(1);
+ asyncFetchStatus.setResponseStatus(AsyncFetchStatus.ResponseStatus.SUCCESS);
+ AsyncRedirects asyncRedirects = invocation.getArgument(2);
+ asyncRedirects.configure(redirectHeaders, mFlags, asyncRegistration);
+ return Optional.of(mMockedSource);
+ };
+ }
+
+ private Uri getRegistrationRedirectToWellKnownUri(
+ Uri registrationUri, String originalUriString) {
+ return registrationUri
+ .buildUpon()
+ .encodedPath(AsyncRedirects.WELL_KNOWN_PATH_SEGMENT)
+ .appendQueryParameter(AsyncRedirects.WELL_KNOWN_QUERY_PARAM, originalUriString)
.build();
}
@@ -3316,7 +3647,7 @@ public final class AsyncRegistrationQueueRunnerTest extends AdServicesExtendedMo
new Source.FakeReport(
new UnsignedLong(0L),
new EventReportWindowCalcDelegate(mFlags)
- .getReportingTimeForNoising(source, 0, false),
+ .getReportingTimeForNoising(source, 0),
destinations))
.collect(Collectors.toList());
}
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncSourceFetcherTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncSourceFetcherTest.java
index 0489c91f50..aa07077e89 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncSourceFetcherTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncSourceFetcherTest.java
@@ -122,6 +122,15 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
private static final String LIST_TYPE_REDIRECT_URI = WebUtil.validUrl("https://bar.test");
private static final String LOCATION_TYPE_REDIRECT_URI =
WebUtil.validUrl("https://example.test");
+ private static final String LOCATION_TYPE_REDIRECT_WELLKNOWN_URI =
+ WebUtil.validUrl(
+ LOCATION_TYPE_REDIRECT_URI
+ + "/"
+ + AsyncRedirects.WELL_KNOWN_PATH_SEGMENT
+ + "?"
+ + AsyncRedirects.WELL_KNOWN_QUERY_PARAM
+ + "="
+ + Uri.encode(LOCATION_TYPE_REDIRECT_URI));
private static final long ALT_EVENT_ID = 123456789;
private static final long ALT_EXPIRY = 456790;
private static final Uri REGISTRATION_URI_1 = WebUtil.validUri("https://subdomain.foo.test");
@@ -226,6 +235,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
.thenReturn(Flags.MEASUREMENT_MAX_INSTALL_ATTRIBUTION_WINDOW);
when(mFlags.getMeasurementMinInstallAttributionWindow())
.thenReturn(Flags.MEASUREMENT_MIN_INSTALL_ATTRIBUTION_WINDOW);
+ when(mFlags.getMeasurementVtcConfigurableMaxEventReportsCount())
+ .thenReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT);
+ when(mFlags.getMeasurementEventReportsVtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS);
+ when(mFlags.getMeasurementEventReportsCtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS);
}
@Test
@@ -260,13 +275,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "}\n")));
when(mFlags.getMeasurementEnableXNA()).thenReturn(true);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
asyncFetchStatus.setRegistrationDelay(0L);
// Execution
AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
Optional<Source> fetch =
- mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -319,7 +334,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
when(mUrlConnection.getHeaderFields())
.thenReturn(
Map.of(
- "Attribution-Reporting-Redirect",
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY,
List.of(LIST_TYPE_REDIRECT_URI),
"Attribution-Reporting-Register-Source",
List.of(
@@ -340,19 +355,20 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
// Redirects should be parsed & added
verify(mFetcher, times(1)).openUrl(any());
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LIST_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI, asyncRedirects.getRedirects().get(0).getUri().toString());
// Source shouldn't be created
assertEquals(
@@ -385,12 +401,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -433,12 +449,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -476,12 +492,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -520,12 +536,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -555,12 +571,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -597,12 +613,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"install_attribution_window\": null,\n"
+ " \"post_install_exclusivity_window\": null\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -646,12 +662,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\":"
+ " \"9876543210\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -678,12 +694,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
WebUtil.validUri("http://foo.test"),
sContext.getPackageName(),
SDK_PACKAGE_NAME);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.INVALID_URL, asyncFetchStatus.getResponseStatus());
@@ -698,12 +714,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
WebUtil.validUri("bad-schema://foo.test"),
sContext.getPackageName(),
SDK_PACKAGE_NAME);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.INVALID_URL, asyncFetchStatus.getResponseStatus());
@@ -716,12 +732,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
doThrow(new IOException("Bad internet things"))
.when(mFetcher)
.openUrl(new URL(DEFAULT_REGISTRATION));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.NETWORK_ERROR,
@@ -743,12 +759,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"source_event_id\": \""
+ DEFAULT_EVENT_ID
+ "\"")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.PARSING_ERROR, asyncFetchStatus.getEntityStatus());
@@ -762,12 +778,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(DEFAULT_REGISTRATION));
when(mUrlConnection.getResponseCode()).thenReturn(200);
when(mUrlConnection.getHeaderFields()).thenReturn(Collections.emptyMap());
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -790,12 +806,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"destination\": \""
+ DEFAULT_DESTINATION
+ "\"")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.PARSING_ERROR, asyncFetchStatus.getEntityStatus());
@@ -821,12 +837,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -861,12 +877,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"source_event_id\":\"" + DEFAULT_EVENT_ID + "\","
+ "\"expiry\":\"-15\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -893,12 +909,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"expiry\":\"86399\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -933,12 +949,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"expiry\":\"2592001\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -980,12 +996,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ TimeUnit.DAYS.toSeconds(1) / 2L)
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1025,12 +1041,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
- 1L)
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1067,12 +1083,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ String.valueOf(TimeUnit.HOURS.toSeconds(25))
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1107,12 +1123,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"expiry\":\"172800\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1149,12 +1165,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"86400\","
+ "\"aggregatable_report_window\":\"86400\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1192,12 +1208,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"2000\","
+ "\"aggregatable_report_window\":\"1728\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1236,12 +1252,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"2000\","
+ "\"aggregatable_report_window\":\"1728\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1279,12 +1295,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"172801\","
+ "\"aggregatable_report_window\":\"172801\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1323,12 +1339,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"2592001\","
+ "\"aggregatable_report_window\":\"2592001\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1362,12 +1378,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":86400,"
+ "\"aggregatable_report_window\":86400"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -1397,12 +1413,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"-86400\","
+ "\"aggregatable_report_window\":\"86400\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -1428,12 +1444,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"86400\","
+ "\"aggregatable_report_window\":\"-86400\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -1457,12 +1473,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"source_event_id\":\"" + DEFAULT_EVENT_ID + "\","
+ "\"priority\":15"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -1486,13 +1502,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":35}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -1517,13 +1533,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"-35\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1546,13 +1562,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"-35\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -1577,13 +1593,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\",\"source_event_id\":\""
+ "18446744073709551616\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1606,13 +1622,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\",\"source_event_id\":\""
+ "18446744073709551616\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -1637,13 +1653,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"8l2\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1666,13 +1682,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"8l2\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -1713,13 +1729,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "}\n")));
when(mFlags.getMeasurementEnableXNA()).thenReturn(false);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -1751,13 +1767,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\",\"source_event_id\":\""
+ "18446744073709551615\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1793,13 +1809,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_key\":18}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1835,13 +1851,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_key\":\"-18\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1878,13 +1894,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"debug_key\":\"18446744073709551616\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1920,13 +1936,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_key\":\"987fs\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -1962,13 +1978,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_key\":\"18446744073709551615\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -2005,12 +2021,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": null\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -2047,12 +2063,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\",\n"
+ "\"expiry\": 1"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -2089,12 +2105,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\",\n"
+ "\"expiry\": \"1\""
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -2131,12 +2147,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\",\n"
+ "\"expiry\": 2678400"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -2173,12 +2189,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\",\n"
+ "\"expiry\": \"2678400\""
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -2213,13 +2229,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_reporting\":\"true\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -2254,13 +2270,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_reporting\":\"invalid\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -2295,13 +2311,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_reporting\":\"null\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -2336,13 +2352,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\","
+ "\"debug_reporting\":null}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -2376,13 +2392,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"source_event_id\":\""
+ DEFAULT_EVENT_ID
+ "\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
@@ -2421,12 +2437,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ""
+ "}\n"));
when(mUrlConnection.getHeaderFields()).thenReturn(headersSecondRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.SERVER_UNAVAILABLE,
@@ -2442,7 +2458,8 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
when(mUrlConnection.getResponseCode()).thenReturn(200);
Map<String, List<String>> headersFirstRequest = new HashMap<>();
headersFirstRequest.put("Attribution-Reporting-Register-Source", List.of("{}"));
- headersFirstRequest.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
+ headersFirstRequest.put(
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
Map<String, List<String>> headersSecondRequest = new HashMap<>();
headersSecondRequest.put(
"Attribution-Reporting-Register-Source",
@@ -2461,16 +2478,17 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
when(mUrlConnection.getHeaderFields())
.thenReturn(headersFirstRequest)
.thenReturn(headersSecondRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LIST_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI, asyncRedirects.getRedirects().get(0).getUri().toString());
assertEquals(
AsyncFetchStatus.EntityStatus.PARSING_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
@@ -2500,14 +2518,15 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EXPIRY
+ ""
+ "}\n"));
- headersFirstRequest.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
+ headersFirstRequest.put(
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headersFirstRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(AsyncFetchStatus.EntityStatus.SUCCESS, asyncFetchStatus.getEntityStatus());
@@ -2520,8 +2539,9 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
assertEquals(
result.getEventTime() + TimeUnit.SECONDS.toMillis(DEFAULT_EXPIRY_ROUNDED),
result.getExpiryTime());
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LIST_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI, asyncRedirects.getRedirects().get(0).getUri().toString());
assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
}
@@ -2549,14 +2569,15 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EXPIRY
+ "\""
+ "}\n"));
- headersFirstRequest.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
+ headersFirstRequest.put(
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headersFirstRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(AsyncFetchStatus.EntityStatus.SUCCESS, asyncFetchStatus.getEntityStatus());
@@ -2569,8 +2590,9 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
assertEquals(
result.getEventTime() + TimeUnit.SECONDS.toMillis(DEFAULT_EXPIRY_ROUNDED),
result.getExpiryTime());
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LIST_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI, asyncRedirects.getRedirects().get(0).getUri().toString());
assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
}
@@ -2585,33 +2607,36 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
Map<String, List<String>> headers = getDefaultHeaders();
// Populate both 'list' and 'location' type headers
- headers.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
- headers.put("Location", List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headers);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
assertDefaultSourceRegistration(result);
- assertEquals(2, asyncRedirect.getRedirects().size());
+ assertEquals(2, asyncRedirects.getRedirects().size());
assertEquals(
LIST_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LIST)
.get(0)
+ .getUri()
.toString());
assertEquals(
LOCATION_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LOCATION)
.get(0)
+ .getUri()
.toString());
assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2625,22 +2650,25 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
Map<String, List<String>> headers = getDefaultHeaders();
// Populate only 'location' type header
- headers.put("Location", List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headers);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
assertDefaultSourceRegistration(result);
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LOCATION_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
}
@@ -2652,25 +2680,237 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
when(mUrlConnection.getResponseCode()).thenReturn(302);
Map<String, List<String>> headers = getDefaultHeaders();
- headers.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertDefaultSourceRegistration(result);
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI, asyncRedirects.getRedirects().get(0).getUri().toString());
+ assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirects_locationRedirectHeadersToWellKnown() throws Exception {
+ RegistrationRequest request = buildRequest(DEFAULT_REGISTRATION);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertDefaultSourceRegistration(result);
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_WELLKNOWN_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
+ assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirects_bothHeaders_locationTypeToWellKnown() throws Exception {
+ RegistrationRequest request = buildRequest(DEFAULT_REGISTRATION);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
when(mUrlConnection.getHeaderFields()).thenReturn(headers);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
assertDefaultSourceRegistration(result);
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LIST_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(2, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_WELLKNOWN_URI,
+ asyncRedirects
+ .getRedirectsByType(AsyncRegistration.RedirectType.LOCATION)
+ .get(0)
+ .getUri()
+ .toString());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI,
+ asyncRedirects
+ .getRedirectsByType(AsyncRegistration.RedirectType.LIST)
+ .get(0)
+ .getUri()
+ .toString());
+ assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirects_wellKnownHeader_noop() throws Exception {
+ RegistrationRequest request = buildRequest(DEFAULT_REGISTRATION);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ // Populate only redirect behavior header with no actual redirect
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertDefaultSourceRegistration(result);
+ assertEquals(0, asyncRedirects.getRedirects().size());
+ assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirects_wellKnownHeader_acceptsListTypeWithNoLocationType() throws Exception {
+ RegistrationRequest request = buildRequest(DEFAULT_REGISTRATION);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertDefaultSourceRegistration(result);
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI,
+ asyncRedirects
+ .getRedirectsByType(AsyncRegistration.RedirectType.LIST)
+ .get(0)
+ .getUri()
+ .toString());
assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
}
+
+ @Test
+ public void testRedirects_locationRedirectHeaders_wellKnownHeaderMisconfigured()
+ throws Exception {
+ RegistrationRequest request = buildRequest(DEFAULT_REGISTRATION);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG, List.of("BAD"));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertDefaultSourceRegistration(result);
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
+ assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirects_locationRedirectHeaders_wellKnownHeaderNull() throws Exception {
+ RegistrationRequest request = buildRequest(DEFAULT_REGISTRATION);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG, null);
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertDefaultSourceRegistration(result);
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
+ assertEquals(DEFAULT_REGISTRATION, result.getRegistrationOrigin().toString());
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
// End tests for redirect types
@Test
@@ -2693,12 +2933,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -2736,12 +2976,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -2770,12 +3010,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2807,12 +3047,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2841,12 +3081,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2882,12 +3122,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2916,12 +3156,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2949,12 +3189,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\",\n"
+ filterData
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2967,8 +3207,10 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
when(mUrlConnection.getResponseCode()).thenReturn(200);
when(mUrlConnection.getHeaderFields())
- .thenReturn(Map.of(
- "Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI)))
+ .thenReturn(
+ Map.of(
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY,
+ List.of(LIST_TYPE_REDIRECT_URI)))
.thenReturn(
Map.of(
"Attribution-Reporting-Register-Source",
@@ -2987,22 +3229,23 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.HEADER_MISSING, asyncFetchStatus.getEntityStatus());
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
- assertEquals(1, asyncRedirect.getRedirects().size());
+ assertEquals(1, asyncRedirects.getRedirects().size());
assertEquals(
LIST_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LIST)
.get(0)
+ .getUri()
.toString());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -3027,12 +3270,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"aggregation_keys\": {\"campaignCounts\" :"
+ " \"0x159\", \"geoValue\" : \"0x5\"}\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3065,12 +3308,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"aggregation_keys\": {\"campaignCounts\" :"
+ " \"0x159G\", \"geoValue\" : \"0x5\"}\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -3098,12 +3341,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"aggregation_keys\": {\"campaignCounts\" :"
+ " \"0x159G\", \"geoValue\" : \"0x5\"}\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3140,12 +3383,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\":"
+ " \"987654321\",\"aggregation_keys\": "
+ tooManyKeys)));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.PARSING_ERROR, asyncFetchStatus.getEntityStatus());
@@ -3176,12 +3419,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\":"
+ " \"987654321\",\"aggregation_keys\": "
+ tooManyKeys)));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection).setRequestMethod("POST");
@@ -3207,12 +3450,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"aggregation_keys\": [\"campaignCounts\","
+ " \"0x159\", \"geoValue\", \"0x5\"]\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -3240,12 +3483,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\": \"0x159\","
+ "\"geoValue\": \"0x5\"}\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -3272,12 +3515,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"aggregation_keys\": {\"campaignCounts\" :"
+ " \"0159\", \"geoValue\" : \"0x5\"}\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -3305,12 +3548,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ LONG_AGGREGATE_KEY_PIECE
+ "\"}\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -3341,17 +3584,17 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
AsyncRegistration asyncRegistration = webSourceRegistrationRequest(request, true);
Optional<Source> fetch =
- mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -3392,14 +3635,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3443,14 +3686,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3489,14 +3732,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -3536,14 +3779,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"expiry\": \"432000\","
+ "\"source_event_id\": \"987654321\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -3573,14 +3816,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"expiry\":\"2000\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3612,14 +3855,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"expiry\":\"2592001\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3659,14 +3902,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ TimeUnit.DAYS.toSeconds(1) / 2L)
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true, Source.SourceType.EVENT),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3704,14 +3947,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
- 1L)
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true, Source.SourceType.EVENT),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3746,14 +3989,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ String.valueOf(TimeUnit.HOURS.toSeconds(25))
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true, Source.SourceType.NAVIGATION),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3786,14 +4029,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"expiry\":\"172800\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3828,14 +4071,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"86400\","
+ "\"aggregatable_report_window\":\"86400\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3872,14 +4115,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"2000\","
+ "\"aggregatable_report_window\":\"1728\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3916,14 +4159,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"2000\","
+ "\"aggregatable_report_window\":\"1728\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3959,14 +4202,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"172801\","
+ "\"aggregatable_report_window\":\"172801\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -4002,14 +4245,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_window\":\"2592001\","
+ "\"aggregatable_report_window\":\"2592001\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -4048,19 +4291,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -4100,18 +4343,18 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, false),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -4154,14 +4397,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -4201,19 +4444,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ aggregateSource
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(OS_DESTINATION, result.getAppDestinations().get(0));
assertEquals(filterData, result.getFilterDataString());
@@ -4257,24 +4500,24 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"aggregation_keys\": "
+ aggregateSource
+ "}"),
- "Attribution-Reporting-Redirect",
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY,
List.of(LIST_TYPE_REDIRECT_URI),
- "Location",
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY,
List.of(LOCATION_TYPE_REDIRECT_URI)));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(filterData, result.getFilterDataString());
@@ -4318,14 +4561,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"filter_data\": "
+ filterData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -4362,19 +4605,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_JOIN_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -4419,19 +4662,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_JOIN_KEY
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -4483,14 +4726,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"filter_data\": "
+ filterData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -4529,20 +4772,20 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ WEB_DESTINATION
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(OS_DESTINATION, result.getAppDestinations().get(0));
assertNull(result.getFilterDataString());
@@ -4585,20 +4828,20 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(OS_DESTINATION, result.getAppDestinations().get(0));
assertNull(result.getFilterDataString());
@@ -4638,19 +4881,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(OS_DESTINATION, result.getAppDestinations().get(0));
assertNull(result.getFilterDataString());
@@ -4683,14 +4926,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_EVENT_ID
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.PARSING_ERROR, asyncFetchStatus.getEntityStatus());
@@ -4723,19 +4966,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ EVENT_ID_1
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertNull(result.getFilterDataString());
@@ -4776,14 +5019,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ EVENT_ID_1
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -4813,13 +5056,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
asyncFetchStatus.setRegistrationDelay(0L);
AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
// Execution
Optional<Source> fetch =
- mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
FetcherUtil.emitHeaderMetrics(mFlags, mLogger, asyncRegistration, asyncFetchStatus);
@@ -4873,13 +5116,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_JOIN_KEY
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -4929,13 +5172,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_JOIN_KEY
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -4977,7 +5220,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
// Execution
Optional<Source> fetch =
- mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirect());
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirects());
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5013,7 +5256,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
// Execution
Optional<Source> fetch =
- mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirect());
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirects());
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5053,7 +5296,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\""
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
@@ -5061,7 +5304,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
mFetcher.fetchSource(
appSourceRegistrationRequestWithAdId(request),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5105,19 +5348,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_AD_ID_VALUE
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -5162,19 +5405,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_AD_ID_VALUE
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -5218,19 +5461,19 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEBUG_AD_ID_VALUE
+ "\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
assertEquals(Uri.parse(DEFAULT_DESTINATION), result.getAppDestinations().get(0));
assertEquals(EVENT_ID_1, result.getEventId());
@@ -5246,7 +5489,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
}
@Test
- public void fetchSource_setsFakeEnrollmentId_whenDisableEnrollmentFlagIsTrue()
+ public void fetchSource_setsSiteEnrollmentId_whenDisableEnrollmentFlagIsTrue()
throws Exception {
String uri = "https://test1.example.com:8081";
RegistrationRequest request = buildRequest(uri);
@@ -5270,13 +5513,87 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
// Execution
Optional<Source> fetch =
- mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirect());
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirects());
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Source result = fetch.get();
assertEquals("https://test1.example.com:8081", result.getRegistrationOrigin().toString());
- assertEquals(Enrollment.FAKE_ENROLLMENT, result.getEnrollmentId());
+ assertEquals("https://example.com", result.getEnrollmentId());
+ assertEquals(DEFAULT_DESTINATION, result.getAppDestinations().get(0).toString());
+ assertEquals(DEFAULT_EVENT_ID, result.getEventId());
+ verify(mUrlConnection).setRequestMethod("POST");
+ }
+
+ @Test
+ public void fetchSource_setsSiteEnrollmentId_whenDisableEnrollmentFlagIsTrueForIP()
+ throws Exception {
+ String uri = "https://127.0.0.1:8081";
+ RegistrationRequest request = buildRequest(uri);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(uri));
+ doReturn(true).when(mFlags).isDisableMeasurementEnrollmentCheck();
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ when(mUrlConnection.getHeaderFields())
+ .thenReturn(
+ Map.of(
+ "Attribution-Reporting-Register-Source",
+ List.of(
+ "{\n"
+ + "\"destination\": \""
+ + DEFAULT_DESTINATION
+ + "\",\n"
+ + "\"source_event_id\": \""
+ + DEFAULT_EVENT_ID
+ + "\"\n"
+ + "}\n")));
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirects());
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertEquals("https://127.0.0.1:8081", result.getRegistrationOrigin().toString());
+ assertEquals("https://127.0.0.1", result.getEnrollmentId());
+ assertEquals(DEFAULT_DESTINATION, result.getAppDestinations().get(0).toString());
+ assertEquals(DEFAULT_EVENT_ID, result.getEventId());
+ verify(mUrlConnection).setRequestMethod("POST");
+ }
+
+ @Test
+ public void fetchSource_setsSiteEnrollmentId_whenDisableEnrollmentFlagIsTrueForLocalhost()
+ throws Exception {
+ String uri = "https://localhost:8081";
+ RegistrationRequest request = buildRequest(uri);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(uri));
+ doReturn(true).when(mFlags).isDisableMeasurementEnrollmentCheck();
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ when(mUrlConnection.getHeaderFields())
+ .thenReturn(
+ Map.of(
+ "Attribution-Reporting-Register-Source",
+ List.of(
+ "{\n"
+ + "\"destination\": \""
+ + DEFAULT_DESTINATION
+ + "\",\n"
+ + "\"source_event_id\": \""
+ + DEFAULT_EVENT_ID
+ + "\"\n"
+ + "}\n")));
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appSourceRegistrationRequest(request);
+ // Execution
+ Optional<Source> fetch =
+ mFetcher.fetchSource(asyncRegistration, asyncFetchStatus, new AsyncRedirects());
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Source result = fetch.get();
+ assertEquals("https://localhost:8081", result.getRegistrationOrigin().toString());
+ assertEquals("https://localhost", result.getEnrollmentId());
assertEquals(DEFAULT_DESTINATION, result.getAppDestinations().get(0).toString());
assertEquals(DEFAULT_EVENT_ID, result.getEventId());
verify(mUrlConnection).setRequestMethod("POST");
@@ -5307,12 +5624,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5345,12 +5662,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5384,12 +5701,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5423,12 +5740,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5463,12 +5780,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5502,12 +5819,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\"\n"
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5537,12 +5854,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5574,12 +5891,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"trigger_data_matching\": \"INVALID\","
+ "\"post_install_exclusivity_window\": \"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -5623,12 +5940,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5693,12 +6010,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5775,12 +6092,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5837,12 +6154,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -5887,12 +6204,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5954,14 +6271,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -6040,12 +6357,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -6092,12 +6409,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6142,12 +6459,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6193,12 +6510,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -6248,12 +6565,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -6321,12 +6638,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -6376,12 +6693,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -6447,12 +6764,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6499,14 +6816,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6551,13 +6868,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6603,7 +6920,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
@@ -6611,7 +6928,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6667,13 +6984,13 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6731,7 +7048,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
@@ -6739,7 +7056,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertTrue(fetch.isEmpty());
}
@@ -6795,12 +7112,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -6878,14 +7195,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}\n")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -6951,12 +7268,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -7006,14 +7323,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
webSourceRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -7081,12 +7398,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7154,12 +7471,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7226,12 +7543,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7261,12 +7578,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\","
+ " \"max_event_level_reports\": 21"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7295,12 +7612,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\","
+ " \"max_event_level_reports\": -3"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7330,12 +7647,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"source_event_id\": \"987654321\","
+ " \"max_event_level_reports\": \"3\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7372,12 +7689,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7413,12 +7730,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7454,12 +7771,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -7506,12 +7823,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -7554,12 +7871,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7591,12 +7908,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7628,12 +7945,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7665,12 +7982,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\"event_report_windows\":"
+ eventReportWindows
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7705,12 +8022,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7744,12 +8061,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7783,12 +8100,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7822,12 +8139,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -7874,12 +8191,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -7927,12 +8244,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ " \"post_install_exclusivity_window\": "
+ "\"987654\""
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -7974,12 +8291,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -8023,12 +8340,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -8068,12 +8385,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -8113,12 +8430,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ ","
+ " \"max_event_level_reports\": 5"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -8144,14 +8461,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"35\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
appSourceRegistrationRequestWithPostBody(request, POST_BODY),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(POST_BODY, outputStream.toString());
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -8176,14 +8493,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"35\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
appSourceRegistrationRequestWithPostBody(request, null),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -8209,7 +8526,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"35\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
String emptyPostBody = "";
@@ -8217,7 +8534,7 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
mFetcher.fetchSource(
appSourceRegistrationRequestWithPostBody(request, emptyPostBody),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(emptyPostBody, outputStream.toString());
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -8242,14 +8559,14 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ DEFAULT_DESTINATION
+ "\","
+ "\"source_event_id\":\"35\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
appSourceRegistrationRequestWithPostBody(request, POST_BODY),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -8276,12 +8593,12 @@ public final class AsyncSourceFetcherTest extends AdServicesExtendedMockitoTestC
+ "\","
+ "\"source_event_id\":\"35\","
+ "\"drop_source_if_installed\":true}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Source> fetch =
mFetcher.fetchSource(
- appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appSourceRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncTriggerFetcherTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncTriggerFetcherTest.java
index f22a19eb9c..41605bc539 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncTriggerFetcherTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/AsyncTriggerFetcherTest.java
@@ -145,6 +145,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
WebUtil.validUrl("https://subdomain.bar.test");
private static final String LOCATION_TYPE_REDIRECT_URI =
WebUtil.validUrl("https://example.test");
+ private static final String LOCATION_TYPE_REDIRECT_WELLKNOWN_URI =
+ WebUtil.validUrl(
+ LOCATION_TYPE_REDIRECT_URI
+ + "/"
+ + AsyncRedirects.WELL_KNOWN_PATH_SEGMENT
+ + "?"
+ + AsyncRedirects.WELL_KNOWN_QUERY_PARAM
+ + "="
+ + Uri.encode(LOCATION_TYPE_REDIRECT_URI));
private static final Uri REGISTRATION_URI_1 = WebUtil.validUri("https://subdomain.foo.test");
private static final WebTriggerParams TRIGGER_REGISTRATION_1 =
new WebTriggerParams.Builder(REGISTRATION_URI_1).setDebugKeyAllowed(true).build();
@@ -248,13 +257,13 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
List.of("{\"event_trigger_data\":" + EVENT_TRIGGERS_1 + "}")));
doReturn(5000L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
asyncFetchStatus.setRegistrationDelay(0L);
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -325,13 +334,13 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "}")));
doReturn(5000L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
asyncFetchStatus.setRegistrationDelay(0L);
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -385,12 +394,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -439,12 +448,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -488,12 +497,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -541,12 +550,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -590,12 +599,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -643,12 +652,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -692,12 +701,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -745,12 +754,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -792,12 +801,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregateDedupKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -816,34 +825,37 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map<String, List<String>> headers = getDefaultHeaders();
// Populate both 'list' and 'location' type headers
- headers.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
- headers.put("Location", List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headers);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertTriggerRegistration(asyncRegistration, result);
- assertEquals(2, asyncRedirect.getRedirects().size());
+ assertEquals(2, asyncRedirects.getRedirects().size());
assertEquals(
LIST_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LIST)
.get(0)
+ .getUri()
.toString());
assertEquals(
LOCATION_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LOCATION)
.get(0)
+ .getUri()
.toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -857,68 +869,295 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map<String, List<String>> headers = getDefaultHeaders();
// Populate only 'location' type header
- headers.put("Location", List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headers);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertTriggerRegistration(asyncRegistration, result);
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(LOCATION_TYPE_REDIRECT_URI, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
}
@Test
- public void testRedirectType_locationRedirectType_ignoresListType() throws Exception {
+ public void testRedirectType_locationRedirectType_acceptsListType() throws Exception {
RegistrationRequest request = buildRequest(TRIGGER_URI);
doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
when(mUrlConnection.getResponseCode()).thenReturn(302);
Map<String, List<String>> headers = getDefaultHeaders();
// Populate both 'list' and 'location' type headers
- headers.put("Attribution-Reporting-Redirect", List.of(LIST_TYPE_REDIRECT_URI));
- headers.put("Location", List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
when(mUrlConnection.getHeaderFields()).thenReturn(headers);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertTriggerRegistration(asyncRegistration, result);
- assertEquals(2, asyncRedirect.getRedirects().size());
+ assertEquals(2, asyncRedirects.getRedirects().size());
assertEquals(
LOCATION_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
+ .getRedirectsByType(AsyncRegistration.RedirectType.LOCATION)
+ .get(0)
+ .getUri()
+ .toString());
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI,
+ asyncRedirects
+ .getRedirectsByType(AsyncRegistration.RedirectType.LIST)
+ .get(0)
+ .getUri()
+ .toString());
+
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirectType_locationRedirectHeaderType_wellKnownPath() throws Exception {
+ RegistrationRequest request = buildRequest(TRIGGER_URI);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ // Populate only 'location' type header
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertTriggerRegistration(asyncRegistration, result);
+
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_WELLKNOWN_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
+
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirectType_locationRedirectType_wellKnownPath_acceptsList() throws Exception {
+ RegistrationRequest request = buildRequest(TRIGGER_URI);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertTriggerRegistration(asyncRegistration, result);
+
+ assertEquals(2, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_WELLKNOWN_URI,
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LOCATION)
.get(0)
+ .getUri()
.toString());
assertEquals(
LIST_TYPE_REDIRECT_URI,
- asyncRedirect
+ asyncRedirects
.getRedirectsByType(AsyncRegistration.RedirectType.LIST)
.get(0)
+ .getUri()
.toString());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
}
+ @Test
+ public void testWellKnownPathHeader_noop() throws Exception {
+ RegistrationRequest request = buildRequest(TRIGGER_URI);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ // Populate behavior config header, but no redirects.
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertTriggerRegistration(asyncRegistration, result);
+
+ assertEquals(0, asyncRedirects.getRedirects().size());
+
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testWellKnownPathHeader_acceptsListTypeWithNoLocationType() throws Exception {
+ RegistrationRequest request = buildRequest(TRIGGER_URI);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ // Populate behavior config header, but no Location type redirect.
+ headers.put(
+ AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG,
+ List.of(AsyncRedirects.REDIRECT_302_TO_WELL_KNOWN));
+ headers.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(LIST_TYPE_REDIRECT_URI));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertTriggerRegistration(asyncRegistration, result);
+
+ assertEquals(1, asyncRedirects.getRedirects().size());
+
+ assertEquals(
+ LIST_TYPE_REDIRECT_URI,
+ asyncRedirects
+ .getRedirectsByType(AsyncRegistration.RedirectType.LIST)
+ .get(0)
+ .getUri()
+ .toString());
+
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirectType_locationRedirectHeaderType_wellKnownHeaderMisconfigured()
+ throws Exception {
+ RegistrationRequest request = buildRequest(TRIGGER_URI);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG, List.of("BAD"));
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertTriggerRegistration(asyncRegistration, result);
+
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
+
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
+ @Test
+ public void testRedirectType_locationRedirectHeaderType_wellKnownHeaderNull() throws Exception {
+ RegistrationRequest request = buildRequest(TRIGGER_URI);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(TRIGGER_URI));
+ when(mUrlConnection.getResponseCode()).thenReturn(302);
+ when(mFlags.getMeasurementEnableRedirectToWellKnownPath()).thenReturn(true);
+ Map<String, List<String>> headers = getDefaultHeaders();
+
+ headers.put(
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY, List.of(LOCATION_TYPE_REDIRECT_URI));
+ headers.put(AsyncRedirects.HEADER_ATTRIBUTION_REPORTING_REDIRECT_CONFIG, null);
+
+ when(mUrlConnection.getHeaderFields()).thenReturn(headers);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertTriggerRegistration(asyncRegistration, result);
+
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(
+ LOCATION_TYPE_REDIRECT_URI,
+ asyncRedirects.getRedirects().get(0).getUri().toString());
+
+ verify(mUrlConnection, times(1)).setRequestMethod("POST");
+ }
+
// End tests for redirect types
@Test
@@ -935,12 +1174,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -966,12 +1205,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggers + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -991,12 +1230,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"debug_key\": \"" + DEBUG_KEY + "\"}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1021,12 +1260,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1055,12 +1294,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggers + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -1080,15 +1319,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1107,15 +1346,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1135,12 +1374,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1165,15 +1404,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1194,12 +1433,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1223,15 +1462,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1251,12 +1490,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1280,12 +1519,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1309,12 +1548,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1338,15 +1577,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1366,15 +1605,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1394,15 +1633,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1422,12 +1661,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1452,12 +1691,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1482,15 +1721,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1510,15 +1749,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1539,12 +1778,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1568,15 +1807,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1596,12 +1835,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1628,15 +1867,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1658,15 +1897,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1689,12 +1928,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1721,15 +1960,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1752,12 +1991,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1784,15 +2023,15 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
- assertEquals(AsyncFetchStatus.EntityStatus.VALIDATION_ERROR,
- asyncFetchStatus.getEntityStatus());
+ assertEquals(
+ AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -1815,12 +2054,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1845,12 +2084,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1875,12 +2114,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -1905,12 +2144,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -1935,12 +2174,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -1961,12 +2200,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -1995,12 +2234,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2021,12 +2260,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2047,12 +2286,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -2080,12 +2319,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2113,12 +2352,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2142,12 +2381,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2179,12 +2418,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2208,12 +2447,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + eventTriggerData + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2234,12 +2473,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -2265,12 +2504,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2289,12 +2528,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2325,12 +2564,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_deduplication_keys\":"
+ tooManyEntries
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2362,12 +2601,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_deduplication_keys\":"
+ deduplicationKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2421,12 +2660,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ ",\"aggregatable_deduplication_keys\":"
+ deduplicationKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2481,12 +2720,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_deduplication_keys\":"
+ deduplicationKeys
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2509,12 +2748,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ ","
+ "\"aggregatable_deduplication_keys\":{}"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2537,12 +2776,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ ","
+ "\"aggregatable_deduplication_keys\":"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2565,12 +2804,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2589,12 +2828,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2621,12 +2860,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2645,12 +2884,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2669,12 +2908,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
when(mFlags.getMeasurementEnableLookbackWindowFilter()).thenReturn(true);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2693,12 +2932,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
when(mFlags.getMeasurementEnableLookbackWindowFilter()).thenReturn(true);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2717,12 +2956,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
when(mFlags.getMeasurementEnableLookbackWindowFilter()).thenReturn(true);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2741,12 +2980,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\":" + filters + "}")));
when(mFlags.getMeasurementEnableLookbackWindowFilter()).thenReturn(true);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2767,12 +3006,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -2798,12 +3037,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2822,12 +3061,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2850,12 +3089,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2874,12 +3113,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2906,12 +3145,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2930,12 +3169,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"not_filters\":" + notFilters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
@@ -2956,21 +3195,21 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields())
.thenReturn(
Map.of(
- "Attribution-Reporting-Redirect",
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY,
List.of(DEFAULT_REDIRECT),
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + EVENT_TRIGGERS_1 + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
verify(mFetcher, times(1)).openUrl(any());
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(DEFAULT_REDIRECT, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(DEFAULT_REDIRECT, asyncRedirects.getRedirects().get(0).getUri().toString());
assertEquals(
AsyncFetchStatus.EntityStatus.INVALID_ENROLLMENT,
asyncFetchStatus.getEntityStatus());
@@ -2994,12 +3233,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3030,12 +3269,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -3062,12 +3301,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -3094,12 +3333,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -3126,12 +3365,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -3149,12 +3388,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
WebUtil.validUri("http://foo.test"),
CONTEXT.getPackageName(),
SDK_PACKAGE_NAME);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.INVALID_URL, asyncFetchStatus.getResponseStatus());
@@ -3178,11 +3417,11 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
false,
false,
null);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(registration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(registration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.INVALID_URL, asyncFetchStatus.getResponseStatus());
@@ -3195,12 +3434,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
doThrow(new IOException("Bad internet things"))
.when(mFetcher)
.openUrl(new URL(TRIGGER_URI));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.NETWORK_ERROR,
@@ -3219,12 +3458,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + EVENT_TRIGGERS_1 + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.ResponseStatus.SERVER_UNAVAILABLE,
@@ -3243,12 +3482,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\": [{}]}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3271,14 +3510,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
headersFirstRequest.put(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + EVENT_TRIGGERS_1 + "}"));
- headersFirstRequest.put("Attribution-Reporting-Redirect", List.of(DEFAULT_REDIRECT));
+ headersFirstRequest.put(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(DEFAULT_REDIRECT));
when(mUrlConnection.getHeaderFields()).thenReturn(headersFirstRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3298,21 +3537,22 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
doReturn(mUrlConnection).when(mFetcher).openUrl(any(URL.class));
when(mUrlConnection.getResponseCode()).thenReturn(200);
when(mUrlConnection.getHeaderFields())
- .thenReturn(Map.of("Attribution-Reporting-Redirect", List.of(DEFAULT_REDIRECT)))
+ .thenReturn(
+ Map.of(AsyncRedirects.REDIRECT_LIST_HEADER_KEY, List.of(DEFAULT_REDIRECT)))
.thenReturn(
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + EVENT_TRIGGERS_1 + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
- assertEquals(1, asyncRedirect.getRedirects().size());
- assertEquals(DEFAULT_REDIRECT, asyncRedirect.getRedirects().get(0).toString());
+ assertEquals(1, asyncRedirects.getRedirects().size());
+ assertEquals(DEFAULT_REDIRECT, asyncRedirects.getRedirects().get(0).getUri().toString());
assertEquals(
AsyncFetchStatus.EntityStatus.HEADER_MISSING, asyncFetchStatus.getEntityStatus());
@@ -3342,12 +3582,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregateTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3383,12 +3623,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregateTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.PARSING_ERROR, asyncFetchStatus.getEntityStatus());
@@ -3418,12 +3658,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregateTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3460,12 +3700,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregateTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3504,12 +3744,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"{\"aggregatable_trigger_data\":"
+ aggregateTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -3543,12 +3783,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"{\"aggregatable_trigger_data\":"
+ aggregateTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -3572,12 +3812,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3603,12 +3843,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"aggregatable_values\": " + tooManyKeys + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
@@ -3632,12 +3872,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"filters\": " + filters + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3668,14 +3908,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection1.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3722,14 +3962,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -3758,24 +3998,24 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\": " + EVENT_TRIGGERS_1 + "}"),
- "Attribution-Reporting-Redirect",
+ AsyncRedirects.REDIRECT_LIST_HEADER_KEY,
List.of(LIST_TYPE_REDIRECT_URI),
- "Location",
+ AsyncRedirects.REDIRECT_LOCATION_HEADER_KEY,
List.of(LOCATION_TYPE_REDIRECT_URI)));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
- assertEquals(0, asyncRedirect.getRedirects().size());
+ assertEquals(0, asyncRedirects.getRedirects().size());
assertEquals(new JSONArray(EVENT_TRIGGERS_1).toString(), result.getEventTriggers());
assertEquals(REGISTRATION_URI_1, result.getRegistrationOrigin());
verify(mUrlConnection).setRequestMethod("POST");
@@ -3802,11 +4042,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
- Optional<Trigger> fetch = mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -3833,12 +4074,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -3867,12 +4108,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -3907,12 +4148,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -3942,12 +4183,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -3974,12 +4215,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4016,12 +4257,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4049,12 +4290,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4082,12 +4323,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -4118,12 +4359,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4157,12 +4398,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4191,12 +4432,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4234,12 +4475,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4268,12 +4509,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4307,12 +4548,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4342,12 +4583,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4385,12 +4626,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4420,12 +4661,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_trigger_data\": "
+ aggregatableTriggerData
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4447,12 +4688,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -4479,12 +4720,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -4511,12 +4752,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -4543,12 +4784,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -4572,12 +4813,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -4603,12 +4844,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
@@ -4633,12 +4874,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
@@ -4662,12 +4903,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
@@ -4692,12 +4933,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
@@ -4721,12 +4962,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
@@ -4753,12 +4994,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
@@ -4784,12 +5025,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
@@ -4816,12 +5057,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertEquals(
AsyncFetchStatus.EntityStatus.VALIDATION_ERROR, asyncFetchStatus.getEntityStatus());
assertFalse(fetch.isPresent());
@@ -4847,12 +5088,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
@@ -4876,12 +5117,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4905,12 +5146,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{\"aggregatable_values\": " + tooManyKeys + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4932,12 +5173,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\"aggregatable_values\": "
+ aggregatableValues
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
- appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirect);
+ appTriggerRegistrationRequest(request), asyncFetchStatus, asyncRedirects);
assertFalse(fetch.isPresent());
verify(mUrlConnection, times(1)).setRequestMethod("POST");
verify(mFetcher, times(1)).openUrl(any());
@@ -4970,14 +5211,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
"Attribution-Reporting-Register-Trigger",
List.of("{\"event_trigger_data\":" + EVENT_TRIGGERS_1 + "}")));
doReturn(5L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
asyncFetchStatus.setRegistrationDelay(0L);
asyncFetchStatus.setRetryCount(0);
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
assertEquals(ENROLLMENT_ID, result.getEnrollmentId());
@@ -5073,7 +5314,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
attributionConfig1.serializeAsJson(mFlags),
attributionConfig2.serializeAsJson(mFlags)));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
@@ -5081,7 +5322,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5180,7 +5421,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
attributionConfig1.serializeAsJson(mFlags),
attributionConfig2.serializeAsJson(mFlags)));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = webTriggerRegistrationRequest(request, true);
@@ -5188,7 +5429,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5245,7 +5486,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "}")));
doReturn(5000L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = webTriggerRegistrationRequest(request, true);
@@ -5253,7 +5494,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5289,7 +5530,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, new AsyncRedirect());
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, new AsyncRedirects());
// Assertion
assertEquals(
@@ -5318,7 +5559,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "}")));
doReturn(5000L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
@@ -5326,7 +5567,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5361,7 +5602,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "}")));
doReturn(5000L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
@@ -5369,7 +5610,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5426,7 +5667,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "}")));
doReturn(5000L).when(mFlags).getMaxResponseBasedRegistrationPayloadSizeBytes();
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
@@ -5434,7 +5675,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
@@ -5469,14 +5710,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection1.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5514,14 +5755,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection1.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5552,12 +5793,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -5591,12 +5832,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -5627,12 +5868,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5665,12 +5906,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5702,12 +5943,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequestWithAdId(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertTrue(fetch.isPresent());
Trigger result = fetch.get();
@@ -5742,14 +5983,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection1.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5786,14 +6027,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection1.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5829,14 +6070,14 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection1.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
// Execution
Optional<Trigger> fetch =
mFetcher.fetchTrigger(
webTriggerRegistrationRequest(request, true),
asyncFetchStatus,
- asyncRedirect);
+ asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5847,7 +6088,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
}
@Test
- public void fetchTrigger_setsFakeEnrollmentId_whenDisableEnrollmentFlagIsTrue()
+ public void fetchTrigger_setsSiteEnrollmentId_whenDisableEnrollmentFlagIsTrue()
throws Exception {
String uri = WebUtil.validUrl("https://test1.example.test:8081");
RegistrationRequest request = buildRequest(uri);
@@ -5866,12 +6107,12 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "\""
+ "}"));
when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertTrue(fetch.isPresent());
@@ -5879,7 +6120,85 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
assertEquals(
WebUtil.validUrl("https://test1.example.test:8081"),
result.getRegistrationOrigin().toString());
- assertEquals(Enrollment.FAKE_ENROLLMENT, result.getEnrollmentId());
+ assertEquals("https://example.com", result.getEnrollmentId());
+ assertEquals(new JSONArray(EVENT_TRIGGERS_1).toString(), result.getEventTriggers());
+ assertEquals(DEBUG_KEY, result.getDebugKey());
+ verify(mUrlConnection).setRequestMethod("POST");
+ }
+
+ @Test
+ public void fetchTrigger_setsSiteEnrollmentId_whenDisableEnrollmentFlagIsTrueForLocalhost()
+ throws Exception {
+ String uri = WebUtil.validUrl("https://localhost:8081");
+ RegistrationRequest request = buildRequest(uri);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(uri));
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ doReturn(true).when(mFlags).isDisableMeasurementEnrollmentCheck();
+ Map<String, List<String>> headersRequest = new HashMap<>();
+ headersRequest.put(
+ "Attribution-Reporting-Register-Trigger",
+ List.of(
+ "{"
+ + "\"event_trigger_data\": "
+ + EVENT_TRIGGERS_1
+ + ", \"debug_key\": \""
+ + DEBUG_KEY
+ + "\""
+ + "}"));
+ when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertEquals(
+ WebUtil.validUrl("https://localhost:8081"),
+ result.getRegistrationOrigin().toString());
+ assertEquals("https://localhost", result.getEnrollmentId());
+ assertEquals(new JSONArray(EVENT_TRIGGERS_1).toString(), result.getEventTriggers());
+ assertEquals(DEBUG_KEY, result.getDebugKey());
+ verify(mUrlConnection).setRequestMethod("POST");
+ }
+
+ @Test
+ public void fetchTrigger_setsSiteEnrollmentId_whenDisableEnrollmentFlagIsTrueForIP()
+ throws Exception {
+ String uri = WebUtil.validUrl("https://127.0.0.1:8081");
+ RegistrationRequest request = buildRequest(uri);
+ doReturn(mUrlConnection).when(mFetcher).openUrl(new URL(uri));
+ when(mUrlConnection.getResponseCode()).thenReturn(200);
+ doReturn(true).when(mFlags).isDisableMeasurementEnrollmentCheck();
+ Map<String, List<String>> headersRequest = new HashMap<>();
+ headersRequest.put(
+ "Attribution-Reporting-Register-Trigger",
+ List.of(
+ "{"
+ + "\"event_trigger_data\": "
+ + EVENT_TRIGGERS_1
+ + ", \"debug_key\": \""
+ + DEBUG_KEY
+ + "\""
+ + "}"));
+ when(mUrlConnection.getHeaderFields()).thenReturn(headersRequest);
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
+ AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
+ AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
+ // Execution
+ Optional<Trigger> fetch =
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
+ // Assertion
+ assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
+ assertTrue(fetch.isPresent());
+ Trigger result = fetch.get();
+ assertEquals(
+ WebUtil.validUrl("https://127.0.0.1:8081"),
+ result.getRegistrationOrigin().toString());
+ assertEquals("https://127.0.0.1", result.getEnrollmentId());
assertEquals(new JSONArray(EVENT_TRIGGERS_1).toString(), result.getEventTriggers());
assertEquals(DEBUG_KEY, result.getDebugKey());
verify(mUrlConnection).setRequestMethod("POST");
@@ -5900,7 +6219,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "'aggregation_coordinator_origin': "
+ "'https://cloud.coordination.test'"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
when(mFlags.getMeasurementAggregationCoordinatorOriginEnabled()).thenReturn(true);
@@ -5908,7 +6227,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
.thenReturn("https://cloud.coordination.test");
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(AsyncFetchStatus.EntityStatus.SUCCESS, asyncFetchStatus.getEntityStatus());
@@ -5941,7 +6260,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "'aggregation_coordinator_origin': "
+ "'https://invalid.cloud.coordination.test'"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
when(mFlags.getMeasurementAggregationCoordinatorOriginEnabled()).thenReturn(true);
@@ -5949,7 +6268,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
.thenReturn("https://cloud.coordination.test");
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -5968,13 +6287,13 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
Map.of(
"Attribution-Reporting-Register-Trigger",
List.of("{" + "\"event_trigger_data\": " + "[{}]" + "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
when(mFlags.getMeasurementAggregationCoordinatorOriginEnabled()).thenReturn(true);
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(AsyncFetchStatus.EntityStatus.SUCCESS, asyncFetchStatus.getEntityStatus());
@@ -6005,7 +6324,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
+ "'aggregation_coordinator_origin': "
+ "'https://invalid.cloud.coordination.test'"
+ "}")));
- AsyncRedirect asyncRedirect = new AsyncRedirect();
+ AsyncRedirects asyncRedirects = new AsyncRedirects();
AsyncFetchStatus asyncFetchStatus = new AsyncFetchStatus();
AsyncRegistration asyncRegistration = appTriggerRegistrationRequest(request);
when(mFlags.getMeasurementAggregationCoordinatorOriginEnabled()).thenReturn(true);
@@ -6013,7 +6332,7 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
.thenReturn("https://cloud.coordination.test");
// Execution
Optional<Trigger> fetch =
- mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirect);
+ mFetcher.fetchTrigger(asyncRegistration, asyncFetchStatus, asyncRedirects);
// Assertion
assertEquals(AsyncFetchStatus.ResponseStatus.SUCCESS, asyncFetchStatus.getResponseStatus());
assertEquals(
@@ -6050,26 +6369,6 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
private static AsyncRegistration appTriggerRegistrationRequest(
RegistrationRequest registrationRequest) {
- // Necessary for testing
- String enrollmentId = "";
- if (EnrollmentDao.getInstance(CONTEXT)
- .getEnrollmentDataFromMeasurementUrl(
- registrationRequest
- .getRegistrationUri()
- .buildUpon()
- .clearQuery()
- .build())
- != null) {
- enrollmentId =
- EnrollmentDao.getInstance(CONTEXT)
- .getEnrollmentDataFromMeasurementUrl(
- registrationRequest
- .getRegistrationUri()
- .buildUpon()
- .clearQuery()
- .build())
- .getEnrollmentId();
- }
return createAsyncRegistration(
UUID.randomUUID().toString(),
registrationRequest.getRegistrationUri(),
@@ -6091,26 +6390,6 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
private static AsyncRegistration appTriggerRegistrationRequestWithAdId(
RegistrationRequest registrationRequest) {
- // Necessary for testing
- String enrollmentId = "";
- if (EnrollmentDao.getInstance(CONTEXT)
- .getEnrollmentDataFromMeasurementUrl(
- registrationRequest
- .getRegistrationUri()
- .buildUpon()
- .clearQuery()
- .build())
- != null) {
- enrollmentId =
- EnrollmentDao.getInstance(CONTEXT)
- .getEnrollmentDataFromMeasurementUrl(
- registrationRequest
- .getRegistrationUri()
- .buildUpon()
- .clearQuery()
- .build())
- .getEnrollmentId();
- }
return createAsyncRegistration(
UUID.randomUUID().toString(),
registrationRequest.getRegistrationUri(),
@@ -6136,28 +6415,6 @@ public final class AsyncTriggerFetcherTest extends AdServicesExtendedMockitoTest
if (webTriggerRegistrationRequest.getTriggerParams().size() > 0) {
WebTriggerParams webTriggerParams =
webTriggerRegistrationRequest.getTriggerParams().get(0);
- // Necessary for testing
- String enrollmentId = "";
- if (EnrollmentDao.getInstance(CONTEXT)
- .getEnrollmentDataFromMeasurementUrl(
- webTriggerRegistrationRequest
- .getTriggerParams()
- .get(0)
- .getRegistrationUri()
- .buildUpon()
- .clearQuery()
- .build())
- != null) {
- enrollmentId =
- EnrollmentDao.getInstance(CONTEXT)
- .getEnrollmentDataFromMeasurementUrl(
- webTriggerParams
- .getRegistrationUri()
- .buildUpon()
- .clearQuery()
- .build())
- .getEnrollmentId();
- }
return createAsyncRegistration(
UUID.randomUUID().toString(),
webTriggerParams.getRegistrationUri(),
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/EnqueueAsyncRegistrationTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/EnqueueAsyncRegistrationTest.java
index 847dc6ab3a..7b6e78903d 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/EnqueueAsyncRegistrationTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/registration/EnqueueAsyncRegistrationTest.java
@@ -243,6 +243,8 @@ public class EnqueueAsyncRegistrationTest {
Assert.assertNotNull(asyncRegistration.getType());
Assert.assertEquals(
AsyncRegistration.RegistrationType.APP_SOURCE, asyncRegistration.getType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration.getRedirectBehavior());
}
}
@@ -300,6 +302,8 @@ public class EnqueueAsyncRegistrationTest {
Assert.assertNotNull(asyncRegistration.getType());
Assert.assertEquals(
AsyncRegistration.RegistrationType.APP_SOURCE, asyncRegistration.getType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration.getRedirectBehavior());
}
}
@@ -390,6 +394,8 @@ public class EnqueueAsyncRegistrationTest {
Assert.assertEquals(
Uri.parse("android-app://test.destination"), asyncRegistration.getRegistrant());
Assert.assertNull(asyncRegistration.getSourceType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration.getRedirectBehavior());
}
}
@@ -523,6 +529,8 @@ public class EnqueueAsyncRegistrationTest {
VALID_WEB_SOURCE_REGISTRATION_NULL_INPUT_EVENT.getTopOriginUri(),
asyncRegistration1.getTopOrigin());
assertEqualsWebSourceRegistrationCommon(asyncRegistration1);
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration1.getRedirectBehavior());
Assert.assertTrue(cursor.moveToNext());
AsyncRegistration asyncRegistration2 =
@@ -533,6 +541,8 @@ public class EnqueueAsyncRegistrationTest {
VALID_WEB_SOURCE_REGISTRATION_NULL_INPUT_EVENT.getTopOriginUri(),
asyncRegistration2.getTopOrigin());
assertEqualsWebSourceRegistrationCommon(asyncRegistration2);
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration2.getRedirectBehavior());
Assert.assertEquals(
asyncRegistration1.getRegistrationId(),
@@ -591,6 +601,8 @@ public class EnqueueAsyncRegistrationTest {
validWebSourceRegistration.getTopOriginUri(),
asyncRegistration1.getTopOrigin());
assertEqualsWebSourceRegistrationCommon(asyncRegistration1);
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration1.getRedirectBehavior());
Assert.assertTrue(cursor.moveToNext());
AsyncRegistration asyncRegistration2 =
@@ -601,6 +613,8 @@ public class EnqueueAsyncRegistrationTest {
validWebSourceRegistration.getTopOriginUri(),
asyncRegistration2.getTopOrigin());
assertEqualsWebSourceRegistrationCommon(asyncRegistration2);
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration2.getRedirectBehavior());
Assert.assertEquals(
asyncRegistration1.getRegistrationId(),
@@ -642,12 +656,16 @@ public class EnqueueAsyncRegistrationTest {
SqliteObjectMapper.constructAsyncRegistration(cursor);
Assert.assertEquals(REGISTRATION_URI_1, asyncRegistration1.getRegistrationUri());
assertEqualsWebTriggerRegistrationCommon(asyncRegistration1);
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration1.getRedirectBehavior());
Assert.assertTrue(cursor.moveToNext());
AsyncRegistration asyncRegistration2 =
SqliteObjectMapper.constructAsyncRegistration(cursor);
Assert.assertEquals(REGISTRATION_URI_2, asyncRegistration2.getRegistrationUri());
assertEqualsWebTriggerRegistrationCommon(asyncRegistration2);
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration2.getRedirectBehavior());
Assert.assertEquals(
asyncRegistration1.getRegistrationId(),
@@ -656,7 +674,7 @@ public class EnqueueAsyncRegistrationTest {
}
@Test
- public void testRunInTransactionFail_inValid() {
+ public void testRunInTransactionFail_invalid() {
when(mDatastoreManagerMock.runInTransaction(any())).thenReturn(false);
Assert.assertFalse(
EnqueueAsyncRegistration.webTriggerRegistrationRequest(
@@ -722,6 +740,8 @@ public class EnqueueAsyncRegistrationTest {
Assert.assertNotNull(asyncRegistration.getType());
Assert.assertEquals(
AsyncRegistration.RegistrationType.APP_SOURCE, asyncRegistration.getType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration.getRedirectBehavior());
}
}
@@ -773,6 +793,8 @@ public class EnqueueAsyncRegistrationTest {
assertEqualsAppSourcesRegistrationCommon(asyncRegistration1);
Assert.assertEquals(REGISTRATION_URI_1, asyncRegistration1.getRegistrationUri());
Assert.assertEquals(Source.SourceType.EVENT, asyncRegistration1.getSourceType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration1.getRedirectBehavior());
Assert.assertTrue(cursor.moveToNext());
AsyncRegistration asyncRegistration2 =
@@ -780,6 +802,8 @@ public class EnqueueAsyncRegistrationTest {
assertEqualsAppSourcesRegistrationCommon(asyncRegistration2);
Assert.assertEquals(REGISTRATION_URI_2, asyncRegistration2.getRegistrationUri());
Assert.assertEquals(Source.SourceType.EVENT, asyncRegistration2.getSourceType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration2.getRedirectBehavior());
Assert.assertEquals(
asyncRegistration1.getRegistrationId(), asyncRegistration2.getRegistrationId());
@@ -835,6 +859,8 @@ public class EnqueueAsyncRegistrationTest {
assertEqualsAppSourcesRegistrationCommon(asyncRegistration1);
Assert.assertEquals(REGISTRATION_URI_1, asyncRegistration1.getRegistrationUri());
Assert.assertEquals(Source.SourceType.NAVIGATION, asyncRegistration1.getSourceType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration1.getRedirectBehavior());
Assert.assertTrue(cursor.moveToNext());
AsyncRegistration asyncRegistration2 =
@@ -842,6 +868,8 @@ public class EnqueueAsyncRegistrationTest {
assertEqualsAppSourcesRegistrationCommon(asyncRegistration2);
Assert.assertEquals(REGISTRATION_URI_2, asyncRegistration2.getRegistrationUri());
Assert.assertEquals(Source.SourceType.NAVIGATION, asyncRegistration2.getSourceType());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration2.getRedirectBehavior());
Assert.assertEquals(
asyncRegistration1.getRegistrationId(), asyncRegistration2.getRegistrationId());
@@ -898,6 +926,8 @@ public class EnqueueAsyncRegistrationTest {
Assert.assertEquals(REGISTRATION_URI_1, asyncRegistration1.getRegistrationUri());
Assert.assertEquals(Source.SourceType.NAVIGATION, asyncRegistration1.getSourceType());
Assert.assertNull(asyncRegistration1.getPostBody());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration1.getRedirectBehavior());
Assert.assertTrue(cursor.moveToNext());
AsyncRegistration asyncRegistration2 =
@@ -906,6 +936,8 @@ public class EnqueueAsyncRegistrationTest {
Assert.assertEquals(REGISTRATION_URI_2, asyncRegistration2.getRegistrationUri());
Assert.assertEquals(Source.SourceType.NAVIGATION, asyncRegistration2.getSourceType());
Assert.assertNull(asyncRegistration2.getPostBody());
+ Assert.assertEquals(
+ AsyncRedirect.RedirectBehavior.AS_IS, asyncRegistration2.getRedirectBehavior());
Assert.assertEquals(
asyncRegistration1.getRegistrationId(), asyncRegistration2.getRegistrationId());
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/AggregateReportingJobHandlerTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/AggregateReportingJobHandlerTest.java
index e5700638e2..fd7668d937 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/AggregateReportingJobHandlerTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/AggregateReportingJobHandlerTest.java
@@ -54,6 +54,7 @@ import com.android.adservices.service.measurement.aggregation.AggregateCryptoFix
import com.android.adservices.service.measurement.aggregation.AggregateEncryptionKey;
import com.android.adservices.service.measurement.aggregation.AggregateEncryptionKeyManager;
import com.android.adservices.service.measurement.aggregation.AggregateReport;
+import com.android.adservices.service.measurement.aggregation.AggregateReportFixture;
import com.android.adservices.service.measurement.util.UnsignedLong;
import com.android.adservices.service.stats.AdServicesLogger;
import com.android.adservices.service.stats.MeasurementReportsStats;
@@ -989,6 +990,164 @@ public class AggregateReportingJobHandlerTest {
verify(mTransaction, times(1)).end();
}
+ @Test
+ public void performReport_normalReportWithDebugKeys_hasDebugModeEnabled()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.SOURCE_DEBUG_KEY)
+ .setTriggerDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.TRIGGER_DEBUG_KEY)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyAggregateReportingJobHandler, "enabled");
+ verify(mMeasurementDao, times(1))
+ .markAggregateReportStatus(
+ eq(aggregateReport.getId()), eq(AggregateReport.Status.DELIVERED));
+ }
+
+ @Test
+ public void performReport_normalReportWithOnlySourceDebugKey_hasDebugModeNull()
+ throws DatastoreException, IOException, JSONException {
+ // Setup
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.SOURCE_DEBUG_KEY)
+ .setTriggerDebugKey(null)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyAggregateReportingJobHandler, "");
+ verify(mMeasurementDao, times(1))
+ .markAggregateReportStatus(
+ eq(aggregateReport.getId()), eq(AggregateReport.Status.DELIVERED));
+ }
+
+ @Test
+ public void performReport_normalReportWithOnlyTriggerDebugKey_hasDebugModeNull()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(null)
+ .setTriggerDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.TRIGGER_DEBUG_KEY)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyAggregateReportingJobHandler, "");
+ verify(mMeasurementDao, times(1))
+ .markAggregateReportStatus(
+ eq(aggregateReport.getId()), eq(AggregateReport.Status.DELIVERED));
+ }
+
+ @Test
+ public void performReport_normalReportWithNoDebugKey_hasDebugModeNull()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(null)
+ .setTriggerDebugKey(null)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyAggregateReportingJobHandler, "");
+ verify(mMeasurementDao, times(1))
+ .markAggregateReportStatus(
+ eq(aggregateReport.getId()), eq(AggregateReport.Status.DELIVERED));
+ }
+
+ @Test
+ public void performReport_debugReportWithDebugKeys_hasDebugModeEnabled()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.SOURCE_DEBUG_KEY)
+ .setTriggerDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.TRIGGER_DEBUG_KEY)
+ .build();
+ executeDebugModeVerification(
+ aggregateReport, mSpyDebugAggregateReportingJobHandler, "enabled");
+ verify(mMeasurementDao, times(1))
+ .markAggregateDebugReportDelivered(eq(aggregateReport.getId()));
+ }
+
+ @Test
+ public void performReport_debugReportWithOnlySourceDebugKey_hasDebugModeNull()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.SOURCE_DEBUG_KEY)
+ .setTriggerDebugKey(null)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyDebugAggregateReportingJobHandler, "");
+ verify(mMeasurementDao, times(1))
+ .markAggregateDebugReportDelivered(eq(aggregateReport.getId()));
+ }
+
+ @Test
+ public void performReport_debugReportWithOnlyTriggerDebugKey_hasDebugModeNull()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(null)
+ .setTriggerDebugKey(
+ AggregateReportFixture.ValidAggregateReportParams.TRIGGER_DEBUG_KEY)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyDebugAggregateReportingJobHandler, "");
+ }
+
+ @Test
+ public void performReport_debugReportWithNoDebugKey_hasDebugModeNull()
+ throws DatastoreException, IOException, JSONException {
+ AggregateReport aggregateReport =
+ AggregateReportFixture.getValidAggregateReportBuilder()
+ .setSourceDebugKey(null)
+ .setTriggerDebugKey(null)
+ .build();
+ executeDebugModeVerification(aggregateReport, mSpyDebugAggregateReportingJobHandler, "");
+ verify(mMeasurementDao, times(1))
+ .markAggregateDebugReportDelivered(eq(aggregateReport.getId()));
+ }
+
+ private void executeDebugModeVerification(
+ AggregateReport aggregateReport,
+ AggregateReportingJobHandler aggregateReportingJobHandler,
+ String expectedDebugMode)
+ throws DatastoreException, IOException, JSONException {
+ when(mMeasurementDao.getAggregateReport(aggregateReport.getId()))
+ .thenReturn(aggregateReport);
+ doReturn(HttpURLConnection.HTTP_OK)
+ .when(aggregateReportingJobHandler)
+ .makeHttpPostRequest(eq(REPORTING_URI), Mockito.any());
+
+ doNothing()
+ .when(mMeasurementDao)
+ .markAggregateReportStatus(
+ aggregateReport.getId(), AggregateReport.Status.DELIVERED);
+ ArgumentCaptor<JSONObject> aggregateReportBodyCaptor =
+ ArgumentCaptor.forClass(JSONObject.class);
+
+ // Execution
+ Assert.assertEquals(
+ AdServicesStatusUtils.STATUS_SUCCESS,
+ aggregateReportingJobHandler.performReport(
+ aggregateReport.getId(),
+ AggregateCryptoFixture.getKey(),
+ new ReportingStatus()));
+
+ // Assertion
+ verify(aggregateReportingJobHandler)
+ .makeHttpPostRequest(eq(REPORTING_URI), aggregateReportBodyCaptor.capture());
+ verify(mTransaction, times(2)).begin();
+ verify(mTransaction, times(2)).end();
+
+ JSONObject aggregateReportBody = aggregateReportBodyCaptor.getValue();
+ JSONObject sharedInfo =
+ new JSONObject(
+ aggregateReportBody.getString(
+ AggregateReportBody.PayloadBodyKeys.SHARED_INFO));
+ assertEquals(
+ expectedDebugMode,
+ sharedInfo.optString(AggregateReportBody.SharedInfoKeys.DEBUG_MODE));
+ }
+
private static JSONObject createASampleAggregateReportBody(AggregateReport aggregateReport)
throws JSONException {
return new AggregateReportBody.Builder()
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/DebugReportApiTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/DebugReportApiTest.java
index 8e1a178aba..5656ba0079 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/DebugReportApiTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/DebugReportApiTest.java
@@ -92,6 +92,12 @@ public final class DebugReportApiTest {
when(mFlags.getMeasurementEnableDebugReport()).thenReturn(true);
when(mFlags.getMeasurementEnableSourceDebugReport()).thenReturn(true);
when(mFlags.getMeasurementEnableTriggerDebugReport()).thenReturn(true);
+ when(mFlags.getMeasurementVtcConfigurableMaxEventReportsCount())
+ .thenReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT);
+ when(mFlags.getMeasurementEventReportsVtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS);
+ when(mFlags.getMeasurementEventReportsCtcEarlyReportingWindows())
+ .thenReturn(Flags.MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS);
}
@Test
@@ -3650,6 +3656,194 @@ public final class DebugReportApiTest {
verify(mMeasurementDao, never()).insertDebugReport(any());
}
+ @Test
+ public void testScheduleTriggerEventWindowNotStartedDebugReport_triggerNotOpIn_dontSchedule()
+ throws Exception {
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ Trigger trigger =
+ TriggerFixture.getValidTriggerBuilder()
+ .setIsDebugReporting(false)
+ .setAdIdPermission(true)
+ .build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, never()).insertDebugReport(any());
+ }
+
+ @Test
+ public void testScheduleTriggerEventWindowNotStartedDebugReport_sourceNoAdId_dontSchedule()
+ throws Exception {
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setAdIdPermission(false)
+ .build();
+ Trigger trigger =
+ TriggerFixture.getValidTriggerBuilder()
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, never()).insertDebugReport(any());
+ }
+
+ @Test
+ public void testScheduleTriggerEventWindowNotStartedDebugReport_sourceNoArDebug_dontSchedule()
+ throws Exception {
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setPublisherType(EventSurfaceType.WEB)
+ .setPublisher(SourceFixture.ValidSourceParams.WEB_PUBLISHER)
+ .setAppDestinations(null)
+ .setWebDestinations(SourceFixture.ValidSourceParams.WEB_DESTINATIONS)
+ .setArDebugPermission(false)
+ .build();
+ Trigger trigger =
+ TriggerFixture.getValidTriggerBuilder()
+ .setIsDebugReporting(true)
+ .setDestinationType(EventSurfaceType.WEB)
+ .setAttributionDestination(
+ SourceFixture.ValidSourceParams.WEB_DESTINATIONS.get(0))
+ .setArDebugPermission(true)
+ .build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, never()).insertDebugReport(any());
+ }
+
+ @Test
+ public void testScheduleTriggerEventWindowNotStartedDebugReport_success() throws Exception {
+ Source source =
+ SourceFixture.getValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ Trigger trigger =
+ TriggerFixture.getValidTriggerBuilder()
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, times(1)).insertDebugReport(any());
+ }
+
+ @Test
+ public void testScheduleTriggerEventWindowNotStartedDebugReport_debugFlagDisabled_dontSchedule()
+ throws Exception {
+ when(mFlags.getMeasurementEnableDebugReport()).thenReturn(false);
+ Source source =
+ SourceFixture.getValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ Trigger trigger =
+ TriggerFixture.getValidTriggerBuilder()
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, never()).insertDebugReport(any());
+ }
+
+ @Test
+ public void
+ testScheduleTriggerEventWindowNotStartedDebugReport_triggerFlagDisabled_dontSchedule()
+ throws Exception {
+ when(mFlags.getMeasurementEnableTriggerDebugReport()).thenReturn(false);
+ Source source =
+ SourceFixture.getValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ Trigger trigger =
+ TriggerFixture.getValidTriggerBuilder()
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, never()).insertDebugReport(any());
+ }
+
+ @Test
+ public void
+ testScheduleTriggerEventWindowNotStartedDebugReport_noTriggerPermission_dontSchedule()
+ throws Exception {
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setEventId(SOURCE_EVENT_ID)
+ .setIsDebugReporting(true)
+ .setAdIdPermission(true)
+ .build();
+ Trigger trigger = TriggerFixture.getValidTriggerBuilder().setIsDebugReporting(true).build();
+ ExtendedMockito.doNothing()
+ .when(() -> VerboseDebugReportingJobService.scheduleIfNeeded(any(), anyBoolean()));
+
+ mDebugReportApi.scheduleTriggerDebugReport(
+ source,
+ trigger,
+ /* limit =*/ null,
+ mMeasurementDao,
+ DebugReportApi.Type.TRIGGER_EVENT_REPORT_WINDOW_NOT_STARTED);
+ verify(mMeasurementDao, never()).insertDebugReport(any());
+ }
+
private static void assertSourceDebugReportParameters(
DebugReport actualReport,
String expectedReportType,
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportWindowCalcDelegateTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportWindowCalcDelegateTest.java
index 713ce8e982..756c5434cd 100644
--- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportWindowCalcDelegateTest.java
+++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportWindowCalcDelegateTest.java
@@ -61,6 +61,9 @@ public class EventReportWindowCalcDelegateTest {
private static final String EVENT_REPORT_WINDOWS_2_WINDOWS_NO_START =
"{'end_times': [172800000, 432000000]}";
+ private static final String EVENT_REPORT_WINDOWS_2_WINDOWS_WITH_START =
+ "{ 'start_time': 3600000, 'end_times': [86400000, 1728000000]}";
+
private static final String EVENT_REPORT_WINDOWS_5_WINDOWS_WITH_START =
"{'start_time': 86400000, 'end_times': [172800000, 432000000, 604800000, 864000000,"
+ " 1728000000]}";
@@ -71,9 +74,14 @@ public class EventReportWindowCalcDelegateTest {
@Before
public void setup() {
- doReturn(false).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS)
.when(mFlags).getMeasurementMinEventReportDelayMillis();
+ doReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT)
+ .when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
+ doReturn(Flags.MEASUREMENT_EVENT_REPORTS_VTC_EARLY_REPORTING_WINDOWS)
+ .when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
+ doReturn(Flags.MEASUREMENT_EVENT_REPORTS_CTC_EARLY_REPORTING_WINDOWS)
+ .when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
mEventReportWindowCalcDelegate = new EventReportWindowCalcDelegate(mFlags);
}
@@ -85,6 +93,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -104,6 +113,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -121,6 +131,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -141,6 +152,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -159,6 +171,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -177,6 +190,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -195,6 +209,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -212,6 +227,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -231,6 +247,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -250,6 +267,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -267,6 +285,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -278,6 +297,9 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void testMaxReportCount() {
+ doReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT)
+ .when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
+
Source eventSourceInstallNotAttributed =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
@@ -285,12 +307,7 @@ public class EventReportWindowCalcDelegateTest {
.build();
assertEquals(
PrivacyParams.EVENT_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(
- eventSourceInstallNotAttributed, false));
- assertEquals(
- PrivacyParams.EVENT_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(
- eventSourceInstallNotAttributed, false));
+ mEventReportWindowCalcDelegate.getMaxReportCount(eventSourceInstallNotAttributed));
Source navigationSourceInstallNotAttributed =
SourceFixture.getMinimalValidSourceBuilder()
@@ -300,46 +317,33 @@ public class EventReportWindowCalcDelegateTest {
assertEquals(
PrivacyParams.NAVIGATION_SOURCE_MAX_REPORTS,
mEventReportWindowCalcDelegate.getMaxReportCount(
- navigationSourceInstallNotAttributed, false));
- assertEquals(
- PrivacyParams.NAVIGATION_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(
- navigationSourceInstallNotAttributed, false));
+ navigationSourceInstallNotAttributed));
Source eventSourceInstallAttributed =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setInstallAttributed(true)
+ .setInstallCooldownWindow(1L)
.build();
assertEquals(
PrivacyParams.INSTALL_ATTR_EVENT_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(
- eventSourceInstallAttributed, true));
- // Install attribution state does not matter for web destination
- assertEquals(
- PrivacyParams.EVENT_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(
- eventSourceInstallAttributed, false));
+ mEventReportWindowCalcDelegate.getMaxReportCount(eventSourceInstallAttributed));
Source navigationSourceInstallAttributed =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setInstallAttributed(true)
+ .setInstallCooldownWindow(1L)
.build();
assertEquals(
PrivacyParams.NAVIGATION_SOURCE_MAX_REPORTS,
mEventReportWindowCalcDelegate.getMaxReportCount(
- navigationSourceInstallAttributed, true));
- assertEquals(
- PrivacyParams.NAVIGATION_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(
- navigationSourceInstallAttributed, true));
+ navigationSourceInstallAttributed));
}
@Test
public void getMaxReportCount_configuredConversionsNonInstall_returnsConfiguredCount() {
// Setup
- doReturn(true).when(mFlags).getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(3).when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
Source nonInstallEventSource =
SourceFixture.getMinimalValidSourceBuilder()
@@ -349,13 +353,12 @@ public class EventReportWindowCalcDelegateTest {
// Execution & assertion
Assert.assertEquals(
- 3, mEventReportWindowCalcDelegate.getMaxReportCount(nonInstallEventSource, false));
+ 3, mEventReportWindowCalcDelegate.getMaxReportCount(nonInstallEventSource));
}
@Test
public void getMaxReportCount_configuredConversionsInstallCase_returnsConfiguredCount() {
// Setup
- doReturn(true).when(mFlags).getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(2).when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
Source installEventSource =
SourceFixture.getMinimalValidSourceBuilder()
@@ -365,29 +368,28 @@ public class EventReportWindowCalcDelegateTest {
// Execution & assertion
Assert.assertEquals(
- 2, mEventReportWindowCalcDelegate.getMaxReportCount(installEventSource, true));
+ 2, mEventReportWindowCalcDelegate.getMaxReportCount(installEventSource));
}
@Test
public void getMaxReportCount_configuredConversionsToOneInstallCase_incrementConfiguredCount() {
// Setup
- doReturn(true).when(mFlags).getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(1).when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
Source installEventSource =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setInstallAttributed(true)
+ .setInstallCooldownWindow(1L)
.build();
// Execution & assertion
Assert.assertEquals(
- 2, mEventReportWindowCalcDelegate.getMaxReportCount(installEventSource, true));
+ 2, mEventReportWindowCalcDelegate.getMaxReportCount(installEventSource));
}
@Test
public void getMaxReportCount_configuredConversionsToOneInstallCase_noEffectOnCtc() {
// Setup
- doReturn(true).when(mFlags).getMeasurementEnableVtcConfigurableMaxEventReports();
doReturn(2).when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
Source navigationSource =
SourceFixture.getMinimalValidSourceBuilder()
@@ -397,7 +399,7 @@ public class EventReportWindowCalcDelegateTest {
// Execution & assertion
Assert.assertEquals(
- 3, mEventReportWindowCalcDelegate.getMaxReportCount(navigationSource, false));
+ 3, mEventReportWindowCalcDelegate.getMaxReportCount(navigationSource));
}
@Test
@@ -409,48 +411,51 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(10))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 1));
// Expected: 1 window at expiry
Source eventSource7d =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(7))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource7d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ eventSource7d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource7d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ eventSource7d, /* windowIndex= */ 1));
// Expected: 1 window at expiry
Source eventSource2d =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource2d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ eventSource2d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource2d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ eventSource2d, /* windowIndex= */ 1));
}
@Test
@@ -465,21 +470,21 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(10))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + minDelayMillis,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + minDelayMillis,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 1));
}
@Test
public void getReportingTimeForNoising_eventSrcWithConfiguredReportingWindows() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -493,27 +498,27 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(10))
.build();
assertEquals(
eventTime + TimeUnit.HOURS.toMillis(1) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(1) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 2, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 2));
}
@Test
public void getReportingTimeForNoising_eventSrcInstallAttWithConfiguredReportingWindows() {
// Addition another window for install attribution is ignored when configurable windows
// are applied.
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -528,28 +533,28 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(expiry)
.setEventReportWindow(expiry)
.setInstallCooldownWindow(expiry)
.build();
assertEquals(
eventTime + TimeUnit.HOURS.toMillis(1) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(1) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 2, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 2));
}
@Test
public void getReportingTimeForNoising_navigationSrcWithConfiguredReportingWindows() {
// Addition another window for install attribution is ignored when configurable windows
// are applied.
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -563,27 +568,27 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(10))
.build();
assertEquals(
eventTime + TimeUnit.HOURS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 2, /* isInstallCase */ false));
+ eventSource10d, /* windowIndex= */ 2));
}
@Test
public void getReportingTimeForNoising_navigationSrcInstallAttWithConfiguredReportingWindows() {
// Addition another window for install attribution is ignored when configurable windows
// are applied.
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -598,21 +603,22 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(expiry)
.setEventReportWindow(expiry)
.setInstallCooldownWindow(expiry)
.build();
assertEquals(
eventTime + TimeUnit.HOURS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 2, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 2));
}
@Test
@@ -625,36 +631,38 @@ public class EventReportWindowCalcDelegateTest {
.setSourceType(Source.SourceType.EVENT)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(1))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(10))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 0, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 1, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource10d, /* windowIndex= */ 2, /* isInstallCase */ true));
+ eventSource10d, /* windowIndex= */ 2));
// Expected: 1 window at 2d(expiry)
Source eventSource2d =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource2d, /* windowIndex= */ 0, /* isInstallCase */ true));
+ eventSource2d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- eventSource2d, /* windowIndex= */ 1, /* isInstallCase */ true));
+ eventSource2d, /* windowIndex= */ 1));
}
@Test
@@ -666,56 +674,59 @@ public class EventReportWindowCalcDelegateTest {
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(20))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource20d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ navigationSource20d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource20d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ navigationSource20d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(20) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource20d, /* windowIndex= */ 2, /* isInstallCase */ false));
+ navigationSource20d, /* windowIndex= */ 2));
// Expected: 2 windows at 2d & expiry(7d)
Source navigationSource7d =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(7))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource7d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ navigationSource7d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource7d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ navigationSource7d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource7d, /* windowIndex= */ 2, /* isInstallCase */ false));
+ navigationSource7d, /* windowIndex= */ 2));
// Expected: 1 window at 2d(expiry)
Source navigationSource2d =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource2d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ navigationSource2d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource2d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ navigationSource2d, /* windowIndex= */ 1));
}
@Test
@@ -728,20 +739,21 @@ public class EventReportWindowCalcDelegateTest {
.setSourceType(Source.SourceType.NAVIGATION)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(1))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(20))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource20d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ navigationSource20d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource20d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ navigationSource20d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(20) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource20d, /* windowIndex= */ 2, /* isInstallCase */ false));
+ navigationSource20d, /* windowIndex= */ 2));
// Expected: 2 windows at 2d & expiry(7d)
Source navigationSource7d =
@@ -749,20 +761,21 @@ public class EventReportWindowCalcDelegateTest {
.setSourceType(Source.SourceType.NAVIGATION)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(1))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(7))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource7d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ navigationSource7d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource7d, /* windowIndex= */ 1, /* isInstallCase */ false));
+ navigationSource7d, /* windowIndex= */ 1));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource7d, /* windowIndex= */ 2, /* isInstallCase */ false));
+ navigationSource7d, /* windowIndex= */ 2));
// Expected: 1 window at 2d(expiry)
Source navigationSource2d =
@@ -770,169 +783,21 @@ public class EventReportWindowCalcDelegateTest {
.setSourceType(Source.SourceType.NAVIGATION)
.setInstallCooldownWindow(TimeUnit.DAYS.toMillis(1))
.setEventTime(eventTime)
+ .setExpiryTime(eventTime + TimeUnit.DAYS.toMillis(30))
.setEventReportWindow(eventTime + TimeUnit.DAYS.toMillis(2))
.build();
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource2d, /* windowIndex= */ 0, /* isInstallCase */ false));
+ navigationSource2d, /* windowIndex= */ 0));
assertEquals(
eventTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- navigationSource2d, /* windowIndex= */ 1, /* isInstallCase */ false));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigEventSrcAppDest_fallbackToDefault() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long expiryTime = triggerTime + TimeUnit.DAYS.toMillis(30);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(1);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setEventReportWindow(expiryTime)
- .setEventTime(sourceEventTime)
- .build();
- assertEquals(
- expiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigEventSrcInstallAttAppDestTrigger1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long expiryTime = triggerTime + TimeUnit.DAYS.toMillis(30);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(1);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setEventReportWindow(expiryTime)
- .setEventTime(sourceEventTime)
- .setInstallAttributed(true)
- .build();
- assertEquals(
- sourceEventTime
- + PrivacyParams.INSTALL_ATTR_EVENT_EARLY_REPORTING_WINDOW_MILLISECONDS[0]
- + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigEventSrcInstallAttAppDestTrigger2ndWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long expiryTime = triggerTime + TimeUnit.DAYS.toMillis(30);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(3);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setEventReportWindow(expiryTime)
- .setEventTime(sourceEventTime)
- .setInstallAttributed(true)
- .build();
- assertEquals(
- expiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigEventSrcInstallAttWebDestTrigger1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long expiryTime = triggerTime + TimeUnit.DAYS.toMillis(30);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(1);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setEventReportWindow(expiryTime)
- .setEventTime(sourceEventTime)
- .setInstallAttributed(true)
- .build();
- assertEquals(
- expiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.WEB));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigEventSrcInstallAttWebDestTrigger2ndWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long expiryTime = triggerTime + TimeUnit.DAYS.toMillis(30);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(3);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setEventReportWindow(expiryTime)
- .setEventTime(sourceEventTime)
- .setInstallAttributed(true)
- .build();
- assertEquals(
- expiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.WEB));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigEventSourceWebDestination_fallbackToDefault() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long expiryTime = triggerTime + TimeUnit.DAYS.toMillis(30);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(1);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.EVENT)
- .setEventReportWindow(expiryTime)
- .setEventTime(sourceEventTime)
- .build();
- assertEquals(
- expiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.WEB));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigNavigationSourceTriggerInFirstWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long sourceExpiryTime = triggerTime + TimeUnit.DAYS.toMillis(25);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(1);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.NAVIGATION)
- .setEventReportWindow(sourceExpiryTime)
- .setEventTime(sourceEventTime)
- .build();
- assertEquals(
- sourceEventTime
- + PrivacyParams.NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS[0]
- + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
+ navigationSource2d, /* windowIndex= */ 1));
}
@Test
public void getReportingTime_emptyWindowConfigNavigationSourceTriggerNextHour() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
long triggerTime = System.currentTimeMillis();
@@ -941,6 +806,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -952,7 +818,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_emptyWindowConfigEventSrcTriggerNextHour() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
long triggerTime = System.currentTimeMillis();
@@ -963,6 +828,7 @@ public class EventReportWindowCalcDelegateTest {
.setAppDestinations(
SourceFixture.ValidSourceParams.ATTRIBUTION_DESTINATIONS)
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -974,7 +840,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_emptyWindowConfigEventSrcInstallAttTriggerNextHour() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
long triggerTime = System.currentTimeMillis();
@@ -985,6 +850,7 @@ public class EventReportWindowCalcDelegateTest {
.setAppDestinations(
SourceFixture.ValidSourceParams.ATTRIBUTION_DESTINATIONS)
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -999,7 +865,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_emptyWindowConfigNavigationSrcInstallAttTriggerNextHour() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
doReturn("").when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
long triggerTime = System.currentTimeMillis();
@@ -1010,6 +875,7 @@ public class EventReportWindowCalcDelegateTest {
.setAppDestinations(
SourceFixture.ValidSourceParams.ATTRIBUTION_DESTINATIONS)
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1021,70 +887,7 @@ public class EventReportWindowCalcDelegateTest {
}
@Test
- public void getReportingTime_nullWindowConfigNavigationSourceTriggerInSecondWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long sourceExpiryTime = triggerTime + TimeUnit.DAYS.toMillis(25);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(3);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.NAVIGATION)
- .setEventReportWindow(sourceExpiryTime)
- .setEventTime(sourceEventTime)
- .build();
- assertEquals(
- sourceEventTime
- + PrivacyParams.NAVIGATION_EARLY_REPORTING_WINDOW_MILLISECONDS[1]
- + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigNavigationSecondExpiry() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long sourceExpiryTime = triggerTime + TimeUnit.DAYS.toMillis(2);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(3);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.NAVIGATION)
- .setEventReportWindow(sourceExpiryTime)
- .setEventTime(sourceEventTime)
- .build();
- assertEquals(
- sourceExpiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
- }
-
- @Test
- public void getReportingTime_nullWindowConfigNavigationLast_fallbackToDefault() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsVtcEarlyReportingWindows();
- doReturn(null).when(mFlags).getMeasurementEventReportsCtcEarlyReportingWindows();
- long triggerTime = System.currentTimeMillis();
- long sourceExpiryTime = triggerTime + TimeUnit.DAYS.toMillis(1);
- long sourceEventTime = triggerTime - TimeUnit.DAYS.toMillis(20);
- Source source =
- SourceFixture.getMinimalValidSourceBuilder()
- .setSourceType(Source.SourceType.NAVIGATION)
- .setEventReportWindow(sourceExpiryTime)
- .setEventTime(sourceEventTime)
- .build();
- assertEquals(
- sourceExpiryTime + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
- mEventReportWindowCalcDelegate.getReportingTime(
- source, triggerTime, EventSurfaceType.APP));
- }
-
- @Test
public void getReportingTime_MalformedWindowConfigEventSourceAppDestination_returnsDefault() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1097,6 +900,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1108,7 +912,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigEventSrcInstallAttAppDestTrigger1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1121,6 +924,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1135,7 +939,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigEventSrcInstallAttAppDestTrigger2ndWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1148,6 +951,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1160,7 +964,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigEventSrcInstallAttWebDestTrigger1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1173,6 +976,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1185,7 +989,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigEventSrcInstallAttWebDestTrigger2ndWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1198,6 +1001,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1210,7 +1014,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigEventSourceWebDestination() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1223,6 +1026,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1234,7 +1038,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigNavigationSourceTriggerInFirstWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1247,6 +1050,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1260,7 +1064,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigNavigationSourceTriggerInSecondWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1273,6 +1076,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1286,7 +1090,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigNavigationSecondExpiry_fallbackToDefault() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1299,6 +1102,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1310,7 +1114,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_MalformedWindowConfigNavigationLast_fallbackToDefault() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1323,6 +1126,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(sourceExpiryTime)
.setEventReportWindow(sourceExpiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1334,7 +1138,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_validWindowConfigEventSourceTriggerIn1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1347,6 +1150,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1358,7 +1162,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_validWindowConfigEventSourceTriggerIn2ndWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1371,6 +1174,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1383,7 +1187,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_validWindowConfigEventSourceTriggerInLastWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1396,6 +1199,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1408,7 +1212,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_validWindowConfigNavigationSourceTriggerIn1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1421,6 +1224,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1432,7 +1236,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_validWindowConfigNavigationSourceTriggerIn2ndWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1445,6 +1248,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1457,7 +1261,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_validWindowConfigNavigationSourceTriggerInLastWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(MALFORMED_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1470,6 +1273,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.setInstallAttributed(true)
@@ -1482,7 +1286,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_invalidWindowConfigEventSourceTriggerIn1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(INVALID_1H_1D_2D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1495,6 +1298,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.EVENT)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1506,7 +1310,6 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getReportingTime_invalidWindowConfigNavigationSourceTriggerIn1stWindow() {
- doReturn(true).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
doReturn(VALID_1H_1D_WINDOW_CONFIG)
.when(mFlags)
.getMeasurementEventReportsVtcEarlyReportingWindows();
@@ -1519,6 +1322,7 @@ public class EventReportWindowCalcDelegateTest {
Source source =
SourceFixture.getMinimalValidSourceBuilder()
.setSourceType(Source.SourceType.NAVIGATION)
+ .setExpiryTime(expiryTime)
.setEventReportWindow(expiryTime)
.setEventTime(sourceEventTime)
.build();
@@ -1713,49 +1517,49 @@ public class EventReportWindowCalcDelegateTest {
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- oneWindowNoStart, 0, false));
+ oneWindowNoStart, 0));
// InstallCase doesn't affect the report time
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- oneWindowNoStart, 0, true));
+ oneWindowNoStart, 0));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- oneWindowWithStart, 0, false));
+ oneWindowWithStart, 0));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- twoWindowsNoStart, 0, false));
+ twoWindowsNoStart, 0));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(5) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- twoWindowsNoStart, 1, false));
+ twoWindowsNoStart, 1));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(2) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- fiveWindowsWithStart, 0, false));
+ fiveWindowsWithStart, 0));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(5) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- fiveWindowsWithStart, 1, false));
+ fiveWindowsWithStart, 1));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(7) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- fiveWindowsWithStart, 2, false));
+ fiveWindowsWithStart, 2));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(10) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- fiveWindowsWithStart, 3, false));
+ fiveWindowsWithStart, 3));
assertEquals(
sourceTime + TimeUnit.DAYS.toMillis(20) + MEASUREMENT_MIN_EVENT_REPORT_DELAY_MILLIS,
mEventReportWindowCalcDelegate.getReportingTimeForNoising(
- fiveWindowsWithStart, 4, false));
+ fiveWindowsWithStart, 4));
}
@Test
@@ -1863,7 +1667,8 @@ public class EventReportWindowCalcDelegateTest {
@Test
public void getMaxReportCount_flexLiteApi() {
doReturn(true).when(mFlags).getMeasurementFlexLiteApiEnabled();
- doReturn(false).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
+ doReturn(Flags.DEFAULT_MEASUREMENT_VTC_CONFIGURABLE_MAX_EVENT_REPORTS_COUNT)
+ .when(mFlags).getMeasurementVtcConfigurableMaxEventReportsCount();
long sourceTime = System.currentTimeMillis();
Source source10Reports =
SourceFixture.getMinimalValidSourceBuilder()
@@ -1871,10 +1676,20 @@ public class EventReportWindowCalcDelegateTest {
.setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
.setEventTime(sourceTime)
.build();
- assertEquals(10, mEventReportWindowCalcDelegate.getMaxReportCount(source10Reports, true));
- assertEquals(10, mEventReportWindowCalcDelegate.getMaxReportCount(source10Reports, false));
+ assertEquals(10, mEventReportWindowCalcDelegate.getMaxReportCount(source10Reports));
+ assertEquals(10, mEventReportWindowCalcDelegate.getMaxReportCount(source10Reports));
- Source sourceDefaultEvent =
+ Source eventSourceInstallAttributed =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setEventReportWindows(EVENT_REPORT_WINDOWS_5_WINDOWS_WITH_START)
+ .setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
+ .setEventTime(sourceTime)
+ .setSourceType(Source.SourceType.EVENT)
+ .setInstallAttributed(true)
+ .setInstallCooldownWindow(1L)
+ .build();
+
+ Source eventSource =
SourceFixture.getMinimalValidSourceBuilder()
.setEventReportWindows(EVENT_REPORT_WINDOWS_5_WINDOWS_WITH_START)
.setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
@@ -1884,12 +1699,23 @@ public class EventReportWindowCalcDelegateTest {
assertEquals(
PrivacyParams.INSTALL_ATTR_EVENT_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(sourceDefaultEvent, true));
+ mEventReportWindowCalcDelegate.getMaxReportCount(
+ eventSourceInstallAttributed));
assertEquals(
PrivacyParams.EVENT_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(sourceDefaultEvent, false));
+ mEventReportWindowCalcDelegate.getMaxReportCount(eventSource));
- Source sourceDefaultNavigation =
+ Source navigationSourceInstallAttributed =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setEventReportWindows(EVENT_REPORT_WINDOWS_5_WINDOWS_WITH_START)
+ .setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
+ .setEventTime(sourceTime)
+ .setSourceType(Source.SourceType.NAVIGATION)
+ .setInstallAttributed(true)
+ .setInstallCooldownWindow(1L)
+ .build();
+
+ Source navigationSource =
SourceFixture.getMinimalValidSourceBuilder()
.setEventReportWindows(EVENT_REPORT_WINDOWS_5_WINDOWS_WITH_START)
.setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
@@ -1898,18 +1724,27 @@ public class EventReportWindowCalcDelegateTest {
.build();
assertEquals(
- PrivacyParams.INSTALL_ATTR_NAVIGATION_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(sourceDefaultNavigation, true));
+ PrivacyParams.NAVIGATION_SOURCE_MAX_REPORTS,
+ mEventReportWindowCalcDelegate.getMaxReportCount(
+ navigationSourceInstallAttributed));
assertEquals(
PrivacyParams.NAVIGATION_SOURCE_MAX_REPORTS,
- mEventReportWindowCalcDelegate.getMaxReportCount(sourceDefaultNavigation, false));
+ mEventReportWindowCalcDelegate.getMaxReportCount(navigationSource));
}
@Test
public void getReportingWindowCountForNoising_flexLiteApi() {
doReturn(true).when(mFlags).getMeasurementFlexLiteApiEnabled();
- doReturn(false).when(mFlags).getMeasurementEnableConfigurableEventReportingWindows();
long sourceTime = System.currentTimeMillis();
+ Source defaultSourceEventInstallAttributed =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
+ .setEventTime(sourceTime)
+ .setSourceType(Source.SourceType.EVENT)
+ .setInstallAttributed(true)
+ .setInstallCooldownWindow(1L)
+ .build();
+
Source defaultSourceEvent =
SourceFixture.getMinimalValidSourceBuilder()
.setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(30))
@@ -1952,56 +1787,110 @@ public class EventReportWindowCalcDelegateTest {
assertEquals(
2,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- defaultSourceEvent, true));
+ defaultSourceEventInstallAttributed));
assertEquals(
1,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- defaultSourceEvent, false));
+ defaultSourceEvent));
assertEquals(
3,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- defaultSourceNavigation, true));
+ defaultSourceNavigation));
assertEquals(
3,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- defaultSourceNavigation, false));
+ defaultSourceNavigation));
// InstallCase doesn't affect the report count
assertEquals(
1,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- oneWindowNoStart, true));
+ oneWindowNoStart));
assertEquals(
1,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- oneWindowNoStart, false));
+ oneWindowNoStart));
assertEquals(
1,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- oneWindowWithStart, true));
+ oneWindowWithStart));
assertEquals(
1,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- oneWindowWithStart, false));
+ oneWindowWithStart));
assertEquals(
2,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- twoWindowsNoStart, true));
+ twoWindowsNoStart));
assertEquals(
2,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- twoWindowsNoStart, false));
+ twoWindowsNoStart));
assertEquals(
5,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- fiveWindowsWithStart, true));
+ fiveWindowsWithStart));
assertEquals(
5,
mEventReportWindowCalcDelegate.getReportingWindowCountForNoising(
- fiveWindowsWithStart, false));
+ fiveWindowsWithStart));
+ }
+
+ @Test
+ public void fallsWithinWindow_windowNotStarted() {
+ doReturn(true).when(mFlags).getMeasurementFlexLiteApiEnabled();
+ long sourceTime = System.currentTimeMillis();
+ long triggerTime = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1) - 1;
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setSourceType(Source.SourceType.EVENT)
+ .setEventTime(sourceTime)
+ .setEventReportWindows(EVENT_REPORT_WINDOWS_2_WINDOWS_WITH_START)
+ .setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(25))
+ .build();
+ assertEquals(
+ EventReportWindowCalcDelegate.MomentPlacement.BEFORE,
+ mEventReportWindowCalcDelegate.fallsWithinWindow(
+ source, triggerTime, EventSurfaceType.APP));
+ }
+
+ @Test
+ public void fallsWithinWindow_windowWithin() {
+ doReturn(true).when(mFlags).getMeasurementFlexLiteApiEnabled();
+ long sourceTime = System.currentTimeMillis();
+ long triggerTime = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1);
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setSourceType(Source.SourceType.EVENT)
+ .setEventTime(sourceTime)
+ .setEventReportWindows(EVENT_REPORT_WINDOWS_2_WINDOWS_WITH_START)
+ .setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(25))
+ .build();
+ assertEquals(
+ EventReportWindowCalcDelegate.MomentPlacement.WITHIN,
+ mEventReportWindowCalcDelegate.fallsWithinWindow(
+ source, triggerTime, EventSurfaceType.APP));
+ }
+
+ @Test
+ public void fallsWithinWindow_windowPassed() {
+ doReturn(true).when(mFlags).getMeasurementFlexLiteApiEnabled();
+ long sourceTime = System.currentTimeMillis();
+ long triggerTime = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(20);
+ Source source =
+ SourceFixture.getMinimalValidSourceBuilder()
+ .setSourceType(Source.SourceType.EVENT)
+ .setEventTime(sourceTime)
+ .setEventReportWindows(EVENT_REPORT_WINDOWS_2_WINDOWS_WITH_START)
+ .setExpiryTime(sourceTime + TimeUnit.DAYS.toMillis(25))
+ .build();
+ assertEquals(
+ EventReportWindowCalcDelegate.MomentPlacement.AFTER,
+ mEventReportWindowCalcDelegate.fallsWithinWindow(
+ source, triggerTime, EventSurfaceType.APP));
}
}