| Index: mojo/public/cpp/bindings/tests/struct_traits_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc b/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc
|
| index 583dc460be4f268ff9d5e6b0e10b5a50f9353565..15b8d6ca62bbab0905c0ca7a4eda23d7aa633ea8 100644
|
| --- a/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc
|
| @@ -134,9 +134,15 @@ class StructTraitsTest : public testing::Test,
|
| callback.Run(s);
|
| }
|
|
|
| - void EchoPassByValueStructWithTraits(
|
| - PassByValueStructWithTraitsImpl s,
|
| - const EchoPassByValueStructWithTraitsCallback& callback) override {
|
| + void EchoTrivialStructWithTraits(
|
| + TrivialStructWithTraitsImpl s,
|
| + const EchoTrivialStructWithTraitsCallback& callback) override {
|
| + callback.Run(s);
|
| + }
|
| +
|
| + void EchoMoveOnlyStructWithTraits(
|
| + MoveOnlyStructWithTraitsImpl s,
|
| + const EchoMoveOnlyStructWithTraitsCallback& callback) override {
|
| callback.Run(std::move(s));
|
| }
|
|
|
| @@ -274,24 +280,44 @@ TEST_F(StructTraitsTest, CloneStructWithTraitsContainer) {
|
| EXPECT_EQ(42u, cloned_container->f_struct.get_uint64());
|
| }
|
|
|
| +void ExpectTrivialStructWithTraits(TrivialStructWithTraitsImpl expected,
|
| + const base::Closure& closure,
|
| + TrivialStructWithTraitsImpl passed) {
|
| + EXPECT_EQ(expected.value, passed.value);
|
| + closure.Run();
|
| +}
|
| +
|
| +TEST_F(StructTraitsTest, EchoTrivialStructWithTraits) {
|
| + TrivialStructWithTraitsImpl input;
|
| + input.value = 42;
|
| +
|
| + base::RunLoop loop;
|
| + TraitsTestServicePtr proxy = GetTraitsTestProxy();
|
| +
|
| + proxy->EchoTrivialStructWithTraits(
|
| + input,
|
| + base::Bind(&ExpectTrivialStructWithTraits, input, loop.QuitClosure()));
|
| + loop.Run();
|
| +}
|
| +
|
| void CaptureMessagePipe(ScopedMessagePipeHandle* storage,
|
| const base::Closure& closure,
|
| - PassByValueStructWithTraitsImpl passed) {
|
| + MoveOnlyStructWithTraitsImpl passed) {
|
| storage->reset(MessagePipeHandle(
|
| passed.get_mutable_handle().release().value()));
|
| closure.Run();
|
| }
|
|
|
| -TEST_F(StructTraitsTest, EchoPassByValueStructWithTraits) {
|
| +TEST_F(StructTraitsTest, EchoMoveOnlyStructWithTraits) {
|
| MessagePipe mp;
|
| - PassByValueStructWithTraitsImpl input;
|
| + MoveOnlyStructWithTraitsImpl input;
|
| input.get_mutable_handle().reset(mp.handle0.release());
|
|
|
| base::RunLoop loop;
|
| TraitsTestServicePtr proxy = GetTraitsTestProxy();
|
|
|
| ScopedMessagePipeHandle received;
|
| - proxy->EchoPassByValueStructWithTraits(
|
| + proxy->EchoMoveOnlyStructWithTraits(
|
| std::move(input),
|
| base::Bind(&CaptureMessagePipe, &received, loop.QuitClosure()));
|
| loop.Run();
|
|
|