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

Unified Diff: dbus/message_unittest.cc

Issue 2337893002: dbus: Remove dbus::FileDescriptor (Closed)
Patch Set: Created 4 years, 3 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') | device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h » ('j') | 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 a58b36b2dc08eb05f433acb0d21df5440b645c36..d0acdc313aa6dfd75b867080430dfb98e2828a00 100644
--- a/dbus/message_unittest.cc
+++ b/dbus/message_unittest.cc
@@ -124,35 +124,26 @@ TEST(MessageTest, AppendAndPopFileDescriptor) {
MessageWriter writer(message.get());
// Append stdout.
- 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);
+ const int fd_in = 1;
+ writer.AppendFileDescriptor(fd_in);
- FileDescriptor fd_value;
+ base::ScopedFD fd_out;
MessageReader reader(message.get());
ASSERT_TRUE(reader.HasMoreData());
ASSERT_EQ(Message::UNIX_FD, reader.GetDataType());
ASSERT_EQ("h", reader.GetDataSignature());
- ASSERT_TRUE(reader.PopFileDescriptor(&fd_value));
+ ASSERT_TRUE(reader.PopFileDescriptor(&fd_out));
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
// which should be identical.
struct stat sb_stdout;
- int status_stdout = HANDLE_EINTR(fstat(1, &sb_stdout));
+ int status_stdout = HANDLE_EINTR(fstat(fd_in, &sb_stdout));
ASSERT_GE(status_stdout, 0);
struct stat sb_fd;
- int status_fd = HANDLE_EINTR(fstat(fd_value.value(), &sb_fd));
+ int status_fd = HANDLE_EINTR(fstat(fd_out.get(), &sb_fd));
ASSERT_GE(status_fd, 0);
EXPECT_EQ(sb_stdout.st_rdev, sb_fd.st_rdev);
}
« no previous file with comments | « dbus/message.cc ('k') | device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698