• Home
  • Raw
  • Download

Lines Matching refs:base

34                 base::FilePath* file_path,  in CreateFile()
35 base::File* file) { in CreateFile()
36 if (!base::CreateTemporaryFile(file_path)) in CreateFile()
39 if (base::WriteFile(*file_path, content.data(), content.size()) == -1) in CreateFile()
42 *file = base::File( in CreateFile()
43 *file_path, base::File::Flags::FLAG_OPEN | base::File::Flags::FLAG_READ); in CreateFile()
60 base::FilePath test_dir; in VirtualFileSystem()
61 base::FilePath foo_txt_path = test_dir.Append(FILE_PATH_LITERAL("foo.txt")); in VirtualFileSystem()
63 base::FilePath file_path; in VirtualFileSystem()
64 base::File file; in VirtualFileSystem()
69 base::FilePath bar_dir = test_dir.Append(FILE_PATH_LITERAL("bar")); in VirtualFileSystem()
70 base::FilePath bar1_txt_path = in VirtualFileSystem()
76 base::FilePath bar2_txt_path = in VirtualFileSystem()
82 file_tree_[base::FilePath()] = {{foo_txt_path}, {bar_dir}}; in VirtualFileSystem()
93 std::vector<base::File>* const files) override { in Open()
97 for (const base::FilePath& path : paths) { in Open()
110 bool List(const base::FilePath& path, in List()
111 std::vector<base::FilePath>* const files, in List()
112 std::vector<base::FilePath>* const subdirs) override { in List()
121 for (const base::FilePath& file : it->second.files) { in List()
126 for (const base::FilePath& subdir : it->second.subdirs) { in List()
134 bool GetInfo(const base::FilePath& path, Info* const info) override { in GetInfo()
143 base::Time::FromDoubleT(172097977); // Some random date. in GetInfo()
149 std::vector<base::FilePath> files, subdirs;
152 std::map<base::FilePath, DirContents> file_tree_;
153 std::map<base::FilePath, base::File> files_;
174 base::FilePath zip_path(test_dir_); in SetUp()
186 zip_file_list_.push_back(base::FilePath(FILE_PATH_LITERAL("foo.txt"))); in SetUp()
188 base::FilePath(FILE_PATH_LITERAL("foo/bar/quux.txt"))); in SetUp()
190 base::FilePath(FILE_PATH_LITERAL("foo/bar/.hidden"))); in SetUp()
195 bool GetTestDataDirectory(base::FilePath* path) { in GetTestDataDirectory()
196 bool success = base::PathService::Get(base::DIR_SOURCE_ROOT, path); in GetTestDataDirectory()
200 for (const base::StringPiece s : in GetTestDataDirectory()
207 void TestUnzipFile(const base::FilePath::StringType& filename, in TestUnzipFile()
209 base::FilePath test_dir; in TestUnzipFile()
214 void TestUnzipFile(const base::FilePath& path, bool expect_hidden_files) { in TestUnzipFile()
215 ASSERT_TRUE(base::PathExists(path)) << "no file " << path.value(); in TestUnzipFile()
218 base::FilePath original_dir; in TestUnzipFile()
222 base::FileEnumerator files( in TestUnzipFile()
224 base::FileEnumerator::FILES | base::FileEnumerator::DIRECTORIES); in TestUnzipFile()
225 base::FilePath unzipped_entry_path = files.Next(); in TestUnzipFile()
232 if (base::PathExists(unzipped_entry_path) && in TestUnzipFile()
233 !base::DirectoryExists(unzipped_entry_path)) { in TestUnzipFile()
237 base::FilePath relative_path; in TestUnzipFile()
244 base::FilePath original_path = original_dir.Append(relative_path); in TestUnzipFile()
246 base::ContentsEqual(original_path, unzipped_entry_path); in TestUnzipFile()
262 for (std::set<base::FilePath>::iterator iter = zip_contents_.begin(); in TestUnzipFile()
280 base::ScopedTempDir temp_dir; in TestTimeStamp()
283 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out.zip"); in TestTimeStamp()
284 base::FilePath src_dir = temp_dir.GetPath().AppendASCII("input"); in TestTimeStamp()
285 base::FilePath out_dir = temp_dir.GetPath().AppendASCII("output"); in TestTimeStamp()
287 base::FilePath src_file = src_dir.AppendASCII("test.txt"); in TestTimeStamp()
288 base::FilePath out_file = out_dir.AppendASCII("test.txt"); in TestTimeStamp()
290 EXPECT_TRUE(base::CreateDirectory(src_dir)); in TestTimeStamp()
291 EXPECT_TRUE(base::CreateDirectory(out_dir)); in TestTimeStamp()
293 base::Time test_mtime; in TestTimeStamp()
294 ASSERT_TRUE(base::Time::FromString(date_time, &test_mtime)); in TestTimeStamp()
299 base::Time::Exploded now_parts; in TestTimeStamp()
300 base::Time::Now().UTCExplode(&now_parts); in TestTimeStamp()
303 base::Time now_time; in TestTimeStamp()
304 EXPECT_TRUE(base::Time::FromUTCExploded(now_parts, &now_time)); in TestTimeStamp()
306 EXPECT_EQ(1, base::WriteFile(src_file, "1", 1)); in TestTimeStamp()
307 EXPECT_TRUE(base::TouchFile(src_file, base::Time::Now(), test_mtime)); in TestTimeStamp()
312 base::File::Info file_info; in TestTimeStamp()
313 EXPECT_TRUE(base::GetFileInfo(out_file, &file_info)); in TestTimeStamp()
325 base::FilePath test_dir_;
327 base::ScopedTempDir temp_dir_;
330 std::set<base::FilePath> zip_contents_;
333 std::vector<base::FilePath> zip_file_list_;
345 base::FilePath path; in TEST_F()
351 base::FilePath output_dir = test_dir_.AppendASCII("out"); in TEST_F()
353 base::FilePath evil_file = output_dir; in TEST_F()
356 ASSERT_FALSE(base::PathExists(evil_file)); in TEST_F()
360 base::FilePath path; in TEST_F()
366 base::FilePath output_dir = test_dir_.AppendASCII("out"); in TEST_F()
369 base::FilePath evil_file = output_dir; in TEST_F()
371 ASSERT_FALSE(base::PathExists(evil_file)); in TEST_F()
375 auto filter = base::BindRepeating([](const base::FilePath& path) { in TEST_F()
378 base::FilePath path; in TEST_F()
390 ASSERT_TRUE(base::PathExists(test_dir_.AppendASCII("foo.txt"))); in TEST_F()
391 base::FileEnumerator extractedFiles( in TEST_F()
394 base::FileEnumerator::FileType::FILES); in TEST_F()
400 base::FileEnumerator extractedDirs( in TEST_F()
403 base::FileEnumerator::FileType::DIRECTORIES); in TEST_F()
412 base::BindRepeating([](const base::FilePath& path) { return true; }); in TEST_F()
413 auto dir_creator = base::BindRepeating( in TEST_F()
414 [](const base::FilePath& extract_dir, const base::FilePath& entry_path) { in TEST_F()
415 return base::CreateDirectory(extract_dir.Append(entry_path)); in TEST_F()
418 auto writer = base::BindRepeating( in TEST_F()
419 [](const base::FilePath& extract_dir, const base::FilePath& entry_path) in TEST_F()
425 base::FilePath path; in TEST_F()
427 base::File file(path.AppendASCII("test.zip"), in TEST_F()
428 base::File::Flags::FLAG_OPEN | base::File::Flags::FLAG_READ); in TEST_F()
431 base::FilePath dir = test_dir_; in TEST_F()
432 base::FilePath dir_foo = dir.AppendASCII("foo"); in TEST_F()
433 base::FilePath dir_foo_bar = dir_foo.AppendASCII("bar"); in TEST_F()
434 ASSERT_TRUE(base::PathExists(dir.AppendASCII("foo.txt"))); in TEST_F()
435 ASSERT_TRUE(base::PathExists(dir_foo)); in TEST_F()
436 ASSERT_TRUE(base::PathExists(dir_foo.AppendASCII("bar.txt"))); in TEST_F()
437 ASSERT_TRUE(base::PathExists(dir_foo_bar)); in TEST_F()
438 ASSERT_TRUE(base::PathExists(dir_foo_bar.AppendASCII(".hidden"))); in TEST_F()
439 ASSERT_TRUE(base::PathExists(dir_foo_bar.AppendASCII("baz.txt"))); in TEST_F()
440 ASSERT_TRUE(base::PathExists(dir_foo_bar.AppendASCII("quux.txt"))); in TEST_F()
444 base::FilePath src_dir; in TEST_F()
448 base::ScopedTempDir temp_dir; in TEST_F()
450 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out.zip"); in TEST_F()
457 base::FilePath src_dir; in TEST_F()
461 base::ScopedTempDir temp_dir; in TEST_F()
463 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out.zip"); in TEST_F()
470 base::FilePath src_dir; in TEST_F()
474 base::ScopedTempDir temp_dir; in TEST_F()
477 base::FilePath src_dir_russian = temp_dir.GetPath().Append( in TEST_F()
478 base::FilePath::FromUTF8Unsafe("\xD0\xA2\xD0\xB5\xD1\x81\xD1\x82")); in TEST_F()
479 base::CopyDirectory(src_dir, src_dir_russian, true); in TEST_F()
480 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out_russian.zip"); in TEST_F()
510 base::FilePath src_dir; in TEST_F()
514 base::ScopedTempDir temp_dir; in TEST_F()
516 base::FilePath zip_name = temp_dir.GetPath().AppendASCII("out.zip"); in TEST_F()
518 base::File zip_file(zip_name, in TEST_F()
519 base::File::FLAG_CREATE | base::File::FLAG_WRITE); in TEST_F()
539 base::FilePath test_data_folder; in TEST_F()
546 base::FilePath test_zip_file = in TEST_F()
549 base::ScopedTempDir scoped_temp_dir; in TEST_F()
551 const base::FilePath& temp_dir = scoped_temp_dir.GetPath(); in TEST_F()
554 EXPECT_TRUE(base::DirectoryExists(temp_dir.AppendASCII("d"))); in TEST_F()
557 SCOPED_TRACE(base::StringPrintf("Processing %d.txt", i)); in TEST_F()
558 base::FilePath file_path = in TEST_F()
559 temp_dir.AppendASCII(base::StringPrintf("%d.txt", i)); in TEST_F()
561 EXPECT_TRUE(base::GetFileSize(file_path, &file_size)); in TEST_F()
567 base::FilePath zip_file; in TEST_F()
568 ASSERT_TRUE(base::CreateTemporaryFile(&zip_file)); in TEST_F()
574 base::ScopedTempDir scoped_temp_dir; in TEST_F()
576 const base::FilePath& temp_dir = scoped_temp_dir.GetPath(); in TEST_F()
578 base::FilePath bar_dir = temp_dir.Append(FILE_PATH_LITERAL("bar")); in TEST_F()
579 EXPECT_TRUE(base::DirectoryExists(bar_dir)); in TEST_F()
581 EXPECT_TRUE(base::ReadFileToString( in TEST_F()
584 EXPECT_TRUE(base::ReadFileToString( in TEST_F()
587 EXPECT_TRUE(base::ReadFileToString( in TEST_F()
594 base::FilePath src_dir; in TEST_F()
598 base::ScopedTempDir temp_dir; in TEST_F()
600 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out.zip"); in TEST_F()
606 base::BindLambdaForTesting([&](const zip::Progress& progress) { in TEST_F()
633 base::FilePath src_dir; in TEST_F()
637 base::ScopedTempDir temp_dir; in TEST_F()
639 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out.zip"); in TEST_F()
645 base::BindLambdaForTesting([&](const zip::Progress& progress) { in TEST_F()
661 .progress_period = base::TimeDelta::FromHours(1)})); in TEST_F()
674 base::FilePath src_dir; in TEST_F()
678 base::ScopedTempDir temp_dir; in TEST_F()
680 base::FilePath zip_file = temp_dir.GetPath().AppendASCII("out.zip"); in TEST_F()
687 .progress_callback = base::BindLambdaForTesting( in TEST_F()
700 .progress_callback = base::BindLambdaForTesting( in TEST_F()