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

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

Issue 1864053002: Implement Android UI of web notification inline replies Base URL: https://chromium.googlesource.com/chromium/src.git@inline_replies_ps1
Patch Set: Fix filename? Created 4 years, 8 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/StandardNotificationBuilderTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java
index 36e34e9c1508087620f2f97df8602b865b2946f6..3f87ffc96abd198631744cf267392d792256b6c4 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilderTest.java
@@ -58,13 +58,16 @@ public class StandardNotificationBuilderTest extends InstrumentationTestCase {
.setVibrate(new long[] {100L})
.setContentIntent(pendingContentIntent)
.setDeleteIntent(pendingDeleteIntent)
- .addAction(actionIcon, "button 1", null /* intent */)
- .addAction(actionIcon, "button 2", null /* intent */)
+ .setDefaultActionPlaceholder("default placeholder")
+ .addAction(ButtonInfoType.BUTTON, actionIcon, "button",
+ null /* placeholder */, null /* intent */)
+ .addAction(ButtonInfoType.TEXT, actionIcon, "inline reply",
+ "custom placeholder", null /* intent */)
.addSettingsAction(0 /* iconId */, "settings", null /* intent */)
.build();
assertEquals(R.drawable.ic_chrome, notification.icon);
- assertNotNull(notification.largeIcon);
+ assertNotNull(notification.getLargeIcon());
assertEquals("title", notification.extras.getString(Notification.EXTRA_TITLE));
assertEquals("body", notification.extras.getString(Notification.EXTRA_TEXT));
assertEquals("origin", notification.extras.getString(Notification.EXTRA_SUB_TEXT));
@@ -75,8 +78,36 @@ public class StandardNotificationBuilderTest extends InstrumentationTestCase {
assertEquals(pendingContentIntent, notification.contentIntent);
assertEquals(pendingDeleteIntent, notification.deleteIntent);
assertEquals(3, notification.actions.length);
- assertEquals("button 1", notification.actions[0].title);
- assertEquals("button 2", notification.actions[1].title);
+ assertEquals("button", notification.actions[0].title);
+ assertNull(notification.actions[0].getRemoteInputs());
+ assertEquals("inline reply", notification.actions[1].title);
+ assertEquals("custom placeholder", notification.actions[1].getRemoteInputs()[0].getLabel());
assertEquals("settings", notification.actions[2].title);
}
+
+ @SmallTest
+ @Feature({"Browser", "Notifications"})
+ public void testDefaultPlacholder() {
+ Context context = getInstrumentation().getTargetContext();
+
+ Notification notification = new StandardNotificationBuilder(context)
+ .setDefaultActionPlaceholder("default placeholder")
+ .addAction(ButtonInfoType.TEXT, null, "inline reply",
+ null /* placeholder*/, null /* intent */)
+ .build();
+ assertEquals(
+ "default placeholder", notification.actions[0].getRemoteInputs()[0].getLabel());
Michael van Ouwerkerk 2016/04/07 14:19:20 Will this work on bots that run older Android vers
+ }
+
+ @SmallTest
+ @Feature({"Browser", "Notifications"})
+ public void testNullDefaultPlacholder() {
+ Context context = getInstrumentation().getTargetContext();
+
+ Notification notification = new StandardNotificationBuilder(context)
+ .addAction(ButtonInfoType.TEXT, null, "inline reply",
+ null /* placeholder*/, null /* intent */)
+ .build();
+ assertNull(notification.actions[0].getRemoteInputs()[0].getLabel());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698