| Index: mojo/public/cpp/bindings/tests/map_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc
|
| index c74a15d6f8d812563e3dc3595d047c25492ef4af..e64c02eb243510638684d6f2494818c5f2e2285b 100644
|
| --- a/mojo/public/cpp/bindings/tests/map_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
|
| @@ -6,12 +6,14 @@
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| +#include <unordered_map>
|
| #include <utility>
|
|
|
| #include "mojo/public/cpp/bindings/array.h"
|
| #include "mojo/public/cpp/bindings/string.h"
|
| #include "mojo/public/cpp/bindings/tests/container_test_util.h"
|
| #include "mojo/public/cpp/bindings/tests/map_common_test.h"
|
| +#include "mojo/public/interfaces/bindings/tests/rect.mojom.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace mojo {
|
| @@ -222,6 +224,27 @@ TEST_F(MapTest, MoveFromAndToSTLMap_MoveOnly) {
|
| ASSERT_TRUE(mojo_map.is_null());
|
| }
|
|
|
| +static RectPtr MakeRect(int32_t x, int32_t y, int32_t width, int32_t height) {
|
| + RectPtr rect_ptr = Rect::New();
|
| + rect_ptr->x = x;
|
| + rect_ptr->y = y;
|
| + rect_ptr->width = width;
|
| + rect_ptr->height = height;
|
| + return rect_ptr;
|
| +}
|
| +
|
| +TEST_F(MapTest, StructKey) {
|
| + std::unordered_map<RectPtr, int32_t> map;
|
| + map.insert(std::make_pair(MakeRect(1, 2, 3, 4), 123));
|
| +
|
| + RectPtr key = MakeRect(1, 2, 3, 4);
|
| + ASSERT_NE(map.end(), map.find(key));
|
| + ASSERT_EQ(123, map.find(key)->second);
|
| +
|
| + map.erase(key);
|
| + ASSERT_EQ(0u, map.size());
|
| +}
|
| +
|
| } // namespace
|
| } // namespace test
|
| } // namespace mojo
|
|
|