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

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

Issue 1750083004: Add badge to web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 9 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 d091b7e87cc891a19a8cc5b4611e3946dee3c992..afac764cb772ee2bd83d41ef161009a5656fcd0e 100644
--- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
+++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
@@ -26,6 +26,7 @@ const char kNotificationTag[] = "my_tag";
const char kNotificationEmptyTag[] = "";
const char kNotificationIcon[] = "https://example.com/icon.png";
const char kNotificationIconInvalid[] = "https://invalid:icon:url";
+const char kNotificationBadge[] = "https://example.com/badge.png";
const unsigned kNotificationVibration[] = { 42, 10, 20, 30, 40 };
const unsigned long long kNotificationTimestamp = 621046800ull;
const bool kNotificationRenotify = true;
@@ -77,6 +78,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
options.setBody(kNotificationBody);
options.setTag(kNotificationTag);
options.setIcon(kNotificationIcon);
+ options.setBadge(kNotificationBadge);
options.setVibrate(vibrationSequence);
options.setTimestamp(kNotificationTimestamp);
options.setRenotify(kNotificationRenotify);
@@ -97,7 +99,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
EXPECT_EQ(kNotificationBody, notificationData.body);
EXPECT_EQ(kNotificationTag, notificationData.tag);
- // TODO(peter): Test WebNotificationData.icon and WebNotificationAction.icon when ExecutionContext::completeURL() works in this test.
+ // TODO(peter): Test the various icon properties when ExecutionContext::completeURL() works in this test.
ASSERT_EQ(vibrationPattern.size(), notificationData.vibrate.size());
for (size_t i = 0; i < vibrationPattern.size(); ++i)
@@ -160,6 +162,7 @@ TEST_F(NotificationDataTest, InvalidIconUrls)
NotificationOptions options;
options.setIcon(kNotificationIconInvalid);
+ options.setBadge(kNotificationIconInvalid);
options.setActions(actions);
TrackExceptionState exceptionState;
@@ -167,6 +170,7 @@ TEST_F(NotificationDataTest, InvalidIconUrls)
ASSERT_FALSE(exceptionState.hadException());
EXPECT_TRUE(notificationData.icon.isEmpty());
+ EXPECT_TRUE(notificationData.badge.isEmpty());
for (const auto& action : notificationData.actions)
EXPECT_TRUE(action.icon.isEmpty());
}

Powered by Google App Engine
This is Rietveld 408576698