OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 loop.Run(); | 245 loop.Run(); |
246 } | 246 } |
247 | 247 |
248 TEST_F(StructTraitsTest, CloneStructWithTraitsContainer) { | 248 TEST_F(StructTraitsTest, CloneStructWithTraitsContainer) { |
249 StructWithTraitsContainerPtr container = StructWithTraitsContainer::New(); | 249 StructWithTraitsContainerPtr container = StructWithTraitsContainer::New(); |
250 container->f_struct.set_uint32(7); | 250 container->f_struct.set_uint32(7); |
251 container->f_struct.set_uint64(42); | 251 container->f_struct.set_uint64(42); |
252 StructWithTraitsContainerPtr cloned_container = container.Clone(); | 252 StructWithTraitsContainerPtr cloned_container = container.Clone(); |
253 EXPECT_EQ(7u, cloned_container->f_struct.get_uint32()); | 253 EXPECT_EQ(7u, cloned_container->f_struct.get_uint32()); |
254 EXPECT_EQ(42u, cloned_container->f_struct.get_uint64()); | 254 EXPECT_EQ(42u, cloned_container->f_struct.get_uint64()); |
255 | |
256 } | 255 } |
257 | 256 |
258 TEST_F(StructTraitsTest, EchoPassByValueStructWithTraits) { | 257 TEST_F(StructTraitsTest, EchoPassByValueStructWithTraits) { |
259 MessagePipe mp; | 258 MessagePipe mp; |
260 PassByValueStructWithTraitsImpl input; | 259 PassByValueStructWithTraitsImpl input; |
261 input.get_mutable_handle().reset(mp.handle0.release()); | 260 input.get_mutable_handle().reset(mp.handle0.release()); |
262 | 261 |
263 base::RunLoop loop; | 262 base::RunLoop loop; |
264 TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 263 TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
265 | 264 |
(...skipping 22 matching lines...) Expand all Loading... |
288 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 287 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
289 EXPECT_EQ(MOJO_RESULT_OK, | 288 EXPECT_EQ(MOJO_RESULT_OK, |
290 ReadMessageRaw(received.get(), buffer, &buffer_size, nullptr, | 289 ReadMessageRaw(received.get(), buffer, &buffer_size, nullptr, |
291 nullptr, MOJO_READ_MESSAGE_FLAG_NONE)); | 290 nullptr, MOJO_READ_MESSAGE_FLAG_NONE)); |
292 EXPECT_EQ(kHelloSize, buffer_size); | 291 EXPECT_EQ(kHelloSize, buffer_size); |
293 EXPECT_STREQ(kHello, buffer); | 292 EXPECT_STREQ(kHello, buffer); |
294 } | 293 } |
295 | 294 |
296 } // namespace test | 295 } // namespace test |
297 } // namespace mojo | 296 } // namespace mojo |
OLD | NEW |