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

Unified Diff: third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp

Issue 1656243002: Implementation of renotify flag for Notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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: third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
index 138423b855eb89338e50aeb2a5dfb3263b2eb119..ac3ca7ce24fa2f47275671806a9c6abc713e19d3 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -23,10 +23,12 @@ const char kNotificationDir[] = "rtl";
const char kNotificationLang[] = "nl";
const char kNotificationBody[] = "Hello, world";
const char kNotificationTag[] = "my_tag";
+const char kNotificationEmptyTag[] = "";
const char kNotificationIcon[] = "https://example.com/icon.png";
const char kNotificationIconInvalid[] = "https://invalid:icon:url";
const unsigned kNotificationVibration[] = { 42, 10, 20, 30, 40 };
const unsigned long long kNotificationTimestamp = 621046800ull;
+const bool kNotificationRenotify = true;
const bool kNotificationSilent = false;
const bool kNotificationRequireInteraction = true;
@@ -77,6 +79,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
options.setIcon(kNotificationIcon);
options.setVibrate(vibrationSequence);
options.setTimestamp(kNotificationTimestamp);
+ options.setRenotify(kNotificationRenotify);
options.setSilent(kNotificationSilent);
options.setRequireInteraction(kNotificationRequireInteraction);
options.setActions(actions);
@@ -101,6 +104,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
EXPECT_EQ(vibrationPattern[i], static_cast<unsigned>(notificationData.vibrate[i]));
EXPECT_EQ(kNotificationTimestamp, notificationData.timestamp);
+ EXPECT_EQ(kNotificationRenotify, notificationData.renotify);
EXPECT_EQ(kNotificationSilent, notificationData.silent);
EXPECT_EQ(kNotificationRequireInteraction, notificationData.requireInteraction);
EXPECT_EQ(actions.size(), notificationData.actions.size());
@@ -130,6 +134,19 @@ TEST_F(NotificationDataTest, SilentNotificationWithVibration)
EXPECT_EQ("Silent notifications must not specify vibration patterns.", exceptionState.message());
}
+TEST_F(NotificationDataTest, RenotifyWithEmptyTag)
+{
+ NotificationOptions options;
+ options.setTag(kNotificationEmptyTag);
+ options.setRenotify(true);
+
+ TrackExceptionState exceptionState;
+ WebNotificationData notificationData = createWebNotificationData(executionContext(), kNotificationTitle, options, exceptionState);
+ ASSERT_TRUE(exceptionState.hadException());
+
+ EXPECT_EQ("Notifications which set the renotify flag must specify a non-empty tag.", exceptionState.message());
+}
+
TEST_F(NotificationDataTest, InvalidIconUrls)
{
HeapVector<NotificationAction> actions;

Powered by Google App Engine
This is Rietveld 408576698