Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
yzshen1
2017/03/02 17:25:03
2017?
tibell
2017/03/02 23:16:50
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mojo/public/cpp/bindings/tests/rect_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" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace mojo { | |
| 11 namespace test { | |
| 12 namespace { | |
| 13 | |
| 14 TEST(WTFMapTest, StructKey) { | |
| 15 WTF::HashMap<blink::RectPtr, int32_t> map; | |
| 16 map.insert(blink::Rect::New(1, 2, 3, 4), 123); | |
| 17 | |
| 18 blink::RectPtr key = blink::Rect::New(1, 2, 3, 4); | |
| 19 ASSERT_NE(map.end(), map.find(key)); | |
| 20 ASSERT_EQ(123, map.find(key)->value); | |
| 21 | |
| 22 map.remove(key); | |
| 23 ASSERT_EQ(0u, map.size()); | |
| 24 } | |
| 25 | |
| 26 TEST(WTFMapTest, TypemappedStructKey) { | |
| 27 WTF::HashMap<blink::ContainsHashablePtr, int32_t> map; | |
| 28 map.insert(blink::ContainsHashable::New(RectBlink(1, 2, 3, 4)), 123); | |
| 29 | |
| 30 blink::ContainsHashablePtr key = | |
| 31 blink::ContainsHashable::New(RectBlink(1, 2, 3, 4)); | |
| 32 ASSERT_NE(map.end(), map.find(key)); | |
| 33 ASSERT_EQ(123, map.find(key)->value); | |
| 34 | |
| 35 map.remove(key); | |
| 36 ASSERT_EQ(0u, map.size()); | |
| 37 } | |
| 38 | |
| 39 } // namespace | |
| 40 } // namespace test | |
| 41 } // namespace mojo | |
| OLD | NEW |