| 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..138423b855eb89338e50aeb2a5dfb3263b2eb119 100644
|
| --- a/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
|
| +++ b/third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp
|
| @@ -24,6 +24,7 @@ const char kNotificationLang[] = "nl";
|
| const char kNotificationBody[] = "Hello, world";
|
| const char kNotificationTag[] = "my_tag";
|
| 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 kNotificationSilent = false;
|
| @@ -31,6 +32,7 @@ const bool kNotificationRequireInteraction = true;
|
|
|
| const char kNotificationActionAction[] = "my_action";
|
| const char kNotificationActionTitle[] = "My Action";
|
| +const char kNotificationActionIcon[] = "https://example.com/action_icon.png";
|
|
|
| const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 };
|
| const int kNotificationVibrationNormalized[] = { 10, 10000, 50 };
|
| @@ -62,6 +64,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
|
| NotificationAction action;
|
| action.setAction(kNotificationActionAction);
|
| action.setTitle(kNotificationActionTitle);
|
| + action.setIcon(kNotificationActionIcon);
|
|
|
| actions.append(action);
|
| }
|
| @@ -91,7 +94,7 @@ TEST_F(NotificationDataTest, ReflectProperties)
|
| EXPECT_EQ(kNotificationBody, notificationData.body);
|
| EXPECT_EQ(kNotificationTag, notificationData.tag);
|
|
|
| - // TODO(peter): Test notificationData.icon when ExecutionContext::completeURL() works in this test.
|
| + // TODO(peter): Test WebNotificationData.icon and WebNotificationAction.icon when ExecutionContext::completeURL() works in this test.
|
|
|
| ASSERT_EQ(vibrationPattern.size(), notificationData.vibrate.size());
|
| for (size_t i = 0; i < vibrationPattern.size(); ++i)
|
| @@ -101,6 +104,10 @@ TEST_F(NotificationDataTest, ReflectProperties)
|
| EXPECT_EQ(kNotificationSilent, notificationData.silent);
|
| EXPECT_EQ(kNotificationRequireInteraction, notificationData.requireInteraction);
|
| EXPECT_EQ(actions.size(), notificationData.actions.size());
|
| + for (const auto& action : notificationData.actions) {
|
| + EXPECT_EQ(kNotificationActionAction, action.action);
|
| + EXPECT_EQ(kNotificationActionTitle, action.title);
|
| + }
|
| }
|
|
|
| TEST_F(NotificationDataTest, SilentNotificationWithVibration)
|
| @@ -123,16 +130,28 @@ TEST_F(NotificationDataTest, SilentNotificationWithVibration)
|
| EXPECT_EQ("Silent notifications must not specify vibration patterns.", exceptionState.message());
|
| }
|
|
|
| -TEST_F(NotificationDataTest, InvalidIconUrl)
|
| +TEST_F(NotificationDataTest, InvalidIconUrls)
|
| {
|
| + HeapVector<NotificationAction> actions;
|
| + for (size_t i = 0; i < Notification::maxActions(); ++i) {
|
| + NotificationAction action;
|
| + action.setAction(kNotificationActionAction);
|
| + action.setTitle(kNotificationActionTitle);
|
| + action.setIcon(kNotificationIconInvalid);
|
| + actions.append(action);
|
| + }
|
| +
|
| NotificationOptions options;
|
| - options.setIcon("https://invalid:icon:url");
|
| + options.setIcon(kNotificationIconInvalid);
|
| + options.setActions(actions);
|
|
|
| TrackExceptionState exceptionState;
|
| WebNotificationData notificationData = createWebNotificationData(executionContext(), kNotificationTitle, options, exceptionState);
|
| ASSERT_FALSE(exceptionState.hadException());
|
|
|
| EXPECT_TRUE(notificationData.icon.isEmpty());
|
| + for (const auto& action : notificationData.actions)
|
| + EXPECT_TRUE(action.icon.isEmpty());
|
| }
|
|
|
| TEST_F(NotificationDataTest, VibrationNormalization)
|
|
|