7 #ifndef MEDIA_FILE_FILE_TEST_UTIL_H_ 8 #define MEDIA_FILE_FILE_TEST_UTIL_H_ 10 #include <gmock/gmock.h> 11 #include <gtest/gtest.h> 15 #include "packager/file/file.h" 19 #define ASSERT_FILE_EQ(file_name, array) \ 21 std::string temp_data; \ 22 ASSERT_TRUE(File::ReadFileToString((file_name), &temp_data)); \ 23 const char* array_ptr = reinterpret_cast<const char*>(array); \ 24 ASSERT_EQ(std::string(array_ptr, arraysize(array)), temp_data); \ 27 #define ASSERT_FILE_STREQ(file_name, str) \ 29 std::string temp_data; \ 30 ASSERT_TRUE(File::ReadFileToString((file_name), &temp_data)); \ 31 ASSERT_EQ(str, temp_data); \ 34 #define ASSERT_FILE_ENDS_WITH(file_name, array) \ 36 std::string temp_data; \ 37 ASSERT_TRUE(File::ReadFileToString((file_name), &temp_data)); \ 38 EXPECT_THAT(temp_data, \ 39 ::testing::EndsWith(std::string( \ 40 reinterpret_cast<const char*>(array), sizeof(array)))); \ 45 #endif // MEDIA_FILE_FILE_TEST_UTIL_H_ All the methods that are virtual are virtual for mocking.