OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/array.h" | 5 #include "mojo/public/cpp/bindings/array.h" |
6 #include "mojo/public/cpp/bindings/lib/array_serialization.h" | 6 #include "mojo/public/cpp/bindings/lib/array_serialization.h" |
7 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 7 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" | 8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" |
9 #include "mojo/public/cpp/bindings/map.h" | 9 #include "mojo/public/cpp/bindings/map.h" |
10 #include "mojo/public/cpp/bindings/string.h" | 10 #include "mojo/public/cpp/bindings/string.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 {"one", 1}, | 25 {"one", 1}, |
26 {"two", 2}, | 26 {"two", 2}, |
27 {"three", 3}, | 27 {"three", 3}, |
28 {"four", 4}, | 28 {"four", 4}, |
29 }; | 29 }; |
30 | 30 |
31 const size_t kStringIntDataSize = 4; | 31 const size_t kStringIntDataSize = 4; |
32 | 32 |
33 class MapTest : public testing::Test { | 33 class MapTest : public testing::Test { |
34 public: | 34 public: |
35 virtual ~MapTest() {} | 35 ~MapTest() override {} |
36 | 36 |
37 private: | 37 private: |
38 Environment env_; | 38 Environment env_; |
39 }; | 39 }; |
40 | 40 |
41 // Tests that basic Map operations work. | 41 // Tests that basic Map operations work. |
42 TEST_F(MapTest, InsertWorks) { | 42 TEST_F(MapTest, InsertWorks) { |
43 Map<String, int> map; | 43 Map<String, int> map; |
44 for (size_t i = 0; i < kStringIntDataSize; ++i) | 44 for (size_t i = 0; i < kStringIntDataSize; ++i) |
45 map.insert(kStringIntData[i].string_data, kStringIntData[i].int_data); | 45 map.insert(kStringIntData[i].string_data, kStringIntData[i].int_data); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 ASSERT_EQ(1u, to_receive->second.size()); | 399 ASSERT_EQ(1u, to_receive->second.size()); |
400 ASSERT_EQ(1u, to_receive->second[0].size()); | 400 ASSERT_EQ(1u, to_receive->second[0].size()); |
401 ASSERT_FALSE(to_receive->second[0].at("hello world")[0]); | 401 ASSERT_FALSE(to_receive->second[0].at("hello world")[0]); |
402 ASSERT_TRUE(to_receive->second[0].at("hello world")[1]); | 402 ASSERT_TRUE(to_receive->second[0].at("hello world")[1]); |
403 } | 403 } |
404 | 404 |
405 } // namespace | 405 } // namespace |
406 } // namespace test | 406 } // namespace test |
407 } // namespace mojo | 407 } // namespace mojo |
OLD | NEW |