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

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

Issue 2039953002: Add a preference for disabling vibration in notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Address Dan's comments. Created 4 years, 6 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/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
index e101cd2af45dd99ab013594becc1ac6c774aa543..73794384a279c5910190bd46f9651fdaf93ff069 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeTest.java
@@ -58,17 +58,23 @@ public void testGetOriginFromTag() throws Exception {
@Test
@Feature({"Browser", "Notifications"})
public void testMakeDefaults() throws Exception {
- // 0 should be returned if silent is true and vibration's length is 0.
- assertEquals(0, NotificationPlatformBridge.makeDefaults(0, true));
+ // 0 should be returned if pattern length is 0, silent is true, and vibration is enabled.
+ assertEquals(0, NotificationPlatformBridge.makeDefaults(0, true, true));
- // Notification.DEFAULT_ALL should be returned if silent is false and
- // vibration's length is 0.
- assertEquals(Notification.DEFAULT_ALL, NotificationPlatformBridge.makeDefaults(0, false));
+ // Notification.DEFAULT_ALL should be returned if pattern length is 0, silent is false and
+ // vibration is enabled.
+ assertEquals(
+ Notification.DEFAULT_ALL, NotificationPlatformBridge.makeDefaults(0, false, true));
+
+ // Vibration should be removed from the defaults if pattern length is greater than 0, silent
+ // is false, and vibration is enabled.
+ assertEquals(Notification.DEFAULT_ALL & ~Notification.DEFAULT_VIBRATE,
+ NotificationPlatformBridge.makeDefaults(10, false, true));
- // Notification.DEFAULT_ALL & ~Notification.DEFAULT_VIBRATE should be returned
- // if silent is false and vibration's length is greater than 0.
+ // Vibration should be removed from the defaults if pattern length is greater than 0, silent
+ // is false, and vibration is disabled.
assertEquals(Notification.DEFAULT_ALL & ~Notification.DEFAULT_VIBRATE,
- NotificationPlatformBridge.makeDefaults(10, false));
+ NotificationPlatformBridge.makeDefaults(7, false, false));
}
/**

Powered by Google App Engine
This is Rietveld 408576698