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

Side by Side Diff: mojo/public/cpp/bindings/tests/wtf_map_unittest.cc

Issue 2759703002: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: rebase, fix one platform-specific reference Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "mojo/public/cpp/bindings/tests/rect_blink.h" 5 #include "mojo/public/cpp/bindings/tests/rect_blink.h"
6 #include "mojo/public/interfaces/bindings/tests/rect.mojom-blink.h" 6 #include "mojo/public/interfaces/bindings/tests/rect.mojom-blink.h"
7 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom-blink.h" 7 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom-blink.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 namespace test { 11 namespace test {
12 namespace { 12 namespace {
13 13
14 TEST(WTFMapTest, StructKey) { 14 TEST(WTFMapTest, StructKey) {
15 WTF::HashMap<blink::RectPtr, int32_t> map; 15 WTF::HashMap<blink::RectPtr, int32_t> map;
16 map.insert(blink::Rect::New(1, 2, 3, 4), 123); 16 map.insert(blink::Rect::New(1, 2, 3, 4), 123);
17 17
18 blink::RectPtr key = blink::Rect::New(1, 2, 3, 4); 18 blink::RectPtr key = blink::Rect::New(1, 2, 3, 4);
19 ASSERT_NE(map.end(), map.find(key)); 19 ASSERT_NE(map.end(), map.find(key));
20 ASSERT_EQ(123, map.find(key)->value); 20 ASSERT_EQ(123, map.find(key)->value);
21 21
22 map.remove(key); 22 map.erase(key);
23 ASSERT_EQ(0u, map.size()); 23 ASSERT_EQ(0u, map.size());
24 } 24 }
25 25
26 TEST(WTFMapTest, TypemappedStructKey) { 26 TEST(WTFMapTest, TypemappedStructKey) {
27 WTF::HashMap<blink::ContainsHashablePtr, int32_t> map; 27 WTF::HashMap<blink::ContainsHashablePtr, int32_t> map;
28 map.insert(blink::ContainsHashable::New(RectBlink(1, 2, 3, 4)), 123); 28 map.insert(blink::ContainsHashable::New(RectBlink(1, 2, 3, 4)), 123);
29 29
30 blink::ContainsHashablePtr key = 30 blink::ContainsHashablePtr key =
31 blink::ContainsHashable::New(RectBlink(1, 2, 3, 4)); 31 blink::ContainsHashable::New(RectBlink(1, 2, 3, 4));
32 ASSERT_NE(map.end(), map.find(key)); 32 ASSERT_NE(map.end(), map.find(key));
33 ASSERT_EQ(123, map.find(key)->value); 33 ASSERT_EQ(123, map.find(key)->value);
34 34
35 map.remove(key); 35 map.erase(key);
36 ASSERT_EQ(0u, map.size()); 36 ASSERT_EQ(0u, map.size());
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 } // namespace test 40 } // namespace test
41 } // namespace mojo 41 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/DOMWrapperWorld.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698