summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/include/android-base/test_utils.h1
-rw-r--r--base/test_utils.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/base/include/android-base/test_utils.h b/base/include/android-base/test_utils.h
index 07a5edda0..4cfa06ba5 100644
--- a/base/include/android-base/test_utils.h
+++ b/base/include/android-base/test_utils.h
@@ -24,6 +24,7 @@
24class TemporaryFile { 24class TemporaryFile {
25 public: 25 public:
26 TemporaryFile(); 26 TemporaryFile();
27 explicit TemporaryFile(const std::string& tmp_dir);
27 ~TemporaryFile(); 28 ~TemporaryFile();
28 29
29 // Release the ownership of fd, caller is reponsible for closing the 30 // Release the ownership of fd, caller is reponsible for closing the
diff --git a/base/test_utils.cpp b/base/test_utils.cpp
index 1cfa9e66f..9d8dfb2fd 100644
--- a/base/test_utils.cpp
+++ b/base/test_utils.cpp
@@ -84,6 +84,10 @@ TemporaryFile::TemporaryFile() {
84 init(GetSystemTempDir()); 84 init(GetSystemTempDir());
85} 85}
86 86
87TemporaryFile::TemporaryFile(const std::string& tmp_dir) {
88 init(tmp_dir);
89}
90
87TemporaryFile::~TemporaryFile() { 91TemporaryFile::~TemporaryFile() {
88 if (fd != -1) { 92 if (fd != -1) {
89 close(fd); 93 close(fd);