//////////////////////////////////////////////////////////////////////////////// // Copyright 2016 Google Inc. // // 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 "gtest/gtest.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 = FLAGS_test_tmpdir + "/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