OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <unordered_map> | 7 #include <unordered_map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 EXPECT_EQ(TestEnum::VALUE_0, array_data_view[1]); | 160 EXPECT_EQ(TestEnum::VALUE_0, array_data_view[1]); |
161 EXPECT_EQ(TestEnum::VALUE_0, *(array_data_view.data() + 1)); | 161 EXPECT_EQ(TestEnum::VALUE_0, *(array_data_view.data() + 1)); |
162 | 162 |
163 TestEnum output; | 163 TestEnum output; |
164 ASSERT_TRUE(array_data_view.Read(0, &output)); | 164 ASSERT_TRUE(array_data_view.Read(0, &output)); |
165 EXPECT_EQ(TestEnum::VALUE_1, output); | 165 EXPECT_EQ(TestEnum::VALUE_1, output); |
166 } | 166 } |
167 | 167 |
168 TEST_F(DataViewTest, InterfaceArray) { | 168 TEST_F(DataViewTest, InterfaceArray) { |
169 TestInterfacePtr ptr; | 169 TestInterfacePtr ptr; |
170 TestInterfaceImpl impl(GetProxy(&ptr)); | 170 TestInterfaceImpl impl(MakeRequest(&ptr)); |
171 | 171 |
172 TestStructPtr obj(TestStruct::New()); | 172 TestStructPtr obj(TestStruct::New()); |
173 obj->f_interface_array.push_back(std::move(ptr)); | 173 obj->f_interface_array.push_back(std::move(ptr)); |
174 | 174 |
175 auto data_view_holder = SerializeTestStruct(std::move(obj)); | 175 auto data_view_holder = SerializeTestStruct(std::move(obj)); |
176 auto& data_view = *data_view_holder->data_view; | 176 auto& data_view = *data_view_holder->data_view; |
177 | 177 |
178 ArrayDataView<TestInterfacePtrDataView> array_data_view; | 178 ArrayDataView<TestInterfacePtrDataView> array_data_view; |
179 data_view.GetFInterfaceArrayDataView(&array_data_view); | 179 data_view.GetFInterfaceArrayDataView(&array_data_view); |
180 | 180 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 TestUnionPtr union_ptr2; | 295 TestUnionPtr union_ptr2; |
296 ASSERT_TRUE(array_data_view.Read(0, &union_ptr2)); | 296 ASSERT_TRUE(array_data_view.Read(0, &union_ptr2)); |
297 ASSERT_TRUE(union_ptr2->is_f_int32()); | 297 ASSERT_TRUE(union_ptr2->is_f_int32()); |
298 EXPECT_EQ(1024, union_ptr2->get_f_int32()); | 298 EXPECT_EQ(1024, union_ptr2->get_f_int32()); |
299 } | 299 } |
300 | 300 |
301 } // namespace data_view | 301 } // namespace data_view |
302 } // namespace test | 302 } // namespace test |
303 } // namespace mojo | 303 } // namespace mojo |
OLD | NEW |