Commit d89e565f authored by Rohit Agarwal's avatar Rohit Agarwal Committed by Commit Bot

Add null check for IncognitoNotificationServiceTest

#testCloseAllIncognitoNotificationIsDisplayed.

StatusBarNotification#getTag method can return null if no tag was
assigned to a notification.

This CL adds the null check here before comparing the tag with the
incognito notification tag.

Bug: 1134241
Change-Id: I548ec82aebbd15a2e837cf00316d30955d828510
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463573Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Commit-Queue: Rohit Agarwal <roagarwal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816486}
parent 01a6b006
...@@ -206,8 +206,8 @@ public class IncognitoNotificationServiceTest { ...@@ -206,8 +206,8 @@ public class IncognitoNotificationServiceTest {
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
boolean isIncognitoNotificationDisplayed = false; boolean isIncognitoNotificationDisplayed = false;
for (StatusBarNotification statusBarNotification : nm.getActiveNotifications()) { for (StatusBarNotification statusBarNotification : nm.getActiveNotifications()) {
if (statusBarNotification.getTag().equals( if (IncognitoNotificationManager.INCOGNITO_TABS_OPEN_TAG.equals(
IncognitoNotificationManager.INCOGNITO_TABS_OPEN_TAG)) { statusBarNotification.getTag())) {
isIncognitoNotificationDisplayed = true; isIncognitoNotificationDisplayed = true;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment