From 39c6847c1da1a0ad4a343400a03fa339ec90f9e4 Mon Sep 17 00:00:00 2001 From: Vadym Struts Date: Thu, 29 Aug 2024 11:53:45 +0200 Subject: [PATCH] fixed according review suggestions Signed-off-by: Vadym Struts --- browser/ipfs/ipfs_component_cleaner.cc | 3 +-- .../ipfs/ipfs_component_cleaner_unittest.cc | 18 ++---------------- components/ipfs/DEPS | 3 --- 3 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 components/ipfs/DEPS diff --git a/browser/ipfs/ipfs_component_cleaner.cc b/browser/ipfs/ipfs_component_cleaner.cc index 7f7078385899..ac2e48b5c7b3 100644 --- a/browser/ipfs/ipfs_component_cleaner.cc +++ b/browser/ipfs/ipfs_component_cleaner.cc @@ -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 diff --git a/browser/ipfs/ipfs_component_cleaner_unittest.cc b/browser/ipfs/ipfs_component_cleaner_unittest.cc index e58241371ae6..bf903553b797 100644 --- a/browser/ipfs/ipfs_component_cleaner_unittest.cc +++ b/browser/ipfs/ipfs_component_cleaner_unittest.cc @@ -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 { @@ -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)); @@ -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(); diff --git a/components/ipfs/DEPS b/components/ipfs/DEPS deleted file mode 100644 index bc3d71b7737c..000000000000 --- a/components/ipfs/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+content/prefs", -] \ No newline at end of file