Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java

Issue 1750083004: Add badge to web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java
index d4a85a57bcf8bd65dfb60ae54e2218786f665675..8b5fcc299cc98e298b888dd2b47506be6d1c7a30 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/CustomNotificationBuilderTest.java
@@ -144,6 +144,10 @@ public void testPaintIcons() {
new int[] {Color.RED}, 1 /* width */, 1 /* height */, Bitmap.Config.ARGB_8888);
largeIcon = largeIcon.copy(Bitmap.Config.ARGB_8888, true /* isMutable */);
+ Bitmap smallIcon = Bitmap.createBitmap(
+ new int[] {Color.RED}, 1 /* width */, 1 /* height */, Bitmap.Config.ARGB_8888);
+ smallIcon = smallIcon.copy(Bitmap.Config.ARGB_8888, true /* isMutable */);
+
Bitmap actionIcon = Bitmap.createBitmap(
new int[] {Color.RED}, 1 /* width */, 1 /* height */, Bitmap.Config.ARGB_8888);
actionIcon = actionIcon.copy(Bitmap.Config.ARGB_8888, true /* isMutable */);
@@ -151,6 +155,7 @@ public void testPaintIcons() {
Notification notification =
new CustomNotificationBuilder(context)
.setLargeIcon(largeIcon)
+ .setSmallIcon(smallIcon)
.addAction(actionIcon, "button", createIntent(context, "ActionButton"))
.build();
@@ -158,9 +163,17 @@ public void testPaintIcons() {
assertNotNull(notification.largeIcon);
assertEquals(Color.RED, notification.largeIcon.getPixel(0, 0));
+ View bigView = notification.bigContentView.apply(context, new LinearLayout(context));
+
+ // Small icons should be painted white.
+ int smallIconId = CustomNotificationBuilder.useMaterial() ? R.id.small_icon_overlay
+ : R.id.small_icon_footer;
+ ImageView smallIconView = (ImageView) bigView.findViewById(smallIconId);
+ Bitmap smallIconBitmap = ((BitmapDrawable) smallIconView.getDrawable()).getBitmap();
+ assertEquals(Color.WHITE, smallIconBitmap.getPixel(0, 0));
Peter Beverloo 2016/03/03 17:55:38 For M+, could we verify that the Icon returned by
Michael van Ouwerkerk 2016/03/09 18:28:25 Done.
+
// Action icons should be painted white.
assertEquals(1, notification.actions.length);
- View bigView = notification.bigContentView.apply(context, new LinearLayout(context));
ImageView actionIconView = (ImageView) bigView.findViewById(R.id.button_icon);
Bitmap actionIconBitmap = ((BitmapDrawable) actionIconView.getDrawable()).getBitmap();
assertEquals(Color.WHITE, actionIconBitmap.getPixel(0, 0));

Powered by Google App Engine
This is Rietveld 408576698