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,7 +409,11 @@ public class CustomNotificationBuilderTest { ...@@ -409,7 +409,11 @@ public class CustomNotificationBuilderTest {
View bigView = notification.bigContentView.apply(context, new LinearLayout(context)); View bigView = notification.bigContentView.apply(context, new LinearLayout(context));
Drawable bigViewIcon = ((ImageView) bigView.findViewById(R.id.icon)).getDrawable(); Drawable bigViewIcon = ((ImageView) bigView.findViewById(R.id.icon)).getDrawable();
Assert.assertNotNull(bigViewIcon); Assert.assertNotNull(bigViewIcon);
Assert.assertTrue(expectedIcon.sameAs(((BitmapDrawable) bigViewIcon).getBitmap()));
// 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( private static void assertSmallNotificationIconAsExpected(
......
...@@ -30,7 +30,6 @@ import org.junit.runner.RunWith; ...@@ -30,7 +30,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.test.util.CommandLineFlags; 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.Feature;
import org.chromium.base.test.util.MinAndroidSdkLevel; import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.base.test.util.RetryOnFailure; import org.chromium.base.test.util.RetryOnFailure;
...@@ -610,7 +609,6 @@ public class NotificationPlatformBridgeTest { ...@@ -610,7 +609,6 @@ public class NotificationPlatformBridgeTest {
@MediumTest @MediumTest
@Feature({"Browser", "Notifications"}) @Feature({"Browser", "Notifications"})
@RetryOnFailure @RetryOnFailure
@DisableIf.Build(sdk_is_greater_than = 25, message = "https://crbug.com/999357")
public void testShowNotificationWithoutIcon() throws Exception { public void testShowNotificationWithoutIcon() throws Exception {
mNotificationTestRule.setNotificationContentSettingForOrigin( mNotificationTestRule.setNotificationContentSettingForOrigin(
ContentSettingValues.ALLOW, mPermissionTestRule.getOrigin()); ContentSettingValues.ALLOW, mPermissionTestRule.getOrigin());
...@@ -634,8 +632,11 @@ public class NotificationPlatformBridgeTest { ...@@ -634,8 +632,11 @@ public class NotificationPlatformBridgeTest {
Bitmap generatedIcon = generator.generateIconForUrl(mPermissionTestRule.getOrigin()); Bitmap generatedIcon = generator.generateIconForUrl(mPermissionTestRule.getOrigin());
Assert.assertNotNull(generatedIcon); Assert.assertNotNull(generatedIcon);
Assert.assertTrue(generatedIcon.sameAs( // Starts from Android O MR1, large icon can be downscaled by Android platform code.
NotificationTestUtil.getLargeIconFromNotification(context, notification))); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1) {
Assert.assertTrue(generatedIcon.sameAs(
NotificationTestUtil.getLargeIconFromNotification(context, notification)));
}
} }
/* /*
......
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