| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <utility> | 7 #include <utility> |
| 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 void Echo(PodUnionPtr in, const EchoCallback& callback) override { | 1203 void Echo(PodUnionPtr in, const EchoCallback& callback) override { |
| 1204 callback.Run(std::move(in)); | 1204 callback.Run(std::move(in)); |
| 1205 } | 1205 } |
| 1206 }; | 1206 }; |
| 1207 | 1207 |
| 1208 void ExpectInt16(int16_t value, PodUnionPtr out) { | 1208 void ExpectInt16(int16_t value, PodUnionPtr out) { |
| 1209 EXPECT_EQ(value, out->get_f_int16()); | 1209 EXPECT_EQ(value, out->get_f_int16()); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 TEST(UnionTest, UnionInInterface) { | 1212 TEST(UnionTest, UnionInInterface) { |
| 1213 base::MessageLoop run_loop; | 1213 base::MessageLoop message_loop; |
| 1214 UnionInterfaceImpl impl; | 1214 UnionInterfaceImpl impl; |
| 1215 UnionInterfacePtr ptr; | 1215 UnionInterfacePtr ptr; |
| 1216 Binding<UnionInterface> bindings(&impl, GetProxy(&ptr)); | 1216 Binding<UnionInterface> bindings(&impl, GetProxy(&ptr)); |
| 1217 | 1217 |
| 1218 PodUnionPtr pod(PodUnion::New()); | 1218 PodUnionPtr pod(PodUnion::New()); |
| 1219 pod->set_f_int16(16); | 1219 pod->set_f_int16(16); |
| 1220 | 1220 |
| 1221 ptr->Echo(std::move(pod), base::Bind(&ExpectInt16, 16)); | 1221 ptr->Echo(std::move(pod), base::Bind(&ExpectInt16, 16)); |
| 1222 run_loop.RunUntilIdle(); | 1222 base::RunLoop().RunUntilIdle(); |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 } // namespace test | 1225 } // namespace test |
| 1226 } // namespace mojo | 1226 } // namespace mojo |
| OLD | NEW |