Index: chrome/browser/process_singleton_mac_unittest.cc |
diff --git a/chrome/browser/process_singleton_mac_unittest.cc b/chrome/browser/process_singleton_mac_unittest.cc |
index 4246c27b2e27ccb3353073bf92bf77c1fedf8387..b6a5b7b49bf3e55bcd87c130f28fd92eec2aa1d2 100644 |
--- a/chrome/browser/process_singleton_mac_unittest.cc |
+++ b/chrome/browser/process_singleton_mac_unittest.cc |
@@ -9,6 +9,7 @@ |
#include "chrome/browser/process_singleton.h" |
#include "base/file_util.h" |
+#include "base/files/scoped_file.h" |
#include "base/path_service.h" |
#include "base/posix/eintr_wrapper.h" |
#include "chrome/common/chrome_constants.h" |
@@ -39,15 +40,13 @@ class ProcessSingletonMacTest : public PlatformTest { |
// Return |true| if the file exists and is locked. Forces a failure |
// in the containing test in case of error condition. |
bool IsLocked() { |
- int fd = HANDLE_EINTR(open(lock_path_.value().c_str(), O_RDONLY)); |
- if (fd == -1) { |
+ base::ScopedFD fd(HANDLE_EINTR(open(lock_path_.value().c_str(), O_RDONLY))); |
+ if (!fd.is_valid()) { |
EXPECT_EQ(ENOENT, errno) << "Unexpected error opening lockfile."; |
return false; |
} |
- file_util::ScopedFD auto_close(&fd); |
- |
- int rc = HANDLE_EINTR(flock(fd, LOCK_EX|LOCK_NB)); |
+ int rc = HANDLE_EINTR(flock(fd.get(), LOCK_EX|LOCK_NB)); |
// Got the lock, so it wasn't already locked. Close releases. |
if (rc != -1) |