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

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: Resolved most of outstanding issues Created 8 years, 11 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
« dbus/dbus.gyp ('K') | « dbus/message.cc ('k') | no next file » | no next file with comments »
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..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.
« dbus/dbus.gyp ('K') | « dbus/message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698