Lines Matching refs:file
28 File file; in TEST() local
29 EXPECT_FALSE(file.IsValid()); in TEST()
30 EXPECT_EQ(base::File::FILE_ERROR_FAILED, file.error_details()); in TEST()
39 File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ); in TEST() local
40 EXPECT_FALSE(file.IsValid()); in TEST()
41 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, file.error_details()); in TEST()
47 File file(file_path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_READ); in TEST() local
48 EXPECT_TRUE(file.IsValid()); in TEST()
49 EXPECT_TRUE(file.created()); in TEST()
50 EXPECT_EQ(base::File::FILE_OK, file.error_details()); in TEST()
55 File file(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ); in TEST() local
56 EXPECT_TRUE(file.IsValid()); in TEST()
57 EXPECT_FALSE(file.created()); in TEST()
58 EXPECT_EQ(base::File::FILE_OK, file.error_details()); in TEST()
61 file.Close(); in TEST()
62 EXPECT_FALSE(file.IsValid()); in TEST()
67 File file; in TEST() local
68 file.Initialize(file_path, base::File::FLAG_OPEN | base::File::FLAG_READ); in TEST()
69 EXPECT_TRUE(file.IsValid()); in TEST()
70 EXPECT_FALSE(file.created()); in TEST()
71 EXPECT_EQ(base::File::FILE_OK, file.error_details()); in TEST()
74 file.Close(); in TEST()
75 EXPECT_FALSE(file.IsValid()); in TEST()
80 File file(file_path, base::File::FLAG_CREATE | base::File::FLAG_READ); in TEST() local
81 EXPECT_FALSE(file.IsValid()); in TEST()
82 EXPECT_FALSE(file.created()); in TEST()
83 EXPECT_EQ(base::File::FILE_ERROR_EXISTS, file.error_details()); in TEST()
89 File file(file_path, in TEST() local
91 EXPECT_TRUE(file.IsValid()); in TEST()
92 EXPECT_TRUE(file.created()); in TEST()
93 EXPECT_EQ(base::File::FILE_OK, file.error_details()); in TEST()
99 File file(file_path, in TEST() local
102 EXPECT_TRUE(file.IsValid()); in TEST()
103 EXPECT_TRUE(file.created()); in TEST()
104 EXPECT_EQ(base::File::FILE_OK, file.error_details()); in TEST()
114 File file(file_path, in TEST() local
116 std::swap(file, file); in TEST()
117 EXPECT_TRUE(file.IsValid()); in TEST()
126 File file(file_path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_ASYNC); in TEST() local
127 EXPECT_TRUE(file.IsValid()); in TEST()
128 EXPECT_TRUE(file.async()); in TEST()
132 File file(file_path, base::File::FLAG_OPEN_ALWAYS); in TEST() local
133 EXPECT_TRUE(file.IsValid()); in TEST()
134 EXPECT_FALSE(file.async()); in TEST()
144 File file(file_path, in TEST() local
147 EXPECT_TRUE(file.IsValid()); in TEST()
148 EXPECT_TRUE(file.created()); in TEST()
149 EXPECT_EQ(base::File::FILE_OK, file.error_details()); in TEST()
155 EXPECT_TRUE(file.IsValid()); in TEST()
160 file.Close(); in TEST()
169 File file(file_path, in TEST() local
172 ASSERT_TRUE(file.IsValid()); in TEST()
178 int bytes_written = file.Write(0, data_to_write, 0); in TEST()
182 bytes_written = file.Write(0, nullptr, 0); in TEST()
186 bytes_written = file.Write(0, data_to_write, kTestDataSize); in TEST()
191 int bytes_read = file.Read(kTestDataSize, data_read_1, kTestDataSize); in TEST()
196 bytes_read = file.Read(kPartialReadOffset, data_read_1, kTestDataSize); in TEST()
202 bytes_read = file.Read(0, data_read_1, 0); in TEST()
206 bytes_read = file.Read(0, data_read_1, kTestDataSize); in TEST()
212 bytes_read = file.ReadNoBestEffort(0, data_read_1, kTestDataSize); in TEST()
220 bytes_written = file.Write(kOffsetBeyondEndOfFile, in TEST()
231 bytes_read = file.Read(0, data_read_2, static_cast<int>(file_size)); in TEST()
253 File file(nonexistent_path, File::FLAG_OPEN | File::FLAG_READ); in TEST() local
255 EXPECT_FALSE(file.IsValid()); in TEST()
256 EXPECT_EQ(File::FILE_ERROR_NOT_FOUND, file.error_details()); in TEST()
264 File file(file_path, base::File::FLAG_CREATE | base::File::FLAG_APPEND); in TEST() local
265 ASSERT_TRUE(file.IsValid()); in TEST()
271 int bytes_written = file.Write(0, data_to_write, 0); in TEST()
275 bytes_written = file.Write(0, nullptr, 0); in TEST()
279 bytes_written = file.Write(0, data_to_write, kTestDataSize); in TEST()
282 file.Close(); in TEST()
289 file = std::move(file2); in TEST()
291 ASSERT_TRUE(file.IsValid()); in TEST()
297 bytes_written = file.Write(0, append_data_to_write, kAppendDataSize); in TEST()
302 int bytes_read = file.Read(0, data_read_1, in TEST()
316 File file(file_path, in TEST() local
319 ASSERT_TRUE(file.IsValid()); in TEST()
320 EXPECT_EQ(0, file.GetLength()); in TEST()
325 int bytes_written = file.Write(0, data_to_write, kTestDataSize); in TEST()
331 EXPECT_TRUE(file.SetLength(kExtendedFileLength)); in TEST()
332 EXPECT_EQ(kExtendedFileLength, file.GetLength()); in TEST()
338 int bytes_read = file.Read(0, data_read, static_cast<int>(file_size)); in TEST()
347 EXPECT_TRUE(file.SetLength(kTruncatedFileLength)); in TEST()
348 EXPECT_EQ(kTruncatedFileLength, file.GetLength()); in TEST()
353 bytes_read = file.Read(0, data_read, kTestDataSize); in TEST()
360 file.Close(); in TEST()
361 file.Initialize(file_path, in TEST()
363 EXPECT_EQ(0, file.GetLength()); in TEST()
374 File file(temp_dir.GetPath().AppendASCII("touch_get_info_file"), local
377 ASSERT_TRUE(file.IsValid());
381 EXPECT_TRUE(file.GetInfo(&info));
397 int bytes_written = file.Write(0, data, kTestDataSize);
409 EXPECT_TRUE(file.SetTimes(new_last_accessed, new_last_modified));
412 EXPECT_TRUE(file.GetInfo(&info));
439 File file(file_path, local
442 EXPECT_TRUE(file.IsValid());
446 EXPECT_EQ(kDataSize, file.Write(0, kData, kDataSize));
448 EXPECT_EQ(0, file.Seek(base::File::FROM_BEGIN, 0));
452 EXPECT_EQ(first_chunk_size, file.ReadAtCurrentPos(buffer, first_chunk_size));
454 file.ReadAtCurrentPos(buffer + first_chunk_size,
464 File file(file_path, local
467 EXPECT_TRUE(file.IsValid());
473 EXPECT_EQ(first_chunk_size, file.WriteAtCurrentPos(kData, first_chunk_size));
475 file.WriteAtCurrentPos(kData + first_chunk_size,
479 EXPECT_EQ(kDataSize, file.Read(0, buffer, kDataSize));
487 File file(file_path, local
490 ASSERT_TRUE(file.IsValid());
493 EXPECT_EQ(kOffset, file.Seek(base::File::FROM_BEGIN, kOffset));
494 EXPECT_EQ(2 * kOffset, file.Seek(base::File::FROM_CURRENT, kOffset));
495 EXPECT_EQ(kOffset, file.Seek(base::File::FROM_CURRENT, -kOffset));
496 EXPECT_TRUE(file.SetLength(kOffset * 2));
497 EXPECT_EQ(kOffset, file.Seek(base::File::FROM_END, -kOffset));
504 File file(file_path,(base::File::FLAG_CREATE | local
507 ASSERT_TRUE(file.IsValid());
509 File file2(file.Duplicate());
516 ASSERT_EQ(0, file.Seek(base::File::FROM_CURRENT, 0));
518 ASSERT_EQ(kDataLen, file.WriteAtCurrentPos(kData, kDataLen));
519 ASSERT_EQ(kDataLen, file.Seek(base::File::FROM_CURRENT, 0));
521 file.Close();
531 File file(file_path,(base::File::FLAG_CREATE | local
535 ASSERT_TRUE(file.IsValid());
536 File file2(file.Duplicate());
538 file.Close();
553 File file(file_path, local
556 ASSERT_TRUE(file.IsValid());
564 if (file.Write(kLargeFileOffset - kDataLen - 1, kData, kDataLen) < 0)
567 ASSERT_EQ(kDataLen, file.Write(kLargeFileOffset + 1, kData, kDataLen));
601 File file(file_path, local
604 ASSERT_TRUE(file.IsValid());
605 file.Close();
616 File file(file_path, local
619 ASSERT_TRUE(file.IsValid());
620 ASSERT_TRUE(file.DeleteOnClose(true));
621 file.Close();
632 File file(file_path, local
635 ASSERT_TRUE(file.IsValid());
636 ASSERT_TRUE(file.DeleteOnClose(true));
637 ASSERT_TRUE(file.DeleteOnClose(false));
638 file.Close();
648 File file( local
653 ASSERT_TRUE(file.IsValid());
659 file.DeleteOnClose(false);
660 file.Close();
670 File file( local
675 ASSERT_TRUE(file.IsValid());
686 file.Close();
697 File file(file_path, (base::File::FLAG_CREATE | base::File::FLAG_READ | local
699 ASSERT_TRUE(file.IsValid());
700 ASSERT_FALSE(file.DeleteOnClose(true));
701 file.Close();
712 File file(file_path, (base::File::FLAG_CREATE | base::File::FLAG_READ | local
714 ASSERT_TRUE(file.IsValid());
721 file.Close();
731 File file(file_path, local
734 ASSERT_TRUE(file.IsValid());
735 ASSERT_EQ(5, file.WriteAtCurrentPos("12345", 5));
739 ASSERT_TRUE(mapping.Initialize(file.Duplicate()));
742 EXPECT_FALSE(file.DeleteOnClose(true));
745 file.Close();
755 File file(file_path, base::File::FLAG_CREATE | base::File::FLAG_WRITE | local
757 File lying_file(file.TakePlatformFile(), false /* async */);