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

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: Added TypeError for incorrect options and unit test Created 4 years, 11 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..ec706db8381b355927eae15815913481a47236e7 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -27,7 +27,9 @@ const char kNotificationIcon[] = "https://example.com/icon.png";
const unsigned kNotificationVibration[] = { 42, 10, 20, 30, 40 };
const unsigned long long kNotificationTimestamp = 621046800ull;
const bool kNotificationSilent = false;
+const bool kNotificationRenotify = true;
const bool kNotificationRequireInteraction = true;
+const char kNotificationEmptyTag[] = "";
const char kNotificationActionAction[] = "my_action";
const char kNotificationActionTitle[] = "My Action";
@@ -75,6 +77,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
options.setVibrate(vibrationSequence);
options.setTimestamp(kNotificationTimestamp);
options.setSilent(kNotificationSilent);
+ options.setRenotify(kNotificationRenotify);
options.setRequireInteraction(kNotificationRequireInteraction);
options.setActions(actions);
@@ -99,6 +102,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
EXPECT_EQ(kNotificationTimestamp, notificationData.timestamp);
EXPECT_EQ(kNotificationSilent, notificationData.silent);
+ EXPECT_EQ(kNotificationRenotify, notificationData.renotify);
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 valid tag.", exceptionState.message());
+}
+
TEST_F(NotificationDataTest, InvalidIconUrl)
{
NotificationOptions options;

Powered by Google App Engine
This is Rietveld 408576698