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

Unified Diff: chrome/browser/process_singleton_mac_unittest.cc

Issue 191673003: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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)

Powered by Google App Engine
This is Rietveld 408576698