diff options
author | sleffler@chromium.org <sleffler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-10 17:41:10 +0000 |
---|---|---|
committer | sleffler@chromium.org <sleffler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-10 17:41:10 +0000 |
commit | 8bd4a46da03767be3a2fa16c9fc32ed2233e47f7 (patch) | |
tree | adb9fd02a778de7be36503996878ac426d7bda2e /dbus/message_unittest.cc | |
parent | 1223c1ea076e566ba2ab1bf9c676b5c008c4657c (diff) | |
download | chromium_src-8bd4a46da03767be3a2fa16c9fc32ed2233e47f7.zip chromium_src-8bd4a46da03767be3a2fa16c9fc32ed2233e47f7.tar.gz chromium_src-8bd4a46da03767be3a2fa16c9fc32ed2233e47f7.tar.bz2 |
dbus: revamp fd passing support for i/o restrictions
Encapsulate file descriptor validity checking and status in the companion FileDescriptor class so callers can do descriptor checking in a context where i/o is allowed.
Update the debug daemon client support to validate the pipe descriptors in a worker thread so it is not done on the UI thread.
BUG=126142
TEST=new unit tests + collect trace data on chrome os and verify no assert is triggered
Review URL: https://chromiumcodereview.appspot.com/10382021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/message_unittest.cc')
-rw-r--r-- | dbus/message_unittest.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dbus/message_unittest.cc b/dbus/message_unittest.cc index 424b50a..9d87c2a 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 |