| 273 | #endif |
| 274 | |
| 275 | TEST_F(FileUtilTest, FileAndDirectorySize) { |
| 276 | // Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize |
| 277 | // should return 53 bytes. |
| 278 | FilePath file_01 = temp_dir_.path().Append(FPL("The file 01.txt")); |
| 279 | CreateTextFile(file_01, L"12345678901234567890"); |
| 280 | int64_t size_f1 = 0; |
| 281 | ASSERT_TRUE(GetFileSize(file_01, &size_f1)); |
| 282 | EXPECT_EQ(20ll, size_f1); |
| 283 | |
| 284 | FilePath subdir_path = temp_dir_.path().Append(FPL("Level2")); |
| 285 | CreateDirectory(subdir_path); |
| 286 | |
| 287 | FilePath file_02 = subdir_path.Append(FPL("The file 02.txt")); |
| 288 | CreateTextFile(file_02, L"123456789012345678901234567890"); |
| 289 | int64_t size_f2 = 0; |
| 290 | ASSERT_TRUE(GetFileSize(file_02, &size_f2)); |
| 291 | EXPECT_EQ(30ll, size_f2); |
| 292 | |
| 293 | FilePath subsubdir_path = subdir_path.Append(FPL("Level3")); |
| 294 | CreateDirectory(subsubdir_path); |
| 295 | |
| 296 | FilePath file_03 = subsubdir_path.Append(FPL("The file 03.txt")); |
| 297 | CreateTextFile(file_03, L"123"); |
| 298 | |
| 299 | int64_t computed_size = ComputeDirectorySize(temp_dir_.path()); |
| 300 | EXPECT_EQ(size_f1 + size_f2 + 3, computed_size); |
| 301 | } |
| 302 | |
| 303 | TEST_F(FileUtilTest, NormalizeFilePathBasic) { |
| 304 | // Create a directory under the test dir. Because we create it, |
nothing calls this directly
no test coverage detected