File tree 1 file changed +16
-0
lines changed
iterableapi/src/test/java/com/iterable/iterableapi
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import android .app .Notification ;
4
4
import android .app .NotificationManager ;
5
+ import android .app .PendingIntent ;
5
6
import android .content .Context ;
6
7
import android .content .Intent ;
7
8
import android .os .Bundle ;
@@ -91,4 +92,19 @@ public void testNoAction() throws Exception {
91
92
assertEquals ("button1" , savedIntent .getStringExtra (IterableConstants .ACTION_IDENTIFIER ));
92
93
}
93
94
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
+
94
110
}
You can’t perform that action at this time.
0 commit comments