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

Unified Diff: util/mac/xattr_test.cc

Issue 834693002: Create ScopedTempDir, implement it on POSIX, and use it where appropriate. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address comments Created 5 years, 12 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 | « no previous file | util/test/scoped_temp_dir.h » ('j') | util/test/scoped_temp_dir_posix.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mac/xattr_test.cc
diff --git a/util/mac/xattr_test.cc b/util/mac/xattr_test.cc
index e6bbf7b1d4686bb543389f92c57257fca554f6b6..566934ec4e69f5df98065df327dc57b9553c0b76 100644
--- a/util/mac/xattr_test.cc
+++ b/util/mac/xattr_test.cc
@@ -25,6 +25,7 @@
#include "base/strings/stringprintf.h"
#include "gtest/gtest.h"
#include "util/test/errors.h"
+#include "util/test/scoped_temp_dir.h"
namespace crashpad {
namespace test {
@@ -35,10 +36,7 @@ class Xattr : public testing::Test {
// testing::Test:
void SetUp() override {
Mark Mentovai 2015/01/02 17:49:54 SetUp() and TearDown() can be protected too.
Robert Sesek 2015/01/02 18:51:13 Done.
- path_ = base::FilePath(
- base::StringPrintf("/tmp/com.googlecode.crashpad.test.xattr.%d.%p",
- getpid(), this));
- // TODO(rsesek): This should use something like ScopedTempDir.
+ path_ = temp_dir_.path().Append("xattr_file");
base::ScopedFD tmp(HANDLE_EINTR(
open(path_.value().c_str(), O_CREAT | O_TRUNC, 0644)));
EXPECT_GE(tmp.get(), 0) << ErrnoMessage("open");
@@ -48,9 +46,11 @@ class Xattr : public testing::Test {
EXPECT_EQ(0, unlink(path_.value().c_str())) << ErrnoMessage("unlink");
}
- base::FilePath path() { return path_; }
+ protected:
+ const base::FilePath& path() const { return path_; }
private:
+ ScopedTempDir temp_dir_;
base::FilePath path_;
};
« no previous file with comments | « no previous file | util/test/scoped_temp_dir.h » ('j') | util/test/scoped_temp_dir_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698