Skip to content

Commit fb66aaa

Browse files
committed
unit test for no ad_id on android devices
We are no longer using ad_id on any platform. Creating a unit test to verify this for Android device types
1 parent ad1ad14 commit fb66aaa

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

OneSignalSDK/unittest/src/test/java/com/test/onesignal/MainOneSignalClassRunner.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,23 @@ public void testDeviceTypeIsAndroid_forPlayerCreate() throws Exception {
314314
assertAndroidPlayerCreateAtIndex(1);
315315
}
316316

317+
@Test
318+
public void testAndroidDoesNotGetAdId() throws Exception {
319+
// 2. Init OneSignal so the app id is cached
320+
OneSignalInit();
321+
threadAndTaskWait();
322+
323+
// 3. Make sure device_type is Amazon (2) in player create
324+
assertAndroidPlayerCreateAtIndex(1);
325+
326+
// 4. Assert Player Create does NOT have an ad_id
327+
ShadowOneSignalRestClient.Request request = ShadowOneSignalRestClient.requests.get(1);
328+
JsonAsserts.doesNotContainKeys(request.payload, new ArrayList<String>() {{ add("ad_id"); }});
329+
330+
// 5. Assert we did NOT try to get a Google Ad id
331+
assertFalse(ShadowAdvertisingIdProviderGPS.calledGetIdentifier);
332+
}
333+
317334
@Test
318335
public void testDeviceTypeIsAmazon_forPlayerCreate() throws Exception {
319336
// 1. Mock Amazon device type for this test

0 commit comments

Comments
 (0)