Add file_util.
Move file utility classes and functions from testing/test_util to common/file_util, and make them part of libwebm. Change-Id: If5b25a63b20efacc16b0fecaa8876ade4ecc4b26
This commit is contained in:
@@ -51,28 +51,7 @@ std::string GetTestFilePath(const std::string& name);
|
||||
// files match exactly, false otherwise.
|
||||
bool CompareFiles(const std::string& file1, const std::string& file2);
|
||||
|
||||
// Returns a temporary file name.
|
||||
std::string GetTempFileName();
|
||||
|
||||
// Returns size of file specified by |file_name|, or 0 upon failure.
|
||||
std::uint64_t GetFileSize(const std::string& file_name);
|
||||
|
||||
// Manages life of temporary file specified at time of construction. Deletes
|
||||
// file upon destruction.
|
||||
class TempFileDeleter {
|
||||
public:
|
||||
TempFileDeleter();
|
||||
explicit TempFileDeleter(std::string file_name) : file_name_(file_name) {}
|
||||
~TempFileDeleter();
|
||||
TempFileDeleter(const TempFileDeleter&) = delete;
|
||||
TempFileDeleter(TempFileDeleter&&) = delete;
|
||||
const std::string& name() const { return file_name_; }
|
||||
|
||||
private:
|
||||
std::string file_name_;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
} // namespace libwebm
|
||||
|
||||
#endif // LIBWEBM_TESTING_TEST_UTIL_H_
|
||||
#endif // LIBWEBM_TESTING_TEST_UTIL_H_
|
||||
Reference in New Issue
Block a user