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

Unified Diff: dbus/message_unittest.cc

Issue 10382021: dbus: revamp fd passing for i/o restrictions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 7 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') | 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 424b50a8519e98b18a272eb110645bc9b18a3531..9d87c2ad51fc395f5e649544745b799cc51650a8 100644
--- a/dbus/message_unittest.cc
+++ b/dbus/message_unittest.cc
@@ -107,6 +107,11 @@ TEST(MessageTest, AppendAndPopFileDescriptor) {
// Append stdout.
dbus::FileDescriptor temp(1);
+ // Descriptor should not be valid until checked.
+ ASSERT_FALSE(temp.is_valid());
+ // NB: thread IO requirements not relevant for unit tests.
+ temp.CheckValidity();
+ ASSERT_TRUE(temp.is_valid());
writer.AppendFileDescriptor(temp);
dbus::FileDescriptor fd_value;
@@ -115,6 +120,10 @@ TEST(MessageTest, AppendAndPopFileDescriptor) {
ASSERT_TRUE(reader.HasMoreData());
ASSERT_TRUE(reader.PopFileDescriptor(&fd_value));
ASSERT_FALSE(reader.HasMoreData());
+ // Descriptor is not valid until explicitly checked.
+ ASSERT_FALSE(fd_value.is_valid());
+ fd_value.CheckValidity();
+ ASSERT_TRUE(fd_value.is_valid());
// Stdout should be returned but we cannot check the descriptor
// value because stdout will be dup'd. Instead check st_rdev
« 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