Skip to content

Commit

Permalink
fixed according review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Vadym Struts <vstruts@brave.com>
  • Loading branch information
vadimstruts committed Aug 29, 2024
1 parent 29d4874 commit 39c6847
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
3 changes: 1 addition & 2 deletions browser/ipfs/ipfs_component_cleaner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void CleanupIpfsComponent() {
// Remove IPFS component
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(IgnoreResult(&base::DeletePathRecursively),
GetIpfsClientComponentPath()));
base::GetDeletePathRecursivelyCallback(GetIpfsClientComponentPath()));
}
} // namespace ipfs
18 changes: 2 additions & 16 deletions browser/ipfs/ipfs_component_cleaner_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ static const base::FilePath::StringPieceType kIpfsClientComponentId =
FILE_PATH_LITERAL("oecghfpdmkjlhnfpmmjegjacfimiafjp");
#endif
#endif

// Simple function to dump some text into a new file.
void CreateTextFile(const base::FilePath& filename,
const std::wstring& contents) {
std::wofstream file;
#if BUILDFLAG(IS_WIN)
file.open(filename.value().c_str());
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
file.open(filename.value());
#endif // BUILDFLAG(IS_WIN)
ASSERT_TRUE(file.is_open());
file << contents;
file.close();
}
} // namespace

class IpfsComponentCleanerUnitTest : public testing::Test {
Expand Down Expand Up @@ -89,7 +75,7 @@ TEST_F(IpfsComponentCleanerUnitTest, CleanIpfsComponent) {
EXPECT_TRUE(base::PathExists(cache_folder_subdir));
base::FilePath cache_folder_subdir_file_01 =
cache_folder_subdir.Append(FILE_PATH_LITERAL("The file 01.txt"));
CreateTextFile(cache_folder_subdir_file_01, L"12345678901234567890");
base::WriteFile(cache_folder_subdir_file_01, "12345678901234567890");

base::FilePath component_id_folder =
user_data_path_.Append(base::FilePath(kIpfsClientComponentId));
Expand All @@ -101,7 +87,7 @@ TEST_F(IpfsComponentCleanerUnitTest, CleanIpfsComponent) {
EXPECT_TRUE(base::PathExists(component_id_folde_subdir));
base::FilePath component_id_folde_subdir_file_01 =
component_id_folde_subdir.Append(FILE_PATH_LITERAL("The file 01.txt"));
CreateTextFile(component_id_folde_subdir_file_01, L"12345678901234567890");
base::WriteFile(component_id_folde_subdir_file_01, "12345678901234567890");

ipfs::CleanupIpfsComponent();
task_environment_.RunUntilIdle();
Expand Down
3 changes: 0 additions & 3 deletions components/ipfs/DEPS

This file was deleted.

0 comments on commit 39c6847

Please sign in to comment.