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

Unified Diff: dbus/message_unittest.cc

Issue 8525012: dbus: Fix a bug where we rejected an empty array in PopArrayOfBytes() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor change Created 9 years, 1 month 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') | 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 29fe8884d2ef0b28f99de17149797e4cb554677f..9c76b0d28fa50d77c8fa4d9da0e7a176b3735122 100644
--- a/dbus/message_unittest.cc
+++ b/dbus/message_unittest.cc
@@ -171,6 +171,21 @@ TEST(MessageTest, ArrayOfBytes) {
EXPECT_EQ(3, output_bytes[2]);
}
+TEST(MessageTest, ArrayOfBytes_Empty) {
+ scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty());
+ dbus::MessageWriter writer(message.get());
+ std::vector<uint8> bytes;
+ writer.AppendArrayOfBytes(bytes.data(), bytes.size());
+
+ dbus::MessageReader reader(message.get());
+ uint8* output_bytes = NULL;
+ size_t length = 0;
+ ASSERT_TRUE(reader.PopArrayOfBytes(&output_bytes, &length));
+ ASSERT_FALSE(reader.HasMoreData());
+ ASSERT_EQ(0U, length);
+ EXPECT_EQ(NULL, output_bytes);
+}
+
TEST(MessageTest, ArrayOfStrings) {
scoped_ptr<dbus::Response> message(dbus::Response::CreateEmpty());
dbus::MessageWriter writer(message.get());
« no previous file with comments | « dbus/message.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698