summaryrefslogtreecommitdiff
path: root/base/include/android-base/test_utils.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-03-08 17:03:04 -0800
committerYabin Cui <yabinc@google.com>2018-03-08 17:59:36 -0800
commitef58cef98250305e6d629f3a307a74e45875b8dd (patch)
tree226c4221c6d349eca2e4ec158e8ce3d60d2f137a /base/include/android-base/test_utils.h
parent929112bcd19e92c9b9f647d8a227ba55c743239d (diff)
base: Add TemporaryFile::DoNotRemove().
Bug: http://b/73127105 Test: none. Change-Id: I563c12bfb629ddd630568dda4817fb10cc9940a8
Diffstat (limited to 'base/include/android-base/test_utils.h')
-rw-r--r--base/include/android-base/test_utils.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/base/include/android-base/test_utils.h b/base/include/android-base/test_utils.h
index 2edafe3443..b95fa07ce8 100644
--- a/base/include/android-base/test_utils.h
+++ b/base/include/android-base/test_utils.h
@@ -31,6 +31,8 @@ class TemporaryFile {
// Release the ownership of fd, caller is reponsible for closing the
// fd or stream properly.
int release();
+ // Don't remove the temporary file in the destructor.
+ void DoNotRemove() { remove_file_ = false; }
int fd;
char path[1024];
@@ -38,6 +40,8 @@ class TemporaryFile {
private:
void init(const std::string& tmp_dir);
+ bool remove_file_ = true;
+
DISALLOW_COPY_AND_ASSIGN(TemporaryFile);
};