Chromium Code Reviews| Index: base/files/file_util_unittest.cc |
| diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc |
| index 2d95be4fff578a55b1ddeb2261166dc0d162757f..7b35f59ebfec234095ab61d801e82dfe38726fea 100644 |
| --- a/base/files/file_util_unittest.cc |
| +++ b/base/files/file_util_unittest.cc |
| @@ -2255,6 +2255,17 @@ TEST_F(FileUtilTest, IsDirectoryEmpty) { |
| } |
| #if defined(OS_POSIX) |
| +TEST_F(FileUtilTest, SetNonBlocking) { |
| + const int kInvalidFd = 99999; |
| + EXPECT_FALSE(SetNonBlocking(kInvalidFd)); |
| + |
| + base::FilePath path; |
| + ASSERT_TRUE(PathService::Get(base::DIR_TEST_DATA, &path)); |
| + path = path.Append(FPL("file_util")).Append(FPL("original.txt")); |
| + ScopedFD fd(open(path.value().c_str(), O_RDONLY)); |
|
tfarina
2017/04/18 22:14:42
Could we also test with socket() or for our test i
Lei Zhang
2017/04/18 22:19:11
I wasn't really aiming for this to be a comprehens
|
| + ASSERT_GE(fd.get(), 0); |
| + EXPECT_TRUE(SetNonBlocking(fd.get())); |
| +} |
| // Testing VerifyPathControlledByAdmin() is hard, because there is no |
| // way a test can make a file owned by root, or change file paths |