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

Side by Side Diff: third_party/WebKit/Source/wtf/HashMapTest.cpp

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 IntSimpleMap map; 242 IntSimpleMap map;
243 IntSimpleMap::AddResult result = map.add(1, nullptr); 243 IntSimpleMap::AddResult result = map.add(1, nullptr);
244 EXPECT_TRUE(result.isNewEntry); 244 EXPECT_TRUE(result.isNewEntry);
245 EXPECT_EQ(1, result.storedValue->key); 245 EXPECT_EQ(1, result.storedValue->key);
246 EXPECT_EQ(0, result.storedValue->value.get()); 246 EXPECT_EQ(0, result.storedValue->value.get());
247 247
248 SimpleClass* simple1 = new SimpleClass(1); 248 SimpleClass* simple1 = new SimpleClass(1);
249 result.storedValue->value = wrapUnique(simple1); 249 result.storedValue->value = wrapUnique(simple1);
250 EXPECT_EQ(simple1, map.get(1)); 250 EXPECT_EQ(simple1, map.get(1));
251 251
252 IntSimpleMap::AddResult result2 = map.add(1, wrapUnique(new SimpleClass(2))); 252 IntSimpleMap::AddResult result2 = map.add(1, makeUnique<SimpleClass>(2));
253 EXPECT_FALSE(result2.isNewEntry); 253 EXPECT_FALSE(result2.isNewEntry);
254 EXPECT_EQ(1, result.storedValue->key); 254 EXPECT_EQ(1, result.storedValue->key);
255 EXPECT_EQ(1, result.storedValue->value->v()); 255 EXPECT_EQ(1, result.storedValue->value->v());
256 EXPECT_EQ(1, map.get(1)->v()); 256 EXPECT_EQ(1, map.get(1)->v());
257 } 257 }
258 258
259 TEST(HashMapTest, AddResultVectorValue) { 259 TEST(HashMapTest, AddResultVectorValue) {
260 using IntVectorMap = HashMap<int, Vector<int>>; 260 using IntVectorMap = HashMap<int, Vector<int>>;
261 IntVectorMap map; 261 IntVectorMap map;
262 IntVectorMap::AddResult result = map.add(1, Vector<int>()); 262 IntVectorMap::AddResult result = map.add(1, Vector<int>());
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 EXPECT_EQ(130, oneThirty); 649 EXPECT_EQ(130, oneThirty);
650 iter = map.find(Pair(MoveOnly(13), -13)); 650 iter = map.find(Pair(MoveOnly(13), -13));
651 EXPECT_TRUE(iter == map.end()); 651 EXPECT_TRUE(iter == map.end());
652 652
653 map.clear(); 653 map.clear();
654 } 654 }
655 655
656 } // anonymous namespace 656 } // anonymous namespace
657 657
658 } // namespace WTF 658 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/FunctionalTest.cpp ('k') | third_party/WebKit/Source/wtf/HashSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698