Chromium Code Reviews| Index: dbus/message_unittest.cc |
| diff --git a/dbus/message_unittest.cc b/dbus/message_unittest.cc |
| index 9c76b0d28fa50d77c8fa4d9da0e7a176b3735122..199e0a3843129aa3297553f798c596667c6bff7a 100644 |
| --- a/dbus/message_unittest.cc |
| +++ b/dbus/message_unittest.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/basictypes.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "dbus/test_proto.pb.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| // Test that a byte can be properly written and read. We only have this |
| @@ -226,6 +227,20 @@ TEST(MessageTest, ArrayOfObjectPaths) { |
| EXPECT_EQ("/object/path/3", output_object_paths[2]); |
| } |
| +TEST(MessageTest, ProtoBuf) { |
| + scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty()); |
| + dbus::MessageWriter writer(message.get()); |
| + TestProto send_message; |
| + send_message.set_text("testing"); |
|
satorux1
2012/02/01 19:14:57
To make test a little more interesting, could you
rharrison
2012/02/01 21:33:21
Done.
|
| + writer.AppendProtoAsArrayOfBytes(send_message); |
| + |
| + dbus::MessageReader reader(message.get()); |
| + TestProto receive_message; |
| + ASSERT_TRUE(reader.PopArrayOfBytesAsProto(&receive_message)); |
| + EXPECT_EQ(receive_message.text(), send_message.text()); |
|
satorux1
2012/02/01 19:14:57
Rather than comparing a field, it'be better to com
rharrison
2012/02/01 21:33:21
This is not available in MessageLite objects.
|
| +} |
| + |
| + |
| // Test that an array can be properly written and read. We only have this |
| // test for array, as repeating this for other container types is too |
| // redundant. |