Chromium Code Reviews| 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..756ce6414ba63387e3f37b47fc85be93b6d6a812 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,19 @@ public class StandardNotificationBuilderTest extends NativeLibraryTestBase { |
| assertTrue(expected.sameAs(result)); |
| } |
| } |
| + |
| + @MinAndroidSdkLevel(20) // RemoteInputs were only added in API 20. |
| + @TargetApi(Build.VERSION_CODES.KITKAT_WATCH) |
| + @SmallTest |
| + @Feature({"Browser", "Notifications"}) |
| + public void testAddTextActionSetsRemoteInput() { |
| + Context context = getInstrumentation().getTargetContext(); |
| + NotificationBuilderBase notificationBuilder = new StandardNotificationBuilder(context); |
| + |
| + notificationBuilder.addTextAction(null, "Action Title", null, "Placeholder"); |
| + |
| + Notification notification = notificationBuilder.build(); |
| + assertEquals("Action Title", notification.actions[0].title); |
| + assertEquals("Placeholder", notification.actions[0].getRemoteInputs()[0].getLabel()); |
|
Peter Beverloo
2016/09/22 18:07:55
nit: should we assert that getRemoveInputs() has e
awdf
2016/09/23 15:24:56
Slightly nicer to assert it explicitly I think. An
|
| + } |
| } |