File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
iterableapi/src/test/java/com/iterable/iterableapi Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 22
33import android .app .Notification ;
44import android .app .NotificationManager ;
5+ import android .app .PendingIntent ;
56import android .content .Context ;
67import android .content .Intent ;
78import android .os .Bundle ;
@@ -91,4 +92,19 @@ public void testNoAction() throws Exception {
9192 assertEquals ("button1" , savedIntent .getStringExtra (IterableConstants .ACTION_IDENTIFIER ));
9293 }
9394
95+ @ Test
96+ public void testPendingIntentImmutable () throws Exception {
97+ Bundle notif = new Bundle ();
98+ notif .putString (IterableConstants .ITERABLE_DATA_KEY , getResourceString ("push_payload_action_buttons.json" ));
99+
100+ IterableNotificationBuilder iterableNotification = postNotification (notif );
101+ StatusBarNotification statusBarNotification = mNotificationManager .getActiveNotifications ()[0 ];
102+ Notification notification = statusBarNotification .getNotification ();
103+
104+ assertTrue ((shadowOf (notification .contentIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
105+ assertTrue ((shadowOf (notification .actions [0 ].actionIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
106+ assertTrue ((shadowOf (notification .actions [1 ].actionIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
107+ assertTrue ((shadowOf (notification .actions [2 ].actionIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
108+ }
109+
94110}
You can’t perform that action at this time.
0 commit comments