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

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

Issue 2470233009: WTF/std normalization: replace WTF::Vector::first() with ::front() (Closed)
Patch Set: rebase Created 4 years 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
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>());
263 EXPECT_TRUE(result.isNewEntry); 263 EXPECT_TRUE(result.isNewEntry);
264 EXPECT_EQ(1, result.storedValue->key); 264 EXPECT_EQ(1, result.storedValue->key);
265 EXPECT_EQ(0u, result.storedValue->value.size()); 265 EXPECT_EQ(0u, result.storedValue->value.size());
266 266
267 result.storedValue->value.append(11); 267 result.storedValue->value.append(11);
268 EXPECT_EQ(1u, map.find(1)->value.size()); 268 EXPECT_EQ(1u, map.find(1)->value.size());
269 EXPECT_EQ(11, map.find(1)->value.first()); 269 EXPECT_EQ(11, map.find(1)->value.front());
270 270
271 IntVectorMap::AddResult result2 = map.add(1, Vector<int>()); 271 IntVectorMap::AddResult result2 = map.add(1, Vector<int>());
272 EXPECT_FALSE(result2.isNewEntry); 272 EXPECT_FALSE(result2.isNewEntry);
273 EXPECT_EQ(1, result.storedValue->key); 273 EXPECT_EQ(1, result.storedValue->key);
274 EXPECT_EQ(1u, result.storedValue->value.size()); 274 EXPECT_EQ(1u, result.storedValue->value.size());
275 EXPECT_EQ(11, result.storedValue->value.first()); 275 EXPECT_EQ(11, result.storedValue->value.front());
276 EXPECT_EQ(11, map.find(1)->value.first()); 276 EXPECT_EQ(11, map.find(1)->value.front());
277 } 277 }
278 278
279 class InstanceCounter { 279 class InstanceCounter {
280 public: 280 public:
281 InstanceCounter() { ++counter; } 281 InstanceCounter() { ++counter; }
282 InstanceCounter(const InstanceCounter& another) { ++counter; } 282 InstanceCounter(const InstanceCounter& another) { ++counter; }
283 ~InstanceCounter() { --counter; } 283 ~InstanceCounter() { --counter; }
284 static int counter; 284 static int counter;
285 }; 285 };
286 int InstanceCounter::counter = 0; 286 int InstanceCounter::counter = 0;
(...skipping 362 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/web/SuspendableScriptExecutor.cpp ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698