Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: dbus/message_unittest.cc

Issue 9315006: Adding support for sending/receiving proto bufs to dbus library. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added in the DEPS file as suggested Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/message.cc ('k') | dbus/test_proto.proto » ('j') | dbus/test_proto.proto » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/message_unittest.cc
diff --git a/dbus/message_unittest.cc b/dbus/message_unittest.cc
index 9c76b0d28fa50d77c8fa4d9da0e7a176b3735122..874851d858e29fbf661c89bc50c03ceaed82ed23 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,22 @@ 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");
+ send_message.set_number(123);
+ 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());
+ EXPECT_EQ(receive_message.number(), send_message.number());
+}
+
+
// 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.
« no previous file with comments | « dbus/message.cc ('k') | dbus/test_proto.proto » ('j') | dbus/test_proto.proto » ('J')

Powered by Google App Engine
This is Rietveld 408576698