32 lines
951 B
C++
32 lines
951 B
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2016 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "common/file_util.h"
|
|
|
|
#include "testing/gunit.h"
|
|
#include "absl/strings/str_cat.h"
|
|
|
|
namespace widevine {
|
|
|
|
TEST(FileUtilTest, EmptyFileName) {
|
|
std::string contents;
|
|
EXPECT_FALSE(GetContents("", &contents));
|
|
EXPECT_FALSE(SetContents("", "test content"));
|
|
}
|
|
|
|
TEST(FileUtilTest, BasicTest) {
|
|
const std::string file_path =
|
|
absl::StrCat("/tmp", "/file_util_test");
|
|
EXPECT_TRUE(SetContents(file_path, "test content"));
|
|
std::string contents;
|
|
EXPECT_TRUE(GetContents(file_path, &contents));
|
|
EXPECT_EQ("test content", contents);
|
|
}
|
|
|
|
} // namespace widevine
|