Commit 1ec5c55f authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Notification test: Don't verify large icon equality on Android O MR1+.

Starts from Android O MR1, Android code may resize the large icon. We
don't need to check equality on the large icon bitmap.

Bug: 999357
Change-Id: I65f38a0fb120608ea9d23611f6e93db5ec674bc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1864385Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708679}
parent 81c11d04
......@@ -409,8 +409,12 @@ public class CustomNotificationBuilderTest {
View bigView = notification.bigContentView.apply(context, new LinearLayout(context));
Drawable bigViewIcon = ((ImageView) bigView.findViewById(R.id.icon)).getDrawable();
Assert.assertNotNull(bigViewIcon);
// Starts from Android O MR1, large icon can be downscaled by Android platform code.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1) {
Assert.assertTrue(expectedIcon.sameAs(((BitmapDrawable) bigViewIcon).getBitmap()));
}
}
private static void assertSmallNotificationIconAsExpected(
Context context, Notification notification, Bitmap expectedIcon) {
......
......@@ -30,7 +30,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.base.test.util.RetryOnFailure;
......@@ -610,7 +609,6 @@ public class NotificationPlatformBridgeTest {
@MediumTest
@Feature({"Browser", "Notifications"})
@RetryOnFailure
@DisableIf.Build(sdk_is_greater_than = 25, message = "https://crbug.com/999357")
public void testShowNotificationWithoutIcon() throws Exception {
mNotificationTestRule.setNotificationContentSettingForOrigin(
ContentSettingValues.ALLOW, mPermissionTestRule.getOrigin());
......@@ -634,9 +632,12 @@ public class NotificationPlatformBridgeTest {
Bitmap generatedIcon = generator.generateIconForUrl(mPermissionTestRule.getOrigin());
Assert.assertNotNull(generatedIcon);
// Starts from Android O MR1, large icon can be downscaled by Android platform code.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1) {
Assert.assertTrue(generatedIcon.sameAs(
NotificationTestUtil.getLargeIconFromNotification(context, notification)));
}
}
/*
* Verifies that starting the PendingIntent stored as the notification's content intent will
......
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