| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/notifications/NotificationData.h" | 5 #include "modules/notifications/NotificationData.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/modules/v8/UnionTypesModules.h" | 8 #include "bindings/modules/v8/UnionTypesModules.h" |
| 9 #include "core/testing/NullExecutionContext.h" | 9 #include "core/testing/NullExecutionContext.h" |
| 10 #include "modules/notifications/Notification.h" | 10 #include "modules/notifications/Notification.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const char kNotificationEmptyTag[] = ""; | 26 const char kNotificationEmptyTag[] = ""; |
| 27 const char kNotificationIcon[] = "https://example.com/icon.png"; | 27 const char kNotificationIcon[] = "https://example.com/icon.png"; |
| 28 const char kNotificationIconInvalid[] = "https://invalid:icon:url"; | 28 const char kNotificationIconInvalid[] = "https://invalid:icon:url"; |
| 29 const char kNotificationBadge[] = "https://example.com/badge.png"; | 29 const char kNotificationBadge[] = "https://example.com/badge.png"; |
| 30 const unsigned kNotificationVibration[] = { 42, 10, 20, 30, 40 }; | 30 const unsigned kNotificationVibration[] = { 42, 10, 20, 30, 40 }; |
| 31 const unsigned long long kNotificationTimestamp = 621046800ull; | 31 const unsigned long long kNotificationTimestamp = 621046800ull; |
| 32 const bool kNotificationRenotify = true; | 32 const bool kNotificationRenotify = true; |
| 33 const bool kNotificationSilent = false; | 33 const bool kNotificationSilent = false; |
| 34 const bool kNotificationRequireInteraction = true; | 34 const bool kNotificationRequireInteraction = true; |
| 35 | 35 |
| 36 const WebNotificationAction::Type kWebNotificationActionType = WebNotificationAc
tion::Text; | 36 const mojom::blink::NotificationActionType kWebNotificationActionType = mojom::b
link::NotificationActionType::TEXT; |
| 37 const char kNotificationActionType[] = "text"; | 37 const char kNotificationActionType[] = "text"; |
| 38 const char kNotificationActionAction[] = "my_action"; | 38 const char kNotificationActionAction[] = "my_action"; |
| 39 const char kNotificationActionTitle[] = "My Action"; | 39 const char kNotificationActionTitle[] = "My Action"; |
| 40 const char kNotificationActionIcon[] = "https://example.com/action_icon.png"; | 40 const char kNotificationActionIcon[] = "https://example.com/action_icon.png"; |
| 41 const char kNotificationActionPlaceholder[] = "Placeholder..."; | 41 const char kNotificationActionPlaceholder[] = "Placeholder..."; |
| 42 | 42 |
| 43 const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; | 43 const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; |
| 44 const int kNotificationVibrationNormalized[] = { 10, 10000, 50 }; | 44 const unsigned kNotificationVibrationNormalized[] = { 10, 10000, 50 }; |
| 45 | 45 |
| 46 class NotificationDataTest : public ::testing::Test { | 46 class NotificationDataTest : public ::testing::Test { |
| 47 public: | 47 public: |
| 48 void SetUp() override | 48 void SetUp() override |
| 49 { | 49 { |
| 50 m_executionContext = new NullExecutionContext(); | 50 m_executionContext = new NullExecutionContext(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 ExecutionContext* getExecutionContext() { return m_executionContext.get(); } | 53 ExecutionContext* getExecutionContext() { return m_executionContext.get(); } |
| 54 | 54 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 options.setVibrate(vibrationSequence); | 87 options.setVibrate(vibrationSequence); |
| 88 options.setTimestamp(kNotificationTimestamp); | 88 options.setTimestamp(kNotificationTimestamp); |
| 89 options.setRenotify(kNotificationRenotify); | 89 options.setRenotify(kNotificationRenotify); |
| 90 options.setSilent(kNotificationSilent); | 90 options.setSilent(kNotificationSilent); |
| 91 options.setRequireInteraction(kNotificationRequireInteraction); | 91 options.setRequireInteraction(kNotificationRequireInteraction); |
| 92 options.setActions(actions); | 92 options.setActions(actions); |
| 93 | 93 |
| 94 // TODO(peter): Test |options.data| and |notificationData.data|. | 94 // TODO(peter): Test |options.data| and |notificationData.data|. |
| 95 | 95 |
| 96 TrackExceptionState exceptionState; | 96 TrackExceptionState exceptionState; |
| 97 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 97 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 98 ASSERT_FALSE(exceptionState.hadException()); | 98 ASSERT_FALSE(exceptionState.hadException()); |
| 99 | 99 |
| 100 EXPECT_EQ(kNotificationTitle, notificationData.title); | 100 EXPECT_EQ(kNotificationTitle, notification->title); |
| 101 | 101 |
| 102 EXPECT_EQ(WebNotificationData::DirectionRightToLeft, notificationData.direct
ion); | 102 EXPECT_EQ(mojom::blink::NotificationDirection::RIGHT_TO_LEFT, notification->
direction); |
| 103 EXPECT_EQ(kNotificationLang, notificationData.lang); | 103 EXPECT_EQ(kNotificationLang, notification->lang); |
| 104 EXPECT_EQ(kNotificationBody, notificationData.body); | 104 EXPECT_EQ(kNotificationBody, notification->body); |
| 105 EXPECT_EQ(kNotificationTag, notificationData.tag); | 105 EXPECT_EQ(kNotificationTag, notification->tag); |
| 106 | 106 |
| 107 // TODO(peter): Test the various icon properties when ExecutionContext::comp
leteURL() works in this test. | 107 // TODO(peter): Test the various icon properties when ExecutionContext::comp
leteURL() works in this test. |
| 108 ASSERT_EQ(vibrationPattern.size(), notification->vibration_pattern.size()); |
| 109 for (size_t i = 0; i < vibrationPattern.size(); ++i) |
| 110 EXPECT_EQ(vibrationPattern[i], static_cast<unsigned>(notification->vibra
tion_pattern[i])); |
| 108 | 111 |
| 109 ASSERT_EQ(vibrationPattern.size(), notificationData.vibrate.size()); | 112 EXPECT_EQ(kNotificationTimestamp, notification->timestamp); |
| 110 for (size_t i = 0; i < vibrationPattern.size(); ++i) | 113 EXPECT_EQ(kNotificationRenotify, notification->renotify); |
| 111 EXPECT_EQ(vibrationPattern[i], static_cast<unsigned>(notificationData.vi
brate[i])); | 114 EXPECT_EQ(kNotificationSilent, notification->silent); |
| 115 EXPECT_EQ(kNotificationRequireInteraction, notification->require_interaction
); |
| 116 EXPECT_EQ(actions.size(), notification->actions.size()); |
| 112 | 117 |
| 113 EXPECT_EQ(kNotificationTimestamp, notificationData.timestamp); | 118 for (size_t i = 0; i < notification->actions.size(); ++i) { |
| 114 EXPECT_EQ(kNotificationRenotify, notificationData.renotify); | 119 SCOPED_TRACE(i); |
| 115 EXPECT_EQ(kNotificationSilent, notificationData.silent); | 120 |
| 116 EXPECT_EQ(kNotificationRequireInteraction, notificationData.requireInteracti
on); | 121 EXPECT_EQ(kWebNotificationActionType, notification->actions[i]->type); |
| 117 EXPECT_EQ(actions.size(), notificationData.actions.size()); | 122 EXPECT_EQ(kNotificationActionAction, notification->actions[i]->action); |
| 118 for (const auto& action : notificationData.actions) { | 123 EXPECT_EQ(kNotificationActionTitle, notification->actions[i]->title); |
| 119 EXPECT_EQ(kWebNotificationActionType, action.type); | 124 EXPECT_EQ(kNotificationActionPlaceholder, notification->actions[i]->plac
eholder); |
| 120 EXPECT_EQ(kNotificationActionAction, action.action); | |
| 121 EXPECT_EQ(kNotificationActionTitle, action.title); | |
| 122 EXPECT_EQ(kNotificationActionPlaceholder, action.placeholder); | |
| 123 } | 125 } |
| 124 } | 126 } |
| 125 | 127 |
| 126 TEST_F(NotificationDataTest, SilentNotificationWithVibration) | 128 TEST_F(NotificationDataTest, SilentNotificationWithVibration) |
| 127 { | 129 { |
| 128 Vector<unsigned> vibrationPattern; | 130 Vector<unsigned> vibrationPattern; |
| 129 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibration); ++i) | 131 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibration); ++i) |
| 130 vibrationPattern.append(kNotificationVibration[i]); | 132 vibrationPattern.append(kNotificationVibration[i]); |
| 131 | 133 |
| 132 UnsignedLongOrUnsignedLongSequence vibrationSequence; | 134 UnsignedLongOrUnsignedLongSequence vibrationSequence; |
| 133 vibrationSequence.setUnsignedLongSequence(vibrationPattern); | 135 vibrationSequence.setUnsignedLongSequence(vibrationPattern); |
| 134 | 136 |
| 135 NotificationOptions options; | 137 NotificationOptions options; |
| 136 options.setVibrate(vibrationSequence); | 138 options.setVibrate(vibrationSequence); |
| 137 options.setSilent(true); | 139 options.setSilent(true); |
| 138 | 140 |
| 139 TrackExceptionState exceptionState; | 141 TrackExceptionState exceptionState; |
| 140 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 142 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 141 ASSERT_TRUE(exceptionState.hadException()); | 143 ASSERT_TRUE(exceptionState.hadException()); |
| 142 | 144 |
| 143 EXPECT_EQ("Silent notifications must not specify vibration patterns.", excep
tionState.message()); | 145 EXPECT_EQ("Silent notifications must not specify vibration patterns.", excep
tionState.message()); |
| 144 } | 146 } |
| 145 | 147 |
| 146 TEST_F(NotificationDataTest, ActionTypeButtonWithPlaceholder) | 148 TEST_F(NotificationDataTest, ActionTypeButtonWithPlaceholder) |
| 147 { | 149 { |
| 148 HeapVector<NotificationAction> actions; | 150 HeapVector<NotificationAction> actions; |
| 149 NotificationAction action; | 151 NotificationAction action; |
| 150 action.setType("button"); | 152 action.setType("button"); |
| 151 action.setPlaceholder("I'm afraid I can't do that..."); | 153 action.setPlaceholder("I'm afraid I can't do that..."); |
| 152 actions.append(action); | 154 actions.append(action); |
| 153 | 155 |
| 154 NotificationOptions options; | 156 NotificationOptions options; |
| 155 options.setActions(actions); | 157 options.setActions(actions); |
| 156 | 158 |
| 157 TrackExceptionState exceptionState; | 159 TrackExceptionState exceptionState; |
| 158 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 160 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 159 ASSERT_TRUE(exceptionState.hadException()); | 161 ASSERT_TRUE(exceptionState.hadException()); |
| 160 | 162 |
| 161 EXPECT_EQ("Notifications of type \"button\" cannot specify a placeholder.",
exceptionState.message()); | 163 EXPECT_EQ("Notifications of type \"button\" cannot specify a placeholder.",
exceptionState.message()); |
| 162 } | 164 } |
| 163 | 165 |
| 164 TEST_F(NotificationDataTest, RenotifyWithEmptyTag) | 166 TEST_F(NotificationDataTest, RenotifyWithEmptyTag) |
| 165 { | 167 { |
| 166 NotificationOptions options; | 168 NotificationOptions options; |
| 167 options.setTag(kNotificationEmptyTag); | 169 options.setTag(kNotificationEmptyTag); |
| 168 options.setRenotify(true); | 170 options.setRenotify(true); |
| 169 | 171 |
| 170 TrackExceptionState exceptionState; | 172 TrackExceptionState exceptionState; |
| 171 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 173 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 172 ASSERT_TRUE(exceptionState.hadException()); | 174 ASSERT_TRUE(exceptionState.hadException()); |
| 173 | 175 |
| 174 EXPECT_EQ("Notifications which set the renotify flag must specify a non-empt
y tag.", exceptionState.message()); | 176 EXPECT_EQ("Notifications which set the renotify flag must specify a non-empt
y tag.", exceptionState.message()); |
| 175 } | 177 } |
| 176 | 178 |
| 177 TEST_F(NotificationDataTest, InvalidIconUrls) | 179 TEST_F(NotificationDataTest, InvalidIconUrls) |
| 178 { | 180 { |
| 179 HeapVector<NotificationAction> actions; | 181 HeapVector<NotificationAction> actions; |
| 180 for (size_t i = 0; i < Notification::maxActions(); ++i) { | 182 for (size_t i = 0; i < Notification::maxActions(); ++i) { |
| 181 NotificationAction action; | 183 NotificationAction action; |
| 182 action.setAction(kNotificationActionAction); | 184 action.setAction(kNotificationActionAction); |
| 183 action.setTitle(kNotificationActionTitle); | 185 action.setTitle(kNotificationActionTitle); |
| 184 action.setIcon(kNotificationIconInvalid); | 186 action.setIcon(kNotificationIconInvalid); |
| 185 actions.append(action); | 187 actions.append(action); |
| 186 } | 188 } |
| 187 | 189 |
| 188 NotificationOptions options; | 190 NotificationOptions options; |
| 189 options.setIcon(kNotificationIconInvalid); | 191 options.setIcon(kNotificationIconInvalid); |
| 190 options.setBadge(kNotificationIconInvalid); | 192 options.setBadge(kNotificationIconInvalid); |
| 191 options.setActions(actions); | 193 options.setActions(actions); |
| 192 | 194 |
| 193 TrackExceptionState exceptionState; | 195 TrackExceptionState exceptionState; |
| 194 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 196 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 195 ASSERT_FALSE(exceptionState.hadException()); | 197 ASSERT_FALSE(exceptionState.hadException()); |
| 196 | 198 |
| 197 EXPECT_TRUE(notificationData.icon.isEmpty()); | 199 EXPECT_TRUE(notification->icon.isEmpty()); |
| 198 EXPECT_TRUE(notificationData.badge.isEmpty()); | 200 EXPECT_TRUE(notification->badge.isEmpty()); |
| 199 for (const auto& action : notificationData.actions) | 201 |
| 200 EXPECT_TRUE(action.icon.isEmpty()); | 202 for (size_t i = 0; i < notification->actions.size(); ++i) |
| 203 EXPECT_TRUE(notification->actions[i]->icon.isEmpty()); |
| 201 } | 204 } |
| 202 | 205 |
| 203 TEST_F(NotificationDataTest, VibrationNormalization) | 206 TEST_F(NotificationDataTest, VibrationNormalization) |
| 204 { | 207 { |
| 205 Vector<unsigned> unnormalizedPattern; | 208 Vector<unsigned> unnormalizedPattern; |
| 206 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibrationUnnormalized);
++i) | 209 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibrationUnnormalized);
++i) |
| 207 unnormalizedPattern.append(kNotificationVibrationUnnormalized[i]); | 210 unnormalizedPattern.append(kNotificationVibrationUnnormalized[i]); |
| 208 | 211 |
| 209 UnsignedLongOrUnsignedLongSequence vibrationSequence; | 212 UnsignedLongOrUnsignedLongSequence vibrationSequence; |
| 210 vibrationSequence.setUnsignedLongSequence(unnormalizedPattern); | 213 vibrationSequence.setUnsignedLongSequence(unnormalizedPattern); |
| 211 | 214 |
| 212 NotificationOptions options; | 215 NotificationOptions options; |
| 213 options.setVibrate(vibrationSequence); | 216 options.setVibrate(vibrationSequence); |
| 214 | 217 |
| 215 TrackExceptionState exceptionState; | 218 TrackExceptionState exceptionState; |
| 216 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 219 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 217 EXPECT_FALSE(exceptionState.hadException()); | 220 EXPECT_FALSE(exceptionState.hadException()); |
| 218 | 221 |
| 219 Vector<int> normalizedPattern; | 222 Vector<unsigned> normalizedPattern; |
| 220 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibrationNormalized); +
+i) | 223 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibrationNormalized); +
+i) |
| 221 normalizedPattern.append(kNotificationVibrationNormalized[i]); | 224 normalizedPattern.append(kNotificationVibrationNormalized[i]); |
| 222 | 225 |
| 223 ASSERT_EQ(normalizedPattern.size(), notificationData.vibrate.size()); | 226 ASSERT_EQ(normalizedPattern.size(), notification->vibration_pattern.size()); |
| 224 for (size_t i = 0; i < normalizedPattern.size(); ++i) | 227 for (size_t i = 0; i < normalizedPattern.size(); ++i) |
| 225 EXPECT_EQ(normalizedPattern[i], notificationData.vibrate[i]); | 228 EXPECT_EQ(normalizedPattern[i], notification->vibration_pattern[i]); |
| 226 } | 229 } |
| 227 | 230 |
| 228 TEST_F(NotificationDataTest, DefaultTimestampValue) | 231 TEST_F(NotificationDataTest, DefaultTimestampValue) |
| 229 { | 232 { |
| 230 NotificationOptions options; | 233 NotificationOptions options; |
| 231 | 234 |
| 232 TrackExceptionState exceptionState; | 235 TrackExceptionState exceptionState; |
| 233 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 236 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 234 EXPECT_FALSE(exceptionState.hadException()); | 237 EXPECT_FALSE(exceptionState.hadException()); |
| 235 | 238 |
| 236 // The timestamp should be set to the current time since the epoch if it was
n't supplied by the developer. | 239 // The timestamp should be set to the current time since the epoch if it was
n't supplied by the developer. |
| 237 // "32" has no significance, but an equal comparison of the value could lead
to flaky failures. | 240 // "32" has no significance, but an equal comparison of the value could lead
to flaky failures. |
| 238 EXPECT_NEAR(notificationData.timestamp, WTF::currentTimeMS(), 32); | 241 EXPECT_NEAR(notification->timestamp, WTF::currentTimeMS(), 32); |
| 239 } | 242 } |
| 240 | 243 |
| 241 TEST_F(NotificationDataTest, DirectionValues) | 244 TEST_F(NotificationDataTest, DirectionValues) |
| 242 { | 245 { |
| 243 WTF::HashMap<String, WebNotificationData::Direction> mappings; | 246 WTF::HashMap<String, mojom::blink::NotificationDirection> mappings; |
| 244 mappings.add("ltr", WebNotificationData::DirectionLeftToRight); | 247 mappings.add("ltr", mojom::blink::NotificationDirection::LEFT_TO_RIGHT); |
| 245 mappings.add("rtl", WebNotificationData::DirectionRightToLeft); | 248 mappings.add("rtl", mojom::blink::NotificationDirection::RIGHT_TO_LEFT); |
| 246 mappings.add("auto", WebNotificationData::DirectionAuto); | 249 mappings.add("auto", mojom::blink::NotificationDirection::AUTO); |
| 247 | 250 |
| 248 // Invalid values should default to "auto". | 251 // Invalid values should default to "auto". |
| 249 mappings.add("peter", WebNotificationData::DirectionAuto); | 252 mappings.add("peter", mojom::blink::NotificationDirection::AUTO); |
| 250 | 253 |
| 251 for (const String& direction : mappings.keys()) { | 254 for (const String& direction : mappings.keys()) { |
| 252 NotificationOptions options; | 255 NotificationOptions options; |
| 253 options.setDir(direction); | 256 options.setDir(direction); |
| 254 | 257 |
| 255 TrackExceptionState exceptionState; | 258 TrackExceptionState exceptionState; |
| 256 WebNotificationData notificationData = createWebNotificationData(getExec
utionContext(), kNotificationTitle, options, exceptionState); | 259 mojom::blink::NotificationPtr notification = createNotificationData(getE
xecutionContext(), kNotificationTitle, options, exceptionState); |
| 257 ASSERT_FALSE(exceptionState.hadException()); | 260 ASSERT_FALSE(exceptionState.hadException()); |
| 258 | 261 |
| 259 EXPECT_EQ(mappings.get(direction), notificationData.direction); | 262 EXPECT_EQ(mappings.get(direction), notification->direction); |
| 260 } | 263 } |
| 261 } | 264 } |
| 262 | 265 |
| 263 TEST_F(NotificationDataTest, MaximumActionCount) | 266 TEST_F(NotificationDataTest, MaximumActionCount) |
| 264 { | 267 { |
| 265 HeapVector<NotificationAction> actions; | 268 HeapVector<NotificationAction> actions; |
| 266 for (size_t i = 0; i < Notification::maxActions() + 2; ++i) { | 269 for (size_t i = 0; i < Notification::maxActions() + 2; ++i) { |
| 267 NotificationAction action; | 270 NotificationAction action; |
| 268 action.setAction(String::number(i)); | 271 action.setAction(String::number(i)); |
| 269 action.setTitle(kNotificationActionTitle); | 272 action.setTitle(kNotificationActionTitle); |
| 270 | 273 |
| 271 actions.append(action); | 274 actions.append(action); |
| 272 } | 275 } |
| 273 | 276 |
| 274 NotificationOptions options; | 277 NotificationOptions options; |
| 275 options.setActions(actions); | 278 options.setActions(actions); |
| 276 | 279 |
| 277 TrackExceptionState exceptionState; | 280 TrackExceptionState exceptionState; |
| 278 WebNotificationData notificationData = createWebNotificationData(getExecutio
nContext(), kNotificationTitle, options, exceptionState); | 281 mojom::blink::NotificationPtr notification = createNotificationData(getExecu
tionContext(), kNotificationTitle, options, exceptionState); |
| 279 ASSERT_FALSE(exceptionState.hadException()); | 282 ASSERT_FALSE(exceptionState.hadException()); |
| 280 | 283 |
| 281 // The stored actions will be capped to |maxActions| entries. | 284 // The stored actions will be capped to |maxActions| entries. |
| 282 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size()); | 285 ASSERT_EQ(Notification::maxActions(), notification->actions.size()); |
| 283 | 286 |
| 284 for (size_t i = 0; i < Notification::maxActions(); ++i) { | 287 for (size_t i = 0; i < Notification::maxActions(); ++i) |
| 285 WebString expectedAction = String::number(i); | 288 EXPECT_EQ(String::number(i), notification->actions[i]->action); |
| 286 EXPECT_EQ(expectedAction, notificationData.actions[i].action); | |
| 287 } | |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace | 291 } // namespace |
| 291 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |