Loading base/include/android-base/test_utils.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,8 @@ class TemporaryFile { // Release the ownership of fd, caller is reponsible for closing the // Release the ownership of fd, caller is reponsible for closing the // fd or stream properly. // fd or stream properly. int release(); int release(); // Don't remove the temporary file in the destructor. void DoNotRemove() { remove_file_ = false; } int fd; int fd; char path[1024]; char path[1024]; Loading @@ -38,6 +40,8 @@ class TemporaryFile { private: private: void init(const std::string& tmp_dir); void init(const std::string& tmp_dir); bool remove_file_ = true; DISALLOW_COPY_AND_ASSIGN(TemporaryFile); DISALLOW_COPY_AND_ASSIGN(TemporaryFile); }; }; Loading base/test_utils.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -92,8 +92,10 @@ TemporaryFile::~TemporaryFile() { if (fd != -1) { if (fd != -1) { close(fd); close(fd); } } if (remove_file_) { unlink(path); unlink(path); } } } int TemporaryFile::release() { int TemporaryFile::release() { int result = fd; int result = fd; Loading Loading
base/include/android-base/test_utils.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,8 @@ class TemporaryFile { // Release the ownership of fd, caller is reponsible for closing the // Release the ownership of fd, caller is reponsible for closing the // fd or stream properly. // fd or stream properly. int release(); int release(); // Don't remove the temporary file in the destructor. void DoNotRemove() { remove_file_ = false; } int fd; int fd; char path[1024]; char path[1024]; Loading @@ -38,6 +40,8 @@ class TemporaryFile { private: private: void init(const std::string& tmp_dir); void init(const std::string& tmp_dir); bool remove_file_ = true; DISALLOW_COPY_AND_ASSIGN(TemporaryFile); DISALLOW_COPY_AND_ASSIGN(TemporaryFile); }; }; Loading
base/test_utils.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -92,8 +92,10 @@ TemporaryFile::~TemporaryFile() { if (fd != -1) { if (fd != -1) { close(fd); close(fd); } } if (remove_file_) { unlink(path); unlink(path); } } } int TemporaryFile::release() { int TemporaryFile::release() { int result = fd; int result = fd; Loading