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

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

Issue 2337963003: Plumb through notification action types and placeholders on Android (Closed)
Patch Set: Put =default back in .cc file Created 4 years, 3 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 24c6ac5311ae9dd1668b9294c35e5cd053d3e199..2a5f2efc5664671c9cf8537cbc7e3f32dc349f55 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
@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.notifications;
+import android.annotation.TargetApi;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Context;
@@ -16,6 +17,7 @@ import android.test.suitebuilder.annotation.SmallTest;
import android.text.SpannableStringBuilder;
import org.chromium.base.test.util.Feature;
+import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.util.UrlUtilities;
import org.chromium.chrome.browser.widget.RoundedIconGenerator;
@@ -76,8 +78,8 @@ public class StandardNotificationBuilderTest extends NativeLibraryTestBase {
.setVibrate(new long[] {100L})
.setContentIntent(outContentAndDeleteIntents[0])
.setDeleteIntent(outContentAndDeleteIntents[1])
- .addAction(actionIcon, "button 1", null /* intent */)
- .addAction(actionIcon, "button 2", null /* intent */)
+ .addButtonAction(actionIcon, "button 1", null /* intent */)
+ .addButtonAction(actionIcon, "button 2", null /* intent */)
.addSettingsAction(0 /* iconId */, "settings", null /* intent */);
}
@@ -184,4 +186,22 @@ public class StandardNotificationBuilderTest extends NativeLibraryTestBase {
assertTrue(expected.sameAs(result));
}
}
+
+ @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT_WATCH)
+ @TargetApi(Build.VERSION_CODES.KITKAT_WATCH) // RemoteInputs were only added in KITKAT_WATCH.
+ @SmallTest
+ @Feature({"Browser", "Notifications"})
+ public void testAddTextActionSetsRemoteInput() {
+ Context context = getInstrumentation().getTargetContext();
+ NotificationBuilderBase notificationBuilder = new StandardNotificationBuilder(
+ context).addTextAction(null, "Action Title", null, "Placeholder");
+
+ Notification notification = notificationBuilder.build();
+
+ assertEquals(1, notification.actions.length);
+ assertEquals("Action Title", notification.actions[0].title);
+ assertNotNull(notification.actions[0].getRemoteInputs());
+ assertEquals(1, notification.actions[0].getRemoteInputs().length);
+ assertEquals("Placeholder", notification.actions[0].getRemoteInputs()[0].getLabel());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698