70
70
import org .robolectric .RuntimeEnvironment ;
71
71
import org .robolectric .Shadows ;
72
72
import org .robolectric .annotation .Config ;
73
- import org .robolectric .shadows .ShadowActivity ;
74
73
import org .robolectric .shadows .ShadowApplication ;
75
74
import org .robolectric .shadows .ShadowConnectivityManager ;
76
75
import org .robolectric .shadows .ShadowLog ;
@@ -199,7 +198,7 @@ public void testInitFromApplicationContext() throws Exception {
199
198
200
199
@ Test
201
200
public void testOpenFromNotificationWhenAppIsDead () throws Exception {
202
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Robo test message\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
201
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Robo test message\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
203
202
204
203
OneSignal .init (blankActivity , "123456789" , ONESIGNAL_APP_ID , getNotificationOpenedHandler ());
205
204
@@ -214,7 +213,7 @@ public void shouldCorrectlyRemoveOpenedHandlerAndFireMissedOnesWhenAddedBack() t
214
213
threadAndTaskWait ();
215
214
216
215
OneSignal .removeNotificationOpenedHandler ();
217
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Robo test message\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
216
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Robo test message\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
218
217
Assert .assertNull (notificationOpenedMessage );
219
218
220
219
OneSignal .init (blankActivity , "123456789" , ONESIGNAL_APP_ID , getNotificationOpenedHandler ());
@@ -249,7 +248,7 @@ public void testOpenFromNotificationWhenAppIsInBackground() throws Exception {
249
248
OneSignal .init (blankActivity , "123456789" , ONESIGNAL_APP_ID , getNotificationOpenedHandler ());
250
249
Assert .assertNull (notificationOpenedMessage );
251
250
252
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
251
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
253
252
Assert .assertEquals ("Test Msg" , notificationOpenedMessage );
254
253
threadWait ();
255
254
}
@@ -261,7 +260,7 @@ public void testOpeningLauncherActivity() throws Exception {
261
260
// From app launching normally
262
261
Assert .assertNotNull (Shadows .shadowOf (blankActivity ).getNextStartedActivity ());
263
262
264
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
263
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
265
264
266
265
Assert .assertNotNull (Shadows .shadowOf (blankActivity ).getNextStartedActivity ());
267
266
Assert .assertNull (Shadows .shadowOf (blankActivity ).getNextStartedActivity ());
@@ -274,7 +273,7 @@ public void testOpeningLaunchUrl() throws Exception {
274
273
275
274
// No OneSignal init here to test case where it is located in an Activity.
276
275
277
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" , \" u\" : \" http://google.com\" } }]" ), false );
276
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" , \" u\" : \" http://google.com\" } }]" ), false );
278
277
279
278
Intent intent = Shadows .shadowOf (blankActivity ).getNextStartedActivity ();
280
279
Assert .assertEquals ("android.intent.action.VIEW" , intent .getAction ());
@@ -292,7 +291,7 @@ public void testOpeningLaunchUrlWithDisableDefault() throws Exception {
292
291
293
292
// No OneSignal init here to test case where it is located in an Activity.
294
293
295
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" , \" u\" : \" http://google.com\" } }]" ), false );
294
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" , \" u\" : \" http://google.com\" } }]" ), false );
296
295
Assert .assertNull (Shadows .shadowOf (blankActivity ).getNextStartedActivity ());
297
296
}
298
297
@@ -307,7 +306,7 @@ public void testDisableOpeningLauncherActivityOnNotifiOpen() throws Exception {
307
306
OneSignal .init (blankActivity , "123456789" , ONESIGNAL_APP_ID , getNotificationOpenedHandler ());
308
307
Assert .assertNull (notificationOpenedMessage );
309
308
310
- OneSignal .handleNotificationReceivedWhenInFocus (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
309
+ OneSignal .handleNotificationOpen (blankActivity , new JSONArray ("[{ \" alert\" : \" Test Msg\" , \" custom\" : { \" i\" : \" UUID\" } }]" ), false );
311
310
312
311
Assert .assertNull (Shadows .shadowOf (blankActivity ).getNextStartedActivity ());
313
312
Assert .assertEquals ("Test Msg" , notificationOpenedMessage );
0 commit comments