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

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: Fix LayoutTests interface tests 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 0a030bbe1e0e57a5fe8d4b485cfceea53796b2e6..3bf34f265579f20426e3362ac15ca3900aebc2f1 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -23,9 +23,11 @@ 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 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;
@@ -74,6 +76,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);
@@ -98,6 +101,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());
@@ -123,6 +127,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, InvalidIconUrl)
{
NotificationOptions options;

Powered by Google App Engine
This is Rietveld 408576698