Minor cleanups in testsupport/file_utils
Bug: webrtc:13579 Change-Id: Ic7915a3520a0f16d0e57cb5e9ffa290524f6bf39 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/256810 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Ali Tofigh <alito@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36339}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
a8bc137835
commit
3cdd653d66
@ -85,11 +85,6 @@ bool FileExists(absl::string_view file_name) {
|
||||
return stat(std::string(file_name).c_str(), &file_info) == 0;
|
||||
}
|
||||
|
||||
bool FileExists(const std::string& file_name) {
|
||||
struct stat file_info = {0};
|
||||
return stat(file_name.c_str(), &file_info) == 0;
|
||||
}
|
||||
|
||||
bool DirExists(absl::string_view directory_name) {
|
||||
struct stat directory_info = {0};
|
||||
return stat(std::string(directory_name).c_str(), &directory_info) == 0 &&
|
||||
|
@ -92,7 +92,6 @@ bool RemoveFile(absl::string_view file_name);
|
||||
// TOOD(alito): Merge these once absl::string_view adoption is complete for this
|
||||
// file.
|
||||
bool FileExists(absl::string_view file_name);
|
||||
bool FileExists(const std::string& file_name);
|
||||
|
||||
// Checks if a directory exists.
|
||||
bool DirExists(absl::string_view directory_name);
|
||||
|
@ -198,13 +198,12 @@ TEST_F(FileUtilsTest, GetFileSizeExistingFile) {
|
||||
ASSERT_GT(fprintf(file, "%s", "Dummy data"), 0)
|
||||
<< "Failed to write to file: " << temp_filename;
|
||||
fclose(file);
|
||||
ASSERT_GT(webrtc::test::GetFileSize(std::string(temp_filename.c_str())), 0u);
|
||||
ASSERT_GT(webrtc::test::GetFileSize(temp_filename), 0u);
|
||||
remove(temp_filename.c_str());
|
||||
}
|
||||
|
||||
TEST_F(FileUtilsTest, GetFileSizeNonExistingFile) {
|
||||
ASSERT_EQ(0u, webrtc::test::GetFileSize(
|
||||
absl::string_view("non-existing-file.tmp")));
|
||||
ASSERT_EQ(0u, webrtc::test::GetFileSize("non-existing-file.tmp"));
|
||||
}
|
||||
|
||||
TEST_F(FileUtilsTest, DirExists) {
|
||||
|
Reference in New Issue
Block a user