Removing, opening and creating files in platform_file and file

BUG=
R=perkj@webrtc.org, sprang@google.com

Review URL: https://codereview.webrtc.org/2347473003 .

Cr-Commit-Position: refs/heads/master@{#14250}
This commit is contained in:
Viktor Palmkvist
2016-09-16 10:19:23 +02:00
parent 280ad1514e
commit 971eb27e54
7 changed files with 58 additions and 26 deletions

View File

@ -8,10 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits>
#include <memory>
#include <string>
@ -32,14 +28,6 @@
namespace rtc {
void RemoveFile(const std::string& path) {
#if defined(WEBRTC_WIN)
::DeleteFile(ToUtf16(path).c_str());
#else
::unlink(path.c_str());
#endif
}
int LastError() {
#if defined(WEBRTC_WIN)
return ::GetLastError();
@ -69,7 +57,7 @@ class FileTest : public ::testing::Test {
ASSERT_FALSE(path_.empty());
}
rtc::File OpenTempFile() { return rtc::File::Open(path_); }
void TearDown() { RemoveFile(path_); }
void TearDown() { rtc::RemoveFile(path_); }
};
TEST_F(FileTest, DoubleClose) {