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

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

Issue 1681123002: Plumb Notification action icons through to the UI layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ActionIconResourceFetching
Patch Set: Address peter's comments. 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 e6b8ee6b07bb47e2d25229fb28624cd31b155218..4587b6b19ff943084d40239ee7207b12d7c45ac2 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
@@ -43,24 +43,27 @@ public void testSetAll() {
Bitmap largeIcon = Bitmap.createBitmap(
new int[] {Color.RED}, 1 /* width */, 1 /* height */, Bitmap.Config.ARGB_8888);
- Notification notification = new CustomNotificationBuilder(context)
- .setSmallIcon(R.drawable.ic_chrome)
- .setLargeIcon(largeIcon)
- .setTitle("title")
- .setBody("body")
- .setOrigin("origin")
- .setTicker("ticker")
- .setDefaults(Notification.DEFAULT_ALL)
- .setVibrate(new long[] {100L})
- .setContentIntent(contentIntent)
- .setDeleteIntent(deleteIntent)
- .addAction(0 /* iconId */, "button",
- createIntent(context, "ActionButtonOne"))
- .addAction(0 /* iconId */, "button",
- createIntent(context, "ActionButtonTwo"))
- .addSettingsAction(0 /* iconId */, "settings",
- createIntent(context, "SettingsButton"))
- .build();
+ Bitmap actionIcon = Bitmap.createBitmap(
+ new int[] {Color.WHITE}, 1 /* width */, 1 /* height */, Bitmap.Config.ARGB_8888);
+
+ Notification notification =
+ new CustomNotificationBuilder(context)
+ .setSmallIcon(R.drawable.ic_chrome)
+ .setLargeIcon(largeIcon)
+ .setTitle("title")
+ .setBody("body")
+ .setOrigin("origin")
+ .setTicker("ticker")
+ .setDefaults(Notification.DEFAULT_ALL)
+ .setVibrate(new long[] {100L})
+ .setContentIntent(contentIntent)
+ .setDeleteIntent(deleteIntent)
+ .addAction(
+ 0 /* iconId */, "button", createIntent(context, "ActionButtonOne"))
+ .addAction(actionIcon, "button", createIntent(context, "ActionButtonTwo"))
+ .addSettingsAction(
+ 0 /* iconId */, "settings", createIntent(context, "SettingsButton"))
+ .build();
View compactView = notification.contentView.apply(context, new LinearLayout(context));
View bigView = notification.bigContentView.apply(context, new LinearLayout(context));
@@ -111,24 +114,22 @@ public void testZeroActionButtons() {
public void testMaxActionButtons() {
Context context = getInstrumentation().getTargetContext();
NotificationBuilderBase builder = new CustomNotificationBuilder(context)
- .addAction(0 /* iconId */, "button",
- createIntent(context, "ActionButtonOne"))
- .addAction(0 /* iconId */, "button",
- createIntent(context, "ActionButtonTwo"))
- .addAction(0 /* iconId */, "button",
- createIntent(context, "ActionButtonThree"));
+ .addAction(0 /* iconId */, "button",
+ createIntent(context, "ActionButtonOne"))
+ .addAction(0 /* iconId */, "button",
+ createIntent(context, "ActionButtonTwo"));
try {
- builder.addAction(0 /* iconId */, "button", createIntent(context, "ActionButtonFour"));
+ builder.addAction(0 /* iconId */, "button", createIntent(context, "ActionButtonThree"));
fail("This statement should not be reached as the previous statement should throw.");
} catch (IllegalStateException e) {
- assertEquals("Cannot add more than 3 actions.", e.getMessage());
+ assertEquals("Cannot add more than 2 actions.", e.getMessage());
}
Notification notification = builder.build();
View bigView = notification.bigContentView.apply(context, new LinearLayout(context));
ArrayList<View> buttons = new ArrayList<>();
bigView.findViewsWithText(buttons, "button", View.FIND_VIEWS_WITH_TEXT);
- assertEquals("There is a maximum of 3 buttons", 3, buttons.size());
+ assertEquals("There is a maximum of 2 buttons", 2, buttons.size());
}
@SmallTest

Powered by Google App Engine
This is Rietveld 408576698