| 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 <utility> | 5 #include <utility> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "gtest/gtest.h" |
| 8 #include "mojo/public/cpp/bindings/array.h" | 9 #include "mojo/public/cpp/bindings/array.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
| 10 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 11 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
| 11 #include "mojo/public/cpp/bindings/lib/array_serialization.h" | 12 #include "mojo/public/cpp/bindings/lib/array_serialization.h" |
| 12 #include "mojo/public/cpp/bindings/lib/bounds_checker.h" | 13 #include "mojo/public/cpp/bindings/lib/bounds_checker.h" |
| 13 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" | 14 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" |
| 14 #include "mojo/public/cpp/bindings/lib/map_serialization.h" | 15 #include "mojo/public/cpp/bindings/lib/map_serialization.h" |
| 15 #include "mojo/public/cpp/bindings/string.h" | 16 #include "mojo/public/cpp/bindings/string.h" |
| 16 #include "mojo/public/cpp/test_support/test_utils.h" | 17 #include "mojo/public/cpp/test_support/test_utils.h" |
| 17 #include "mojo/public/cpp/utility/run_loop.h" | 18 #include "mojo/public/cpp/utility/run_loop.h" |
| 18 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" | 19 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" |
| 19 #include "mojo/public/interfaces/bindings/tests/test_unions.mojom.h" | 20 #include "mojo/public/interfaces/bindings/tests/test_unions.mojom.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | |
| 21 | 21 |
| 22 namespace mojo { | 22 namespace mojo { |
| 23 namespace test { | 23 namespace test { |
| 24 | 24 |
| 25 TEST(UnionTest, PlainOldDataGetterSetter) { | 25 TEST(UnionTest, PlainOldDataGetterSetter) { |
| 26 PodUnionPtr pod(PodUnion::New()); | 26 PodUnionPtr pod(PodUnion::New()); |
| 27 | 27 |
| 28 pod->set_f_int8(10); | 28 pod->set_f_int8(10); |
| 29 EXPECT_EQ(10, pod->get_f_int8()); | 29 EXPECT_EQ(10, pod->get_f_int8()); |
| 30 EXPECT_TRUE(pod->is_f_int8()); | 30 EXPECT_TRUE(pod->is_f_int8()); |
| (...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 PodUnionPtr pod(PodUnion::New()); | 1244 PodUnionPtr pod(PodUnion::New()); |
| 1245 pod->set_f_int16(16); | 1245 pod->set_f_int16(16); |
| 1246 | 1246 |
| 1247 ptr->Echo(pod.Pass(), | 1247 ptr->Echo(pod.Pass(), |
| 1248 [](PodUnionPtr out) { EXPECT_EQ(16, out->get_f_int16()); }); | 1248 [](PodUnionPtr out) { EXPECT_EQ(16, out->get_f_int16()); }); |
| 1249 run_loop.RunUntilIdle(); | 1249 run_loop.RunUntilIdle(); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 } // namespace test | 1252 } // namespace test |
| 1253 } // namespace mojo | 1253 } // namespace mojo |
| OLD | NEW |