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

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

Issue 2337963003: Plumb through notification action types and placeholders on Android (Closed)
Patch Set: Responding to review comments 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/NotificationPlatformBridgeTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
index d22cfc57b3168cc31aa6936db85bf7588c57076a..110831ceb1fd057d349152599b1486e3adfaf38e 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.notifications;
import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
+import android.annotation.TargetApi;
import android.app.Notification;
import android.content.Context;
import android.graphics.Bitmap;
@@ -17,7 +18,9 @@ import android.test.suitebuilder.annotation.MediumTest;
import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.SuppressFBWarnings;
+import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
+import org.chromium.base.test.util.MinAndroidSdkLevel;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.infobar.InfoBar;
@@ -228,6 +231,32 @@ public class NotificationPlatformBridgeTest extends NotificationTestBase {
}
/**
+ * Verifies that specifying a notification action with type: 'text' results in a notification
+ * with a remote input on the action.
+ */
+ @CommandLineFlags.Add("enable-experimental-web-platform-features")
+ @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT_WATCH)
+ @TargetApi(Build.VERSION_CODES.KITKAT_WATCH) // RemoteInputs were only added in KITKAT_WATCH.
+ @MediumTest
+ @Feature({"Browser", "Notifications"})
+ public void testNotificationWithTextAction() throws Exception {
+ setNotificationContentSettingForCurrentOrigin(ContentSetting.ALLOW);
+
+ Notification notification = showAndGetNotification("MyNotification", "{ "
+ + " actions: [{action: 'myAction', title: 'reply', type: 'text',"
+ + " placeholder: 'hi' }]}");
+
+ // The specified action should be present, as well as a default settings action.
+ assertEquals(2, notification.actions.length);
+
+ Notification.Action action = notification.actions[0];
+ assertEquals("reply", action.title);
+ assertNotNull(notification.actions[0].getRemoteInputs());
+ assertEquals(1, action.getRemoteInputs().length);
+ assertEquals("hi", action.getRemoteInputs()[0].getLabel());
+ }
+
+ /**
* Verifies that the ONLY_ALERT_ONCE flag is not set when renotify is true.
*/
@MediumTest

Powered by Google App Engine
This is Rietveld 408576698