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

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

Issue 1054573002: Implement support for notification.vibrate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/NotificationUIManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
index b6534171d623ccbbb3aaa6bf38603ad2fc97731d..71b1f911ead9911fbd26ddef48ab70e9891dc82f 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java
@@ -27,6 +27,7 @@ import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.JavaScriptUtils;
+import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeoutException;
@@ -383,4 +384,35 @@ public class NotificationUIManagerTest extends ChromeShellTestBase {
assertNull(NotificationUIManager.getOriginFromTag(
"NotificationUIManager;SystemDownloadNotifier;42"));
}
+
+ /**
+ * Verifies that the makeDefaults method returns the generated notification defaults.
+ */
+ @SmallTest
+ @Feature({"Browser", "Notifications"})
+ public void testMakeDefaults() throws Exception {
+ // 0 should be returned if silent is true and vibration's length is 0.
+ assertEquals(0, NotificationUIManager.makeDefaults(0, true));
+
+ // Notification.DEFAULT_ALL should be returned if silent is false and
+ // vibration's length is 0.
+ assertEquals(Notification.DEFAULT_ALL,
+ NotificationUIManager.makeDefaults(0, false));
+
+ // Notification.DEFAULT_ALL & ~Notification.DEFAULT_VIBRATE should be returned
+ // if silent is false and vibration's length is greater than 0.
+ assertEquals(Notification.DEFAULT_ALL & ~Notification.DEFAULT_VIBRATE,
+ NotificationUIManager.makeDefaults(10, false));
+ }
+
+ /**
+ * Verifies that the makeVibrationPattern method returns vibration pattern used
+ * in Android notification.
+ */
+ @SmallTest
+ @Feature({"Browser", "Notifications"})
+ public void testMakeVibrationPattern() throws Exception {
+ assertTrue(Arrays.equals(new long[] {0, 100, 200, 300},
+ NotificationUIManager.makeVibrationPattern(new int[] {100, 200, 300})));
+ }
}

Powered by Google App Engine
This is Rietveld 408576698