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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/NotificationDataTest.cpp

Issue 2671933002: Migrate WTF::HashMap::add() to ::insert() (Closed)
Patch Set: rebase, add TODOs Created 3 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 unified diff | Download patch
OLDNEW
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 "core/testing/NullExecutionContext.h" 8 #include "core/testing/NullExecutionContext.h"
9 #include "modules/notifications/Notification.h" 9 #include "modules/notifications/Notification.h"
10 #include "modules/notifications/NotificationOptions.h" 10 #include "modules/notifications/NotificationOptions.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 EXPECT_FALSE(exceptionState.hadException()); 245 EXPECT_FALSE(exceptionState.hadException());
246 246
247 // The timestamp should be set to the current time since the epoch if it 247 // The timestamp should be set to the current time since the epoch if it
248 // wasn't supplied by the developer. "32" has no significance, but an equal 248 // wasn't supplied by the developer. "32" has no significance, but an equal
249 // comparison of the value could lead to flaky failures. 249 // comparison of the value could lead to flaky failures.
250 EXPECT_NEAR(notificationData.timestamp, WTF::currentTimeMS(), 32); 250 EXPECT_NEAR(notificationData.timestamp, WTF::currentTimeMS(), 32);
251 } 251 }
252 252
253 TEST_F(NotificationDataTest, DirectionValues) { 253 TEST_F(NotificationDataTest, DirectionValues) {
254 WTF::HashMap<String, WebNotificationData::Direction> mappings; 254 WTF::HashMap<String, WebNotificationData::Direction> mappings;
255 mappings.add("ltr", WebNotificationData::DirectionLeftToRight); 255 mappings.insert("ltr", WebNotificationData::DirectionLeftToRight);
256 mappings.add("rtl", WebNotificationData::DirectionRightToLeft); 256 mappings.insert("rtl", WebNotificationData::DirectionRightToLeft);
257 mappings.add("auto", WebNotificationData::DirectionAuto); 257 mappings.insert("auto", WebNotificationData::DirectionAuto);
258 258
259 // Invalid values should default to "auto". 259 // Invalid values should default to "auto".
260 mappings.add("peter", WebNotificationData::DirectionAuto); 260 mappings.insert("peter", WebNotificationData::DirectionAuto);
261 261
262 for (const String& direction : mappings.keys()) { 262 for (const String& direction : mappings.keys()) {
263 NotificationOptions options; 263 NotificationOptions options;
264 options.setDir(direction); 264 options.setDir(direction);
265 265
266 DummyExceptionStateForTesting exceptionState; 266 DummyExceptionStateForTesting exceptionState;
267 WebNotificationData notificationData = createWebNotificationData( 267 WebNotificationData notificationData = createWebNotificationData(
268 getExecutionContext(), kNotificationTitle, options, exceptionState); 268 getExecutionContext(), kNotificationTitle, options, exceptionState);
269 ASSERT_FALSE(exceptionState.hadException()); 269 ASSERT_FALSE(exceptionState.hadException());
270 270
(...skipping 23 matching lines...) Expand all
294 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size()); 294 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size());
295 295
296 for (size_t i = 0; i < Notification::maxActions(); ++i) { 296 for (size_t i = 0; i < Notification::maxActions(); ++i) {
297 WebString expectedAction = String::number(i); 297 WebString expectedAction = String::number(i);
298 EXPECT_EQ(expectedAction, notificationData.actions[i].action); 298 EXPECT_EQ(expectedAction, notificationData.actions[i].action);
299 } 299 }
300 } 300 }
301 301
302 } // namespace 302 } // namespace
303 } // namespace blink 303 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698