diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc index 7174f8d9adc1b8..8d47f6fdaf1df0 100644 --- a/apps/app_restore_service_browsertest.cc +++ b/apps/app_restore_service_browsertest.cc @@ -117,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; @@ -158,7 +158,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED, content::NotificationService::AllSources()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; diff --git a/base/test/multiprocess_test.cc b/base/test/multiprocess_test.cc index 24ab0d4b5b2968..68f7604d84076e 100644 --- a/base/test/multiprocess_test.cc +++ b/base/test/multiprocess_test.cc @@ -42,7 +42,7 @@ bool TerminateMultiProcessTestChild(const Process& process, #endif // !defined(OS_ANDROID) CommandLine GetMultiProcessTestChildBaseCommandLine() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CommandLine cmd_line = *CommandLine::ForCurrentProcess(); cmd_line.SetProgram(MakeAbsoluteFilePath(cmd_line.GetProgram())); return cmd_line; diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm index 765b65278371d4..e73f9f3c4b542c 100644 --- a/chrome/browser/app_controller_mac_browsertest.mm +++ b/chrome/browser/app_controller_mac_browsertest.mm @@ -261,7 +261,7 @@ void CreateAndWaitForSystemProfile() { base::scoped_nsobject ac([[AppController alloc] init]); // Lock the active profile. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; Profile* profile = [ac lastProfile]; ProfileAttributesEntry* entry; ASSERT_TRUE(g_browser_process->profile_manager()-> @@ -297,7 +297,7 @@ void CreateAndWaitForSystemProfile() { base::scoped_nsobject ac([[AppController alloc] init]); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; Profile* profile = [ac lastProfile]; EXPECT_EQ(ProfileManager::GetGuestProfilePath(), profile->GetPath()); EXPECT_TRUE(profile->IsGuestSession()); @@ -332,7 +332,7 @@ void CreateAndWaitForSystemProfile() { // Prohibiting guest mode forces the user manager flow for About Chrome. local_state->SetBoolean(prefs::kBrowserGuestModeEnabled, false); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; Profile* guest_profile = [ac lastProfile]; EXPECT_EQ(ProfileManager::GetGuestProfilePath(), guest_profile->GetPath()); EXPECT_TRUE(guest_profile->IsGuestSession()); @@ -545,7 +545,7 @@ void SetUpCommandLine(base::CommandLine* command_line) override { BookmarkModelFactory::GetForBrowserContext(profile1)); // Create profile 2. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path2 = profile_manager->GenerateNextProfileDirectoryPath(); Profile* profile2 = Profile::CreateProfile(path2, NULL, Profile::CREATE_MODE_SYNCHRONOUS); diff --git a/chrome/browser/apps/app_browsertest.cc b/chrome/browser/apps/app_browsertest.cc index 102006cdde46f9..9da7a7ecafcbd0 100644 --- a/chrome/browser/apps/app_browsertest.cc +++ b/chrome/browser/apps/app_browsertest.cc @@ -603,7 +603,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, // a handler accepts "". IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, LaunchWithFileEmptyExtension) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath test_file; @@ -618,7 +618,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, // a handler accepts *. IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, LaunchWithFileEmptyExtensionAcceptAny) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath test_file; @@ -727,7 +727,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, GetDisplayPath) { // Tests that the file is created if the file does not exist and the app has the // fileSystem.write permission. IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, LaunchNewFile) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); ASSERT_TRUE(RunPlatformAppTestWithFile( diff --git a/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm b/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm index 62d97bef0a69ce..56d253c4bf612b 100644 --- a/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm +++ b/chrome/browser/apps/app_shim/app_shim_host_manager_browsertest_mac.mm @@ -69,7 +69,7 @@ void Send(const T& message) { user_data_dir.Append(app_mode::kAppShimSocketSymlinkName); base::FilePath socket_path; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CHECK(base::ReadSymbolicLink(symlink_path, &socket_path)); app_mode::VerifySocketPermissions(socket_path); @@ -84,7 +84,7 @@ void Send(const T& message) { } TestShimClient::~TestShimClient() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; io_thread_.Stop(); } @@ -286,7 +286,7 @@ void OnShimSetHidden(apps::AppShimHandler::Host* host, bool hidden) override { directory_in_tmp_ = test_api.directory_in_tmp(); // Check that socket files have been created. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(directory_in_tmp_)); EXPECT_TRUE(base::PathExists(symlink_path_)); diff --git a/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm b/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm index b92dfdb6a18bcb..62f5aaf33d6953 100644 --- a/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm +++ b/chrome/browser/apps/app_shim/app_shim_interactive_uitest_mac.mm @@ -263,7 +263,7 @@ bool HasAppShimHost(Profile* profile, const std::string& app_id) { // (always) in tests. If it wasn't the case, the following test would fail // (but flakily since the creation happens on the FILE thread). shim_path_ = GetAppShimPath(profile(), app); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(shim_path_)); // To create a shim in a test, instead call UpdateAllShortcuts, which has been diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc index cc0bc99fa73d6c..10644535bb922c 100644 --- a/chrome/browser/apps/guest_view/web_view_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc @@ -2596,7 +2596,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, DownloadPermission) { "web_view/download"); ASSERT_TRUE(guest_web_contents); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temporary_download_dir; ASSERT_TRUE(temporary_download_dir.CreateUniqueTempDir()); DownloadPrefs::FromBrowserContext(guest_web_contents->GetBrowserContext()) @@ -2754,7 +2754,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, DownloadCookieIsolation) { content::WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temporary_download_dir; ASSERT_TRUE(temporary_download_dir.CreateUniqueTempDir()); DownloadPrefs::FromBrowserContext(web_contents->GetBrowserContext()) @@ -2840,7 +2840,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, PRE_DownloadCookieIsolation_CrossSession) { content::WebContents* web_contents = GetFirstAppWindowWebContents(); ASSERT_TRUE(web_contents); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temporary_download_dir; ASSERT_TRUE(temporary_download_dir.CreateUniqueTempDir()); DownloadPrefs::FromBrowserContext(web_contents->GetBrowserContext()) @@ -2899,7 +2899,7 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, DownloadCookieIsolation_CrossSession) { DownloadHistoryWaiter history_waiter(browser_context); history_waiter.WaitForHistoryLoad(); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temporary_download_dir; ASSERT_TRUE(temporary_download_dir.Set( DownloadPrefs::FromBrowserContext(browser_context)->DownloadPath())); diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc index 02fd9a3c847a41..a0f3a1e7090c4b 100644 --- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc @@ -57,7 +57,7 @@ constexpr base::FilePath::CharType kTestFileExtension[] = FILE_PATH_LITERAL( class BrowsingDataLocalStorageHelperTest : public InProcessBrowserTest { protected: void CreateLocalStorageFilesForTest() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Note: This helper depends on details of how the dom_storage library // stores data in the host file system. base::FilePath storage_path = GetLocalStoragePathForTestingProfile(); @@ -131,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataLocalStorageHelperTest, DeleteSingleFile) { content::RunAllTasksUntilIdle(); // Ensure the file has been deleted. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FileEnumerator file_enumerator( GetLocalStoragePathForTestingProfile(), false, diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index 40c025852c2478..c7b3e177071ded 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc @@ -74,7 +74,7 @@ class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { } void DownloadAnItem() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir downloads_directory; ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); browser()->profile()->GetPrefs()->SetFilePath( diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc index 4e1dccf8cb3173..33e7dbc7d582fa 100644 --- a/chrome/browser/chrome_service_worker_browsertest.cc +++ b/chrome/browser/chrome_service_worker_browsertest.cc @@ -64,7 +64,7 @@ class ChromeServiceWorkerTest : public InProcessBrowserTest { void WriteFile(const base::FilePath::StringType& filename, base::StringPiece contents) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_EQ(base::checked_cast(contents.size()), base::WriteFile(service_worker_dir_.GetPath().Append(filename), contents.data(), contents.size())); diff --git a/chrome/browser/chromeos/customization/customization_document_browsertest.cc b/chrome/browser/chromeos/customization/customization_document_browsertest.cc index 31f9908cbb4bec..3f2d80e16c7106 100644 --- a/chrome/browser/chromeos/customization/customization_document_browsertest.cc +++ b/chrome/browser/chromeos/customization/customization_document_browsertest.cc @@ -192,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(CustomizationLocaleTest, CheckAvailableLocales) { waiter.Wait(); { std::string resolved_locale; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; l10n_util::CheckAndResolveLocale(languages_available[i], &resolved_locale); EXPECT_EQ(GetExpectedLanguage(languages_available[i]), resolved_locale) diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 93f1f135525b8b..d1ef79a82e407e 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc @@ -626,7 +626,7 @@ class MultiProfileFileManagerBrowserTest : public FileManagerBrowserTestBase { // Adds a new user for testing to the current session. void AddUser(const TestAccountInfo& info, bool log_in) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; const AccountId account_id(AccountId::FromUserEmail(info.email)); if (log_in) { session_manager::SessionManager::Get()->CreateSession(account_id, diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index f9ce113bbd935a..e35aa822941dbe 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc @@ -625,7 +625,7 @@ void FileManagerBrowserTestBase::RunTestMessageLoop() { void FileManagerBrowserTestBase::OnMessage(const std::string& name, const base::DictionaryValue& value, std::string* output) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (name == "getTestName") { // Pass the test case name. *output = GetTestCaseNameParam(); diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc index 68c1c3ec9d9ae8..d6c9681229353f 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_browsertest.cc @@ -129,7 +129,7 @@ class WallpaperManagerBrowserTest : public InProcessBrowserTest { const char* sub_dir, const wallpaper::WallpaperFilesId& wallpaper_files_id, const std::string& id) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath wallpaper_path = WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, wallpaper_files_id, id); @@ -141,7 +141,7 @@ class WallpaperManagerBrowserTest : public InProcessBrowserTest { // Logs in |account_id|. void LogIn(const AccountId& account_id, const std::string& user_id_hash) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; SessionManager::Get()->CreateSession(account_id, user_id_hash); SessionManager::Get()->SessionStarted(); // Flush to ensure the created session and ACTIVE state reaches ash. @@ -181,7 +181,7 @@ class WallpaperManagerBrowserTest : public InProcessBrowserTest { // Only needs to be called (once) by tests that want to test loading of // default wallpapers. void CreateCmdlineWallpapers() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; wallpaper_dir_.reset(new base::ScopedTempDir); ASSERT_TRUE(wallpaper_dir_->CreateUniqueTempDir()); wallpaper_manager_test_utils::CreateCmdlineWallpapers( diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc index ea077ced30bcc4..6f955e67ef1b28 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc @@ -103,7 +103,7 @@ bool WriteJPEGFile(const base::FilePath& path, int width, int height, SkColor color) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::vector output; if (!CreateJPEGImage(width, height, color, &output)) return false; diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index ee23e24f7e00e1..4a099b21558fe6 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -592,7 +592,7 @@ class DevToolsExtensionTest : public DevToolsSanityTest, const Extension* GetExtensionByPath( const extensions::ExtensionSet& extensions, const base::FilePath& path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath extension_path = base::MakeAbsoluteFilePath(path); EXPECT_TRUE(!extension_path.empty()); for (const scoped_refptr& extension : extensions) { diff --git a/chrome/browser/downgrade/user_data_downgrade_browsertest.cc b/chrome/browser/downgrade/user_data_downgrade_browsertest.cc index dd01edee4474ac..834f197b771600 100644 --- a/chrome/browser/downgrade/user_data_downgrade_browsertest.cc +++ b/chrome/browser/downgrade/user_data_downgrade_browsertest.cc @@ -116,7 +116,7 @@ class UserDataDowngradeBrowserNoMSITest // Verify the user data directory has been renamed and created again after // downgrade. IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserCopyAndCleanTest, Test) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::TaskScheduler::GetInstance()->FlushForTesting(); EXPECT_EQ(chrome::kChromeVersion, GetLastVersion(user_data_dir_).GetString()); ASSERT_FALSE(base::PathExists(other_file_)); @@ -124,14 +124,14 @@ IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserCopyAndCleanTest, Test) { // Verify the user data directory will not be reset without downgrade. IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoResetTest, Test) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_EQ(chrome::kChromeVersion, GetLastVersion(user_data_dir_).GetString()); ASSERT_TRUE(base::PathExists(other_file_)); } // Verify the "Last Version" file won't be created for non-msi install. IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_FALSE(base::PathExists(last_version_file_path_)); ASSERT_TRUE(base::PathExists(other_file_)); } diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 92b67b97902ae2..e9d9c23a8c3d6c 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -513,7 +513,7 @@ class DownloadTest : public InProcessBrowserTest { if (!browser) return false; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!downloads_directory_.CreateUniqueTempDir()) return false; @@ -642,7 +642,7 @@ class DownloadTest : public InProcessBrowserTest { bool CheckDownloadFullPaths(Browser* browser, const base::FilePath& downloaded_file, const base::FilePath& origin_file) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; bool origin_file_exists = base::PathExists(origin_file); EXPECT_TRUE(origin_file_exists) << origin_file.value(); if (!origin_file_exists) @@ -709,7 +709,7 @@ class DownloadTest : public InProcessBrowserTest { SizeTestType type, const std::string& partial_indication, const std::string& total_indication) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(type == SIZE_TEST_TYPE_UNKNOWN || type == SIZE_TEST_TYPE_KNOWN); if (type != SIZE_TEST_TYPE_KNOWN && type != SIZE_TEST_TYPE_UNKNOWN) return false; @@ -805,7 +805,7 @@ class DownloadTest : public InProcessBrowserTest { const int64_t file_size) { std::string file_contents; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; bool read = base::ReadFileToString(path, &file_contents); EXPECT_TRUE(read) << "Failed reading file: " << path.value() << std::endl; if (!read) @@ -940,7 +940,7 @@ class DownloadTest : public InProcessBrowserTest { if (item->GetState() == content::DownloadItem::COMPLETE) { // Clean up the file, in case it ended up in the My Documents folder. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath destination_folder = GetDownloadDirectory(browser()); base::FilePath my_downloaded_file = item->GetTargetFilePath(); EXPECT_TRUE(base::PathExists(my_downloaded_file)); @@ -1215,7 +1215,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, Quarantine_DependsOnLocalConfig) { EXPECT_EQ(1, browser()->tab_strip_model()->count()); base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); base::FilePath downloaded_file(DestinationFile(browser(), file)); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(content::IsFileQuarantined(downloaded_file, url, GURL())); CheckDownload(browser(), file, file); } @@ -1297,7 +1297,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) { ui_test_utils::NavigateToURL(browser(), url); // Check that we did not download the web page. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(file_path)); // Check state. @@ -1397,7 +1397,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { // Check that we did not download the file. base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); base::FilePath file_path(DestinationFile(browser(), file)); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(file_path)); // Check state. @@ -1496,7 +1496,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_IncognitoRegular) { // later. base::FilePath origin(OriginFile(base::FilePath(FILE_PATH_LITERAL( "downloads/a_zip_file.zip")))); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::PathExists(origin)); int64_t origin_file_size = 0; EXPECT_TRUE(base::GetFileSize(origin, &origin_file_size)); @@ -2001,7 +2001,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, AnchorDownloadTag) { // Confirm the downloaded data exists. base::FilePath downloaded_file = GetDownloadDirectory(browser()); downloaded_file = downloaded_file.Append(FILE_PATH_LITERAL("a_red_dot.png")); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(downloaded_file)); } @@ -2224,7 +2224,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) { browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); base::ScopedTempDir other_directory; ASSERT_TRUE(other_directory.CreateUniqueTempDir()); @@ -2261,7 +2261,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, TransientDownload) { browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); base::ScopedTempDir other_directory; ASSERT_TRUE(other_directory.CreateUniqueTempDir()); @@ -2959,7 +2959,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { content::DownloadManager* manager = DownloadManagerForBrowser(browser()); base::FilePath origin_file(OriginFile(base::FilePath(FILE_PATH_LITERAL( "downloads/a_zip_file.zip")))); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::PathExists(origin_file)); std::string origin_contents; ASSERT_TRUE(base::ReadFileToString(origin_file, &origin_contents)); @@ -2977,7 +2977,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { (index == 0 ? std::string(".zip") : base::StringPrintf(" (%d).zip", index)), target_path.BaseName().AsUTF8Unsafe()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::PathExists(target_path)); ASSERT_TRUE(VerifyFile(target_path, origin_contents, origin_contents.size())); @@ -3017,7 +3017,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_CrazyFilenames) { }; std::vector download_items; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath origin_directory = GetDownloadDirectory(browser()).Append(FILE_PATH_LITERAL("origin")); ASSERT_TRUE(base::CreateDirectory(origin_directory)); @@ -3122,7 +3122,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_PercentComplete) { // Ensure that we have enough disk space to download the large file. { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; int64_t free_space = base::SysInfo::AmountOfFreeDiskSpace(GetDownloadDirectory(browser())); ASSERT_LE(parameters.size, free_space) @@ -3155,7 +3155,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_PercentComplete) { ASSERT_EQ(parameters.size, download_items[0]->GetTotalBytes()); // Delete the file. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::DieFileDie(download_items[0]->GetTargetFilePath(), false)); } @@ -3560,7 +3560,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, FeedbackServiceKeepDownload) { GetDownloads(browser(), &updated_downloads); ASSERT_EQ(std::size_t(1), updated_downloads.size()); ASSERT_FALSE(updated_downloads[0]->IsDangerous()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathExists(updated_downloads[0]->GetTargetFilePath())); updated_downloads[0]->Cancel(true); } diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index b6842a6b0942b7..387a250915ce30 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -411,7 +411,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnly) { &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); EXPECT_TRUE(base::ContentsEqual(GetTestDirFile("a.htm"), full_file_name)); @@ -499,7 +499,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnlyTabDestroy) { GetCurrentTab(browser())->Close(); EXPECT_EQ(DownloadItem::CANCELLED, items[0]->GetState()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); } @@ -517,7 +517,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveViewSourceHTMLOnly) { &dir, &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); EXPECT_TRUE(base::ContentsEqual(GetTestDirFile("a.htm"), full_file_name)); @@ -531,7 +531,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveCompleteHTML) { &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::PathExists(dir)); @@ -607,7 +607,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, FileNameFromPageTitle) { ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); persisted.WaitForPersisted(); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::PathExists(dir)); @@ -636,7 +636,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, RemoveFromList) { downloads[0]->Remove(); removed.WaitForRemoved(); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); EXPECT_TRUE(base::ContentsEqual(GetTestDirFile("a.htm"), full_file_name)); @@ -654,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension); base::FilePath dir = download_dir.AppendASCII("test.exe_files"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(full_file_name)); GURL url = URLRequestMockHTTPJob::GetMockUrl("save_page/c.htm"); ui_test_utils::NavigateToURL(browser(), url); @@ -711,7 +711,7 @@ IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); persisted.WaitForPersisted(); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::PathExists(full_file_name)); int64_t actual_file_size = -1; EXPECT_TRUE(base::GetFileSize(full_file_name, &actual_file_size)); @@ -737,7 +737,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) { base::FilePath download_dir = DownloadPrefs::FromDownloadManager( GetDownloadManager())->DownloadPath(); base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::PathExists(filename)); std::string contents; EXPECT_TRUE(base::ReadFileToString(filename, &contents)); @@ -757,7 +757,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, DangerousSubresources) { "dubious-subresources", 2, &dir, &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::PathExists(dir.AppendASCII("not-a-crx.crx.download"))); } @@ -792,7 +792,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveDownloadableIFrame) { "iframe-src-is-a-download", 3, &dir, &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::PathExists(dir.AppendASCII("thisdayinhistory.html"))); EXPECT_TRUE(base::PathExists(dir.AppendASCII("no-such-file.html"))); @@ -804,7 +804,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveUnauthorizedResource) { GURL url = NavigateToMockURL("unauthorized-access"); // Create a test file (that the web page should not have access to). - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir2; ASSERT_TRUE(temp_dir2.CreateUniqueTempDir()); base::FilePath file_path = @@ -875,7 +875,7 @@ IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveAsCompleteHtml) { "frames-xsite-complete-html", 5, &dir, &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::DirectoryExists(dir)); base::FilePath expected_files[] = { full_file_name, @@ -937,7 +937,7 @@ IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveAsMHTML) { std::string mhtml; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::ReadFileToString(full_file_name, &mhtml)); } @@ -1005,7 +1005,7 @@ IN_PROC_BROWSER_TEST_F(SavePageSitePerProcessBrowserTest, SaveCurrentTab(url, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML, "frames-xsite-complete-html", 5, &dir, &full_file_name); ASSERT_FALSE(HasFailure()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::DirectoryExists(dir)); EXPECT_TRUE(base::PathExists(full_file_name)); } diff --git a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc index 8c7a131d0c4250..31e0aa8abb25b0 100644 --- a/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc +++ b/chrome/browser/extensions/api/cast_streaming/cast_streaming_apitest.cc @@ -386,7 +386,7 @@ IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, MAYBE_EndToEnd) { receiver->Stop(); delete receiver; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; cast_environment->Shutdown(); } diff --git a/chrome/browser/extensions/api/commands/command_service_browsertest.cc b/chrome/browser/extensions/api/commands/command_service_browsertest.cc index cfd932f931ddaf..efdef9086864f6 100644 --- a/chrome/browser/extensions/api/commands/command_service_browsertest.cc +++ b/chrome/browser/extensions/api/commands/command_service_browsertest.cc @@ -46,7 +46,7 @@ namespace extensions { typedef ExtensionApiTest CommandServiceTest; IN_PROC_BROWSER_TEST_F(CommandServiceTest, RemoveShortcutSurvivesUpdate) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index b4d3fb3b159fc7..d133a69aeb3fb5 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -694,7 +694,7 @@ class HTML5FileWriter { const storage::FileSystemURL& path, const char* data, int length) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Create a temp file. base::FilePath temp_file; if (!base::CreateTemporaryFile(&temp_file) || @@ -1051,7 +1051,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, base::FilePath fake_path = all_downloads[1]->GetTargetFilePath(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_EQ(0, base::WriteFile(real_path, "", 0)); ASSERT_TRUE(base::PathExists(real_path)); ASSERT_FALSE(base::PathExists(fake_path)); @@ -2585,7 +2585,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, " \"previous\": \"in_progress\"," " \"current\": \"complete\"}}]", result_id))); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::string disk_data; EXPECT_TRUE(base::ReadFileToString(item->GetTargetFilePath(), &disk_data)); EXPECT_STREQ(kPayloadData, disk_data.c_str()); diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 30400437b88073..9d3ecde97461c4 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -73,7 +73,7 @@ void ExecuteExtensionAction(Browser* browser, const Extension* extension) { std::unique_ptr CreateAndSetDownloadsDirectory( PrefService* pref_service) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::unique_ptr dir(new base::ScopedTempDir); if (!dir->CreateUniqueTempDir()) @@ -999,7 +999,7 @@ IN_PROC_BROWSER_TEST_F(NavigatingExtensionPopupBrowserTest, DownloadViaPost) { // Override the default downloads directory, so that the test can cleanup // after itself. This section is based on CreateAndSetDownloadsDirectory // method defined in a few other source files with tests. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::unique_ptr downloads_directory = CreateAndSetDownloadsDirectory(browser()->profile()->GetPrefs()); ASSERT_TRUE(downloads_directory); diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest.cc b/chrome/browser/extensions/api/file_system/file_system_apitest.cc index fde936c0479eaa..50a2b82e4eb7be 100644 --- a/chrome/browser/extensions/api/file_system/file_system_apitest.cc +++ b/chrome/browser/extensions/api/file_system/file_system_apitest.cc @@ -89,7 +89,7 @@ class FileSystemApiTest : public PlatformAppBrowserTest { protected: base::FilePath TempFilePath(const std::string& destination_name, bool copy_gold) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!temp_dir_.CreateUniqueTempDir()) { ADD_FAILURE() << "CreateUniqueTempDir failed"; return base::FilePath(); @@ -109,7 +109,7 @@ class FileSystemApiTest : public PlatformAppBrowserTest { std::vector TempFilePaths( const std::vector& destination_names, bool copy_gold) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!temp_dir_.CreateUniqueTempDir()) { ADD_FAILURE() << "CreateUniqueTempDir failed"; return std::vector(); @@ -132,7 +132,7 @@ class FileSystemApiTest : public PlatformAppBrowserTest { } void CheckStoredDirectoryMatches(const base::FilePath& filename) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension); std::string extension_id = extension->id(); @@ -162,7 +162,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPath) { #if defined(OS_WIN) || defined(OS_POSIX) IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettify) { { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( base::DIR_HOME, test_root_folder_, false, false)); } @@ -180,7 +180,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiGetDisplayPathPrettifyMac) { base::FilePath test_file; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // On Mac, "test.localized" will be localized into just "test". base::FilePath test_path = TempFilePath("test.localized", false); ASSERT_TRUE(base::CreateDirectory(test_path)); @@ -229,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( chrome::DIR_USER_DOCUMENTS, test_file.DirName(), false, false)); } @@ -253,7 +253,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( chrome::DIR_USER_DOCUMENTS, test_file.DirName(), false, false)); } @@ -268,7 +268,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, FileSystemApiOpenMultipleSuggested) { base::FilePath test_file = TempFilePath("open_existing.txt", true); ASSERT_FALSE(test_file.empty()); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( chrome::DIR_USER_DOCUMENTS, test_file.DirName(), false, false)); } @@ -350,7 +350,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, ASSERT_FALSE(test_file.empty()); base::FilePath test_directory = test_file.DirName(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( kGraylistedPath, test_directory, false, false)); } @@ -368,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, ASSERT_FALSE(test_file.empty()); base::FilePath test_directory = test_file.DirName(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( kGraylistedPath, test_directory, false, false)); } @@ -387,7 +387,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, base::FilePath test_directory = test_file.DirName(); base::FilePath parent_directory = test_directory.DirName(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( kGraylistedPath, test_directory, false, false)); } @@ -409,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemApiTest, base::FilePath test_directory = test_file.DirName(); base::FilePath parent_directory = test_directory.DirName(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::OverrideAndCreateIfNeeded( kGraylistedPath, parent_directory, false, false)); } diff --git a/chrome/browser/extensions/api/i18n/i18n_apitest.cc b/chrome/browser/extensions/api/i18n/i18n_apitest.cc index 0a1735adc889c7..6eda3618fc2f8d 100644 --- a/chrome/browser/extensions/api/i18n/i18n_apitest.cc +++ b/chrome/browser/extensions/api/i18n/i18n_apitest.cc @@ -22,7 +22,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18N) { IN_PROC_BROWSER_TEST_F(ExtensionApiTest, I18NUpdate) { ASSERT_TRUE(embedded_test_server()->Start()); // Create an Extension whose messages.json file will be updated. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir extension_dir; ASSERT_TRUE(extension_dir.CreateUniqueTempDir()); base::CopyFile( diff --git a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client_browsertest.cc b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client_browsertest.cc index dc42c2d9e7f60b..4df504c1d084f0 100644 --- a/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client_browsertest.cc +++ b/chrome/browser/extensions/api/image_writer_private/image_writer_utility_client_browsertest.cc @@ -29,14 +29,14 @@ constexpr int64_t kTestFileSize = 1 << 15; // 32 kB class ImageWriterUtilityClientTest : public InProcessBrowserTest { public: ImageWriterUtilityClientTest() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; test_device_ = base::FilePath().AppendASCII( extensions::mojom::RemovableStorageWriter::kTestDevice); EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); } void FillImageFileWithPattern(char pattern) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &image_)); base::RunLoop run_loop; diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc index a810a65de0cbe8..b2e8d86bea0fb6 100644 --- a/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc @@ -107,7 +107,7 @@ class MediaGalleriesPlatformAppBrowserTest : public PlatformAppBrowserTest { test_data_dir_.AppendASCII(kTestDir + extension_name); from_dir = from_dir.NormalizePathSeparators(); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; if (!temp_dir.CreateUniqueTempDir()) return false; @@ -168,7 +168,7 @@ class MediaGalleriesPlatformAppBrowserTest : public PlatformAppBrowserTest { // with no default media galleries, such as CHROMEOS. This fake gallery is // pre-populated with a test.jpg and test.txt. void MakeSingleFakeGallery(MediaGalleryPrefId* pref_id) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_FALSE(fake_gallery_temp_dir_.IsValid()); ASSERT_TRUE(fake_gallery_temp_dir_.CreateUniqueTempDir()); @@ -200,7 +200,7 @@ class MediaGalleriesPlatformAppBrowserTest : public PlatformAppBrowserTest { } void AddFileToSingleFakeGallery(const base::FilePath& source_path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(fake_gallery_temp_dir_.IsValid()); ASSERT_TRUE(base::CopyFile( diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc index e8e43de046fef9..0e662e59525bfd 100644 --- a/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc @@ -110,7 +110,7 @@ class MediaGalleriesGalleryWatchApiTest : public ExtensionApiTest { } bool AddNewFileInTestGallery() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath gallery_file = test_gallery_.GetPath().Append(FILE_PATH_LITERAL("test1.txt")); std::string content("new content"); diff --git a/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc b/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc index 3c28d3e494a243..4067196dcaa8a6 100644 --- a/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc +++ b/chrome/browser/extensions/api/messaging/native_messaging_test_util.cc @@ -69,7 +69,7 @@ const char ScopedTestNativeMessagingHost::kExtensionId[] = ScopedTestNativeMessagingHost::ScopedTestNativeMessagingHost() {} void ScopedTestNativeMessagingHost::RegisterTestHost(bool user_level) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); ScopedTestNativeMessagingHost test_host; @@ -102,7 +102,7 @@ void ScopedTestNativeMessagingHost::RegisterTestHost(bool user_level) { } ScopedTestNativeMessagingHost::~ScopedTestNativeMessagingHost() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ignore_result(temp_dir_.Delete()); } diff --git a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc index 6bc8dc15753d0e..df5f8b073ada8a 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc @@ -62,7 +62,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, SaveAsMHTML) { content::RunAllPendingInMessageLoop(content::BrowserThread::IO); // Make sure the temporary file is destroyed once the javascript side reads // the contents. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_FALSE(base::PathExists(delegate.temp_file_)); } @@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, ASSERT_FALSE(delegate.temp_file_.empty()); content::RunAllTasksUntilIdle(); content::RunAllPendingInMessageLoop(content::BrowserThread::IO); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_FALSE(base::PathExists(delegate.temp_file_)); } diff --git a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc index 2238cca632d373..23278aece139b0 100644 --- a/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc +++ b/chrome/browser/extensions/api/streams_private/streams_private_apitest.cc @@ -152,7 +152,7 @@ class StreamsPrivateApiTest : public ExtensionApiTest { } void InitializeDownloadSettings() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(browser()); ASSERT_TRUE(downloads_dir_.CreateUniqueTempDir()); diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index 16c58cb39a63b9..da1fc213ac0510 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -404,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, DISABLED_ServerRedirect) { } IN_PROC_BROWSER_TEST_F(WebNavigationApiTest, Download) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir download_directory; ASSERT_TRUE(download_directory.CreateUniqueTempDir()); DownloadPrefs* download_prefs = diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc index e13d805a9d05c9..4a8f8d6a78a93d 100644 --- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc +++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc @@ -67,7 +67,7 @@ class FileWaiter : public base::RefCountedThreadSafe { : found_(false), path_(path) {} bool Start() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (base::PathExists(path_)) { found_ = true; return true; @@ -236,7 +236,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartStopWebRtcEventLogging) { ASSERT_TRUE(waiter->Start()) << "ERROR watching for " << full_file_name.value(); ASSERT_TRUE(waiter->WaitForFile()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::GetFileSize(full_file_name, &file_size)); EXPECT_GT(file_size, 0); @@ -247,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartStopWebRtcEventLogging) { IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartTimedWebRtcEventLogging) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(embedded_test_server()->Start()); content::WebContents* left_tab = diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index 6c441e18af33e1..ef75b2583a4fab 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -221,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallAccepted) { // Test having the default download directory missing. IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, MissingDownloadDir) { // Set a non-existent directory as the download path. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath missing_directory = temp_dir.Take(); diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index fa7e17d3b0efb3..5e2d85da57cb25 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -65,7 +65,7 @@ class AppBackgroundPageApiTest : public ExtensionApiTest { bool CreateApp(const std::string& app_manifest, base::FilePath* app_dir) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!app_dir_.CreateUniqueTempDir()) { LOG(ERROR) << "Unable to create a temporary directory."; return false; @@ -141,7 +141,7 @@ class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest { protected: void LaunchTestingApp() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath app_dir; PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir); app_dir = app_dir.AppendASCII( diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index a650aec0ffb877..4da3174f4c2c79 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -324,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_BookmarkAppGetsNormalProcess) { std::string error; scoped_refptr extension; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; extension = extensions::file_util::LoadExtension( test_data_dir_.AppendASCII("app_process"), extensions::Manifest::UNPACKED, Extension::FROM_BOOKMARK, &error); diff --git a/chrome/browser/extensions/chrome_test_extension_loader.cc b/chrome/browser/extensions/chrome_test_extension_loader.cc index 600586a3dac1c2..3b113bbd69d0de 100644 --- a/chrome/browser/extensions/chrome_test_extension_loader.cc +++ b/chrome/browser/extensions/chrome_test_extension_loader.cc @@ -38,7 +38,7 @@ ChromeTestExtensionLoader::ChromeTestExtensionLoader( ChromeTestExtensionLoader::~ChromeTestExtensionLoader() { // If there was a temporary directory created for a CRX, we need to clean it // up before the member is destroyed so we can explicitly allow IO. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (temp_dir_.IsValid()) EXPECT_TRUE(temp_dir_.Delete()); } @@ -109,7 +109,7 @@ bool ChromeTestExtensionLoader::WaitForExtensionReady() { base::FilePath ChromeTestExtensionLoader::PackExtension( const base::FilePath& unpacked_path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!base::PathExists(unpacked_path)) { ADD_FAILURE() << "Unpacked path does not exist: " << unpacked_path.value(); return base::FilePath(); diff --git a/chrome/browser/extensions/content_verifier_browsertest.cc b/chrome/browser/extensions/content_verifier_browsertest.cc index b4997efaafef9c..c0e76a2c079b70 100644 --- a/chrome/browser/extensions/content_verifier_browsertest.cc +++ b/chrome/browser/extensions/content_verifier_browsertest.cc @@ -542,7 +542,7 @@ class ContentVerifierTest : public ExtensionBrowserTest { base::FilePath scriptfile = extension->path().AppendASCII(script_relpath); std::string extra = "some_extra_function_call();"; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::AppendToFile(scriptfile, extra.data(), extra.size())); } DisableExtension(id); diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index 1c79dfb2cfce89..009bf95d3b99e8 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -157,7 +157,7 @@ bool ExtensionBrowserTest::ShouldEnableContentVerification() { const Extension* ExtensionBrowserTest::GetExtensionByPath( const extensions::ExtensionSet& extensions, const base::FilePath& path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath extension_path = base::MakeAbsoluteFilePath(path); EXPECT_TRUE(!extension_path.empty()); for (const scoped_refptr& extension : extensions) { @@ -264,7 +264,7 @@ const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest( profile())->extension_service(); ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::string manifest; if (!base::ReadFileToString(path.Append(manifest_relative_path), &manifest)) { return NULL; @@ -321,7 +321,7 @@ Browser* ExtensionBrowserTest::LaunchAppBrowser( base::FilePath ExtensionBrowserTest::PackExtension( const base::FilePath& dir_path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath crx_path = temp_dir_.GetPath().AppendASCII("temp.crx"); if (!base::DeleteFile(crx_path, false)) { ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); @@ -350,7 +350,7 @@ base::FilePath ExtensionBrowserTest::PackExtensionWithOptions( const base::FilePath& crx_path, const base::FilePath& pem_path, const base::FilePath& pem_out_path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!base::PathExists(dir_path)) { ADD_FAILURE() << "Extension dir not found: " << dir_path.value(); return base::FilePath(); diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc index b477aad57f949e..4b319f8105f828 100644 --- a/chrome/browser/extensions/extension_keybinding_apitest.cc +++ b/chrome/browser/extensions/extension_keybinding_apitest.cc @@ -559,7 +559,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, MAYBE_AllowDuplicatedMediaKeys) { } IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutAddedOnUpdate) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. @@ -605,7 +605,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutAddedOnUpdate) { } IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutChangedOnUpdate) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. @@ -654,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutChangedOnUpdate) { } IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutRemovedOnUpdate) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. @@ -701,7 +701,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutRemovedOnUpdate) { IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutAddedOnUpdateAfterBeingAssignedByUser) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. @@ -752,7 +752,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutChangedOnUpdateAfterBeingReassignedByUser) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. @@ -807,7 +807,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, // Test that Media keys do not overwrite previous settings. IN_PROC_BROWSER_TEST_F(CommandsApiTest, MediaKeyShortcutChangedOnUpdateAfterBeingReassignedByUser) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. @@ -861,7 +861,7 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, IN_PROC_BROWSER_TEST_F(CommandsApiTest, ShortcutRemovedOnUpdateAfterBeingReassignedByUser) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; EXPECT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_. diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc index 627246cbd4833b..b9f56096647a6b 100644 --- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc +++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc @@ -83,7 +83,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { // resources. std::string file_source; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::ReadFileToString( test_data_dir_.AppendASCII("extension_resource_request_policy") .AppendASCII("index.html"), diff --git a/chrome/browser/extensions/extension_webui_apitest.cc b/chrome/browser/extensions/extension_webui_apitest.cc index 3c234a71215fdc..cf6cf5c7149788 100644 --- a/chrome/browser/extensions/extension_webui_apitest.cc +++ b/chrome/browser/extensions/extension_webui_apitest.cc @@ -37,7 +37,7 @@ class ExtensionWebUITest : public ExtensionApiTest { bool expected_result) { std::string script; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Tests are located in chrome/test/data/extensions/webui/$(name). base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index ec3a48ddc7425e..a169bddcd11fc6 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -327,7 +327,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForRequest) { IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, NaClInBackgroundPage) { { base::FilePath extdir; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &extdir)); extdir = extdir.AppendASCII("ppapi/tests/extensions/load_unload/newlib"); LazyBackgroundObserver page_complete; @@ -364,7 +364,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, NaClInView) { // page, and the Lazy Background Page stays alive. { base::FilePath extdir; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &extdir)); extdir = extdir.AppendASCII("ppapi/tests/extensions/popup/newlib"); ResultCatcher catcher; diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc index c594d7b8bdbce4..1b738d810e4803 100644 --- a/chrome/browser/extensions/service_worker_apitest.cc +++ b/chrome/browser/extensions/service_worker_apitest.cc @@ -337,7 +337,7 @@ IN_PROC_BROWSER_TEST_P(ServiceWorkerTest, RegisterSucceeds) { } IN_PROC_BROWSER_TEST_P(ServiceWorkerTest, UpdateRefreshesServiceWorker) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_.AppendASCII("service_worker") @@ -379,7 +379,7 @@ IN_PROC_BROWSER_TEST_P(ServiceWorkerTest, UpdateRefreshesServiceWorker) { // TODO(crbug.com/765736) Fix the test. IN_PROC_BROWSER_TEST_P(ServiceWorkerTest, DISABLED_UpdateWithoutSkipWaiting) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir scoped_temp_dir; ASSERT_TRUE(scoped_temp_dir.CreateUniqueTempDir()); base::FilePath pem_path = test_data_dir_.AppendASCII("service_worker") diff --git a/chrome/browser/extensions/startup_helper_browsertest.cc b/chrome/browser/extensions/startup_helper_browsertest.cc index 36fcc367f0c78e..8f7807d4522632 100644 --- a/chrome/browser/extensions/startup_helper_browsertest.cc +++ b/chrome/browser/extensions/startup_helper_browsertest.cc @@ -50,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(StartupHelperBrowserTest, ValidateCrx) { std::string error; extensions::StartupHelper helper; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; bool result = helper.ValidateCrx(command_line, &error); if (i->second) { EXPECT_TRUE(result) << path.LossyDisplayName() diff --git a/chrome/browser/extensions/test_extension_dir.cc b/chrome/browser/extensions/test_extension_dir.cc index daf2c76e3411c5..18dc45ab645f7c 100644 --- a/chrome/browser/extensions/test_extension_dir.cc +++ b/chrome/browser/extensions/test_extension_dir.cc @@ -16,13 +16,13 @@ namespace extensions { TestExtensionDir::TestExtensionDir() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(dir_.CreateUniqueTempDir()); EXPECT_TRUE(crx_dir_.CreateUniqueTempDir()); } TestExtensionDir::~TestExtensionDir() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ignore_result(dir_.Delete()); ignore_result(crx_dir_.Delete()); } @@ -40,7 +40,7 @@ void TestExtensionDir::WriteManifestWithSingleQuotes( void TestExtensionDir::WriteFile(const base::FilePath::StringType& filename, base::StringPiece contents) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_EQ(base::checked_cast(contents.size()), base::WriteFile(dir_.GetPath().Append(filename), contents.data(), contents.size())); @@ -49,7 +49,7 @@ void TestExtensionDir::WriteFile(const base::FilePath::StringType& filename, // This function packs the extension into a .crx, and returns the path to that // .crx. Multiple calls to Pack() will produce extensions with the same ID. base::FilePath TestExtensionDir::Pack() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ExtensionCreator creator; base::FilePath crx_path = crx_dir_.GetPath().Append(FILE_PATH_LITERAL("ext.crx")); @@ -74,7 +74,7 @@ base::FilePath TestExtensionDir::Pack() { } base::FilePath TestExtensionDir::UnpackedPath() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // We make this absolute because it's possible that dir_ contains a symlink as // part of it's path. When UnpackedInstaller::GetAbsolutePath() runs as part // of loading the extension, the extension's path is converted to an absolute diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index e41893f911ecc6..e3d43534cd064f 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -135,7 +135,7 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) { final_url.spec().c_str()); // Write the contents to a temporary file. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; diff --git a/chrome/browser/importer/edge_importer_browsertest_win.cc b/chrome/browser/importer/edge_importer_browsertest_win.cc index 96737606f84e53..1742658b91492b 100644 --- a/chrome/browser/importer/edge_importer_browsertest_win.cc +++ b/chrome/browser/importer/edge_importer_browsertest_win.cc @@ -203,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporter) { base::FilePath temp_path = temp_dir_.GetPath(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::CopyDirectory(data_path, temp_path, true)); ASSERT_TRUE(DecompressDatabase(temp_path.AppendASCII("edge_profile"))); } @@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporterLegacyFallback) { data_path = data_path.AppendASCII("edge_profile"); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::CopyDirectory(data_path, temp_dir_.GetPath(), true)); ASSERT_TRUE(importer::IsEdgeFavoritesLegacyMode()); } @@ -262,7 +262,7 @@ IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporterLegacyFallback) { source_profile.importer_type = importer::TYPE_EDGE; base::FilePath source_path = temp_dir_.GetPath().AppendASCII("edge_profile"); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_NE( -1, base::WriteFile( source_path.AppendASCII("Favorites\\Google.url:favicon:$DATA"), diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc index e64c241425bcca..da8b76d8b989d5 100644 --- a/chrome/browser/importer/ie_importer_browsertest_win.cc +++ b/chrome/browser/importer/ie_importer_browsertest_win.cc @@ -436,7 +436,7 @@ class IEImporterBrowserTest : public InProcessBrowserTest { }; IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporter) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Sets up a favorites folder. base::FilePath path = temp_dir_.GetPath().AppendASCII("Favorites"); CreateDirectory(path.value().c_str(), NULL); @@ -650,4 +650,3 @@ IN_PROC_BROWSER_TEST_F(IEImporterBrowserTest, IEImporterHomePageTest) { observer); base::RunLoop().Run(); } - diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc index fd3b3e826494a8..4a0363051a97a6 100644 --- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc +++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc @@ -1175,7 +1175,7 @@ IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest, { base::FilePath path = profile_manager->user_data_dir().AppendASCII("test_profile"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!base::PathExists(path)) ASSERT_TRUE(base::CreateDirectory(path)); other_profile = diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc index 9b1d16d52f94e3..304b9daa19823d 100644 --- a/chrome/browser/media/encrypted_media_browsertest.cc +++ b/chrome/browser/media/encrypted_media_browsertest.cc @@ -231,7 +231,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest { return; license_server_.reset(new TestLicenseServer(std::move(config))); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(license_server_->Start()); } query_params->push_back( diff --git a/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc b/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc index 7ae0618e335f02..3e0ff06347d8d1 100644 --- a/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc @@ -243,7 +243,7 @@ class WebRtcApprtcBrowserTest : public WebRtcTestBase { }; IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; DetectErrorsInJavaScript(); ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); diff --git a/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc b/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc index 01216079e4c32a..e34421d104a26c 100644 --- a/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_audio_quality_browsertest.cc @@ -684,13 +684,13 @@ void MAYBE_WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia( IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, MANUAL_TestCallQualityWithAudioFromFakeDevice) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; TestWithFakeDeviceGetUserMedia(kAudioOnlyCallConstraints, "_getusermedia"); } IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, MANUAL_TestCallQualityWithAudioFromWebAudio) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (OnWin8OrHigher()) { // http://crbug.com/379798. LOG(ERROR) << "This test is not implemented for Win8 or higher."; @@ -806,7 +806,7 @@ void MAYBE_WebRtcAudioQualityBrowserTest::TestAutoGainControl( // The AGC should apply non-zero gain here. IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, MANUAL_TestAutoGainControlOnLowAudio) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_NO_FATAL_FAILURE(TestAutoGainControl( kReferenceFile, kAudioOnlyCallConstraints, "_with_agc")); } @@ -814,7 +814,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, // Since the AGC is off here there should be no gain at all. IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, MANUAL_TestAutoGainIsOffWithAudioProcessingOff) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; const char* kAudioCallWithoutAudioProcessing = "{audio: { mandatory: { echoCancellation: false } } }"; ASSERT_NO_FATAL_FAILURE(TestAutoGainControl( diff --git a/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc b/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc index fcd03a3700fdd5..f92760f900c425 100644 --- a/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_internals_perf_browsertest.cc @@ -228,7 +228,7 @@ class WebRtcInternalsPerfBrowserTest : public WebRtcTestBase { IN_PROC_BROWSER_TEST_F( WebRtcInternalsPerfBrowserTest, MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioVideoCall60SecsAndLogsInternalMetrics( "VP8", false /* prefer_hw_video_codec */); } @@ -236,7 +236,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcInternalsPerfBrowserTest, MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp9) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioVideoCall60SecsAndLogsInternalMetrics( "VP9", false /* prefer_hw_video_codec */); } @@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcInternalsPerfBrowserTest, MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsH264) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Only run test if run-time feature corresponding to |rtc_use_h264| is on. if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " @@ -264,13 +264,13 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcInternalsPerfBrowserTest, MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsDefault) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsOneWayCall60SecsAndLogsInternalMetrics("", false); } IN_PROC_BROWSER_TEST_F( WebRtcInternalsPerfBrowserTest, MANUAL_RunsOneWayCall60SecsAndLogsInternalMetricsWithOpusDtx) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsOneWayCall60SecsAndLogsInternalMetrics("", true); } diff --git a/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc b/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc index cd28721716da2c..5fbf3268074193 100644 --- a/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_stats_perf_browsertest.cc @@ -249,42 +249,42 @@ class WebRtcStatsPerfBrowserTest : public WebRtcTestBase { IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_AudioCodec_opus) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithAudioCodec("opus"); } IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_AudioCodec_ISAC) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithAudioCodec("ISAC"); } IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_AudioCodec_G722) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithAudioCodec("G722"); } IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_AudioCodec_PCMU) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithAudioCodec("PCMU"); } IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_AudioCodec_PCMA) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithAudioCodec("PCMA"); } IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_VideoCodec_VP8) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithVideoCodec( "VP8", false /* prefer_hw_video_codec */); } @@ -292,7 +292,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_VideoCodec_VP9) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallCollectingMetricsWithVideoCodec( "VP9", false /* prefer_hw_video_codec */); } @@ -302,7 +302,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallCollectingMetrics_VideoCodec_H264) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Only run test if run-time feature corresponding to |rtc_use_h264| is on. if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " @@ -320,7 +320,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallMeasuringGetStatsPerformance_Promise) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallMeasuringGetStatsPerformance( GetStatsVariation::PROMISE_BASED); } @@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_F( IN_PROC_BROWSER_TEST_F( WebRtcStatsPerfBrowserTest, MANUAL_RunsAudioAndVideoCallMeasuringGetStatsPerformance_Callback) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RunsAudioAndVideoCallMeasuringGetStatsPerformance( GetStatsVariation::CALLBACK_BASED); } diff --git a/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc b/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc index 646f65a8691a41..7cf813dfe83197 100644 --- a/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_video_quality_browsertest.cc @@ -346,13 +346,13 @@ INSTANTIATE_TEST_CASE_P( IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, MANUAL_TestVideoQualityVp8) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; TestVideoQuality("VP8", false /* prefer_hw_video_codec */); } IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, MANUAL_TestVideoQualityVp9) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; TestVideoQuality("VP9", false /* prefer_hw_video_codec */); } @@ -367,7 +367,7 @@ IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, MAYBE_MANUAL_TestVideoQualityH264) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Only run test if run-time feature corresponding to |rtc_use_h264| is on. if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " diff --git a/chrome/browser/media_galleries/media_galleries_test_util.cc b/chrome/browser/media_galleries/media_galleries_test_util.cc index b34bfe6c5477a5..68e910bf9e1b6e 100644 --- a/chrome/browser/media_galleries/media_galleries_test_util.cc +++ b/chrome/browser/media_galleries/media_galleries_test_util.cc @@ -94,7 +94,7 @@ EnsureMediaDirectoriesExists::EnsureMediaDirectoriesExists() } EnsureMediaDirectoriesExists::~EnsureMediaDirectoriesExists() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ignore_result(fake_dir_.Delete()); } @@ -131,7 +131,7 @@ void EnsureMediaDirectoriesExists::ChangeMediaPathOverrides() { } base::FilePath EnsureMediaDirectoriesExists::GetFakeAppDataPath() const { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; DCHECK(fake_dir_.IsValid()); return fake_dir_.GetPath().AppendASCII("appdata"); } diff --git a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc index 1153f7cc2e4e54..80141fbb650c57 100644 --- a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc +++ b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc @@ -57,7 +57,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { return; } #endif - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::CreateTemporaryFile(&mock_nacl_gdb_file)); env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); RunTestViaHTTP(test_name); diff --git a/chrome/browser/net/errorpage_browsertest.cc b/chrome/browser/net/errorpage_browsertest.cc index 89b8643dbaa10f..6facf9545c1404 100644 --- a/chrome/browser/net/errorpage_browsertest.cc +++ b/chrome/browser/net/errorpage_browsertest.cc @@ -562,7 +562,7 @@ void InterceptNetworkTransactions(net::URLRequestContextGetter* getter, // button to launch a network diagnostics tool. IN_PROC_BROWSER_TEST_F(ErrorPageTest, FileNotFound) { // Create an empty temp directory, to be sure there's no file in it. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); GURL non_existent_file_url = diff --git a/chrome/browser/net/network_context_configuration_browsertest.cc b/chrome/browser/net/network_context_configuration_browsertest.cc index bbbc9600841d25..ebe0c8ff367f4e 100644 --- a/chrome/browser/net/network_context_configuration_browsertest.cc +++ b/chrome/browser/net/network_context_configuration_browsertest.cc @@ -180,7 +180,7 @@ IN_PROC_BROWSER_TEST_P(NetworkContextConfigurationBrowserTest, DataURL) { } IN_PROC_BROWSER_TEST_P(NetworkContextConfigurationBrowserTest, FileURL) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir_; ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); base::FilePath file_path; @@ -259,7 +259,7 @@ IN_PROC_BROWSER_TEST_P(NetworkContextConfigurationBrowserTest, PRE_DiskCache) { // cache in the next test). The profile directory is preserved between the // PRE_DiskCache and DiskCache run, so can just keep a file there. GURL test_url = embedded_test_server()->GetURL("/echoheadercache?foo"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath save_url_file_path = browser()->profile()->GetPath().Append( FILE_PATH_LITERAL("url_for_test.txt")); ASSERT_EQ(static_cast(test_url.spec().length()), @@ -288,7 +288,7 @@ IN_PROC_BROWSER_TEST_P(NetworkContextConfigurationBrowserTest, PRE_DiskCache) { // browser restart. IN_PROC_BROWSER_TEST_P(NetworkContextConfigurationBrowserTest, DiskCache) { // Load URL from the above test body to disk. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath save_url_file_path = browser()->profile()->GetPath().Append( FILE_PATH_LITERAL("url_for_test.txt")); std::string test_url_string; diff --git a/chrome/browser/net/profile_network_context_service_browsertest.cc b/chrome/browser/net/profile_network_context_service_browsertest.cc index 5d9f51d55708e7..1bd9c41773ad48 100644 --- a/chrome/browser/net/profile_network_context_service_browsertest.cc +++ b/chrome/browser/net/profile_network_context_service_browsertest.cc @@ -92,7 +92,7 @@ IN_PROC_BROWSER_TEST_P(ProfileNetworkContextServiceBrowsertest, chrome::GetUserCacheDirectory(browser()->profile()->GetPath(), &expected_cache_path); expected_cache_path = expected_cache_path.Append(chrome::kCacheDirname); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(expected_cache_path)); } @@ -174,7 +174,7 @@ IN_PROC_BROWSER_TEST_P(ProfileNetworkContextServiceDiskCacheDirBrowsertest, TempPath() .Append(browser()->profile()->GetPath().BaseName()) .Append(chrome::kCacheDirname); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::PathExists(expected_cache_path)); } diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc index 8fbbc65cae8ac7..898b5f7dec8a00 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc @@ -679,7 +679,7 @@ IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, Ignore204Pages) { IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, IgnoreDownloads) { ASSERT_TRUE(embedded_test_server()->Start()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir downloads_directory; ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); browser()->profile()->GetPrefs()->SetFilePath( diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 9fb86b80abd063..2ccb208cfb962a 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc @@ -100,7 +100,7 @@ class MockLoginModelObserver : public password_manager::LoginModelObserver { }; GURL GetFileURL(const char* filename) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("password").AppendASCII(filename); diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc index 8a1ba11cec3f5b..f70c0cc6357123 100644 --- a/chrome/browser/pdf/pdf_extension_test.cc +++ b/chrome/browser/pdf/pdf_extension_test.cc @@ -152,7 +152,7 @@ class PDFExtensionTest : public ExtensionApiTest, std::string mock_interactions_js; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); test_data_dir = test_data_dir.Append(FILE_PATH_LITERAL("pdf")); @@ -209,7 +209,7 @@ class PDFExtensionTest : public ExtensionApiTest, // the test if base::Hash(filename) mod kNumberLoadTestParts == k in order // to shard the files evenly across values of k in [0, kNumberLoadTestParts). void LoadAllPdfsTest(const std::string& dir_name, int k) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); base::FileEnumerator file_enumerator(test_data_dir.AppendASCII(dir_name), @@ -500,7 +500,7 @@ IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BlockDirectAccess) { IN_PROC_BROWSER_TEST_F(PDFExtensionTest, EnsurePDFFromLocalFileLoads) { GURL test_pdf_url; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir)); test_data_dir = test_data_dir.Append(FILE_PATH_LITERAL("pdf")); diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc index cbc72758d089d3..b41210ac5331f1 100644 --- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc +++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc @@ -228,7 +228,7 @@ void CompareSnapshotToReference(const base::FilePath& reference, const base::Closure& done_cb, const SkBitmap& bitmap, content::ReadbackResponse response) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; DCHECK(snapshot_matches); ASSERT_EQ(content::READBACK_SUCCESS, response); diff --git a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc index 8d60c535a82dcc..f1d9b7c66014dc 100644 --- a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc @@ -284,7 +284,7 @@ class CloudPolicyTest : public InProcessBrowserTest, } void SetServerPolicy(const std::string& policy) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; int result = base::WriteFile(policy_file_path(), policy.data(), policy.size()); ASSERT_EQ(base::checked_cast(policy.size()), result); diff --git a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc index 810a4b45ed564c..986f1ea79e2c5b 100644 --- a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc @@ -315,7 +315,7 @@ IN_PROC_BROWSER_TEST_F(ComponentCloudPolicyTest, SignOutAndBackIn) { base::Base64UrlEncode( kTestExtension, base::Base64UrlEncodePolicy::INCLUDE_PADDING, &cache_subkey); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath cache_path = browser()->profile()->GetPath() .Append(FILE_PATH_LITERAL("Policy")) .Append(FILE_PATH_LITERAL("Components")) diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 8dffc316974cec..3440a773a6ee8d 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -894,7 +894,7 @@ IN_PROC_BROWSER_TEST_F(LocalePolicyTest, ApplicationLocaleValue) { EXPECT_EQ(french_title, title); // Make sure this is really French and differs from the English title. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::string loaded = ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("en-US"); EXPECT_EQ("en-US", loaded); @@ -1448,7 +1448,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { // Verifies that the download directory can be forced by policy. // Set the initial download directory. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir initial_dir; ASSERT_TRUE(initial_dir.CreateUniqueTempDir()); browser()->profile()->GetPrefs()->SetFilePath( @@ -1850,7 +1850,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { URLRequestMockHTTPJob::GetMockUrl("extensions/*")); const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl("policy/*")); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir download_directory; ASSERT_TRUE(download_directory.CreateUniqueTempDir()); DownloadPrefs* download_prefs = diff --git a/chrome/browser/policy/policy_prefs_browsertest.cc b/chrome/browser/policy/policy_prefs_browsertest.cc index b35b5bcaa9f04e..13f89fc77695b0 100644 --- a/chrome/browser/policy/policy_prefs_browsertest.cc +++ b/chrome/browser/policy/policy_prefs_browsertest.cc @@ -232,7 +232,7 @@ class PolicyTestCases { typedef PolicyTestCaseMap::const_iterator iterator; PolicyTestCases() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path = ui_test_utils::GetTestFilePath( base::FilePath(FILE_PATH_LITERAL("policy")), base::FilePath(FILE_PATH_LITERAL("policy_test_cases.json"))); diff --git a/chrome/browser/policy/test/local_policy_test_server.cc b/chrome/browser/policy/test/local_policy_test_server.cc index fe68104f533904..10bb06d3462fad 100644 --- a/chrome/browser/policy/test/local_policy_test_server.cc +++ b/chrome/browser/policy/test/local_policy_test_server.cc @@ -62,7 +62,7 @@ bool IsUnsafeCharacter(char c) { LocalPolicyTestServer::LocalPolicyTestServer() : net::LocalTestServer(net::BaseTestServer::TYPE_HTTP, base::FilePath()) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CHECK(server_data_dir_.CreateUniqueTempDir()); config_file_ = server_data_dir_.GetPath().Append(kPolicyFileName); } @@ -74,7 +74,7 @@ LocalPolicyTestServer::LocalPolicyTestServer(const base::FilePath& config_file) LocalPolicyTestServer::LocalPolicyTestServer(const std::string& test_name) : net::LocalTestServer(net::BaseTestServer::TYPE_HTTP, base::FilePath()) { // Read configuration from a file in chrome/test/data/policy. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath source_root; CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &source_root)); config_file_ = source_root @@ -89,7 +89,7 @@ LocalPolicyTestServer::~LocalPolicyTestServer() {} bool LocalPolicyTestServer::SetSigningKeyAndSignature( const crypto::RSAPrivateKey* key, const std::string& signature) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CHECK(server_data_dir_.IsValid()); std::vector signing_key_bits; @@ -145,7 +145,7 @@ void LocalPolicyTestServer::RegisterClient(const std::string& dm_token, bool LocalPolicyTestServer::UpdatePolicy(const std::string& type, const std::string& entity_id, const std::string& policy) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CHECK(server_data_dir_.IsValid()); std::string selector = GetSelector(type, entity_id); @@ -159,7 +159,7 @@ bool LocalPolicyTestServer::UpdatePolicy(const std::string& type, bool LocalPolicyTestServer::UpdatePolicyData(const std::string& type, const std::string& entity_id, const std::string& data) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CHECK(server_data_dir_.IsValid()); std::string selector = GetSelector(type, entity_id); @@ -175,7 +175,7 @@ GURL LocalPolicyTestServer::GetServiceURL() const { } bool LocalPolicyTestServer::SetPythonPath() const { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!net::LocalTestServer::SetPythonPath()) return false; @@ -223,7 +223,7 @@ bool LocalPolicyTestServer::SetPythonPath() const { bool LocalPolicyTestServer::GetTestServerPath( base::FilePath* testserver_path) const { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath source_root; if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_root)) { LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; @@ -240,7 +240,7 @@ bool LocalPolicyTestServer::GetTestServerPath( bool LocalPolicyTestServer::GenerateAdditionalArguments( base::DictionaryValue* arguments) const { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!net::LocalTestServer::GenerateAdditionalArguments(arguments)) return false; diff --git a/chrome/browser/prefs/pref_functional_browsertest.cc b/chrome/browser/prefs/pref_functional_browsertest.cc index 9d671e3f1bf5a9..07fc47ac2d2f5f 100644 --- a/chrome/browser/prefs/pref_functional_browsertest.cc +++ b/chrome/browser/prefs/pref_functional_browsertest.cc @@ -54,7 +54,7 @@ class PrefsFunctionalTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) { ASSERT_TRUE(embedded_test_server()->Start()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir new_download_dir; ASSERT_TRUE(new_download_dir.CreateUniqueTempDir()); diff --git a/chrome/browser/prefs/pref_service_browsertest.cc b/chrome/browser/prefs/pref_service_browsertest.cc index f65bbb94b0f08b..ab2d5cd845d5a3 100644 --- a/chrome/browser/prefs/pref_service_browsertest.cc +++ b/chrome/browser/prefs/pref_service_browsertest.cc @@ -90,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(PreferenceServiceTest, Test) { JSONFileValueDeserializer deserializer(original_pref_file_); std::unique_ptr root; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; root = deserializer.Deserialize(NULL, NULL); } diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index db6093c63e2544..d67f928e3cc645 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -3231,7 +3231,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, HttpPost) { IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, AutosigninInPrerenderer) { // Set up a credential in the password store. { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; PasswordStoreFactory::GetInstance()->SetTestingFactory( current_browser()->profile(), password_manager::BuildPasswordStore< diff --git a/chrome/browser/printing/pwg_raster_converter_browsertest.cc b/chrome/browser/printing/pwg_raster_converter_browsertest.cc index 46d3253aeb69e1..f7c3ebf0be64c5 100644 --- a/chrome/browser/printing/pwg_raster_converter_browsertest.cc +++ b/chrome/browser/printing/pwg_raster_converter_browsertest.cc @@ -67,7 +67,7 @@ IN_PROC_BROWSER_TEST_F(PDFToPWGRasterBrowserTest, TestFailure) { } IN_PROC_BROWSER_TEST_F(PDFToPWGRasterBrowserTest, TestSuccess) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index a750b4d27bd3c2..a9afe2e280bbc9 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc @@ -344,7 +344,7 @@ class ProfileBrowserTest : public InProcessBrowserTest { // Test OnProfileCreate is called with is_new_profile set to true when // creating a new profile synchronously. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateNewProfileSynchronous) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -370,7 +370,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateNewProfileSynchronous) { // Test OnProfileCreate is called with is_new_profile set to false when // creating a profile synchronously with an existing prefs file. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileSynchronous) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); CreatePrefsFileInDirectory(temp_dir.GetPath()); @@ -392,7 +392,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileSynchronous) { // creating a new profile asynchronously. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_CreateNewProfileAsynchronous) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -427,7 +427,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, // creating a profile asynchronously with an existing prefs file. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_CreateOldProfileAsynchronous) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); CreatePrefsFileInDirectory(temp_dir.GetPath()); @@ -454,7 +454,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, // Flaky: http://crbug.com/393177 // Test that a README file is created for profiles that didn't have it. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_ProfileReadmeCreated) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -482,7 +482,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_ProfileReadmeCreated) { // Test that repeated setting of exit type is handled correctly. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, ExitType) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -578,7 +578,7 @@ void CompareURLRequestContexts( } // namespace IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, URLRequestContextIsolation) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -618,7 +618,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, URLRequestContextIsolation) { IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, OffTheRecordURLRequestContextIsolation) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -688,7 +688,7 @@ std::string GetExitTypePreferenceFromDisk(Profile* profile) { IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, WritesProfilesSynchronouslyOnEndSession) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -779,7 +779,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, // Verifies the cache directory supports multiple profiles when it's overriden // by group policy or command line switches. IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DiskCacheDirOverride) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; int size; const base::FilePath::StringPieceType profile_name = FILE_PATH_LITERAL("Profile 1"); diff --git a/chrome/browser/profiling_host/memlog_browsertest.cc b/chrome/browser/profiling_host/memlog_browsertest.cc index 45836860ed8fa4..7efbef3fbaf7d8 100644 --- a/chrome/browser/profiling_host/memlog_browsertest.cc +++ b/chrome/browser/profiling_host/memlog_browsertest.cc @@ -291,7 +291,7 @@ IN_PROC_BROWSER_TEST_P(MemlogBrowserTest, EndToEnd) { } // Create directory for storing dumps. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index b86b1f412908e1..328c523397ccf7 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc @@ -154,7 +154,7 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { // Does not work on ChromeOS. Profile* CreateSecondaryProfile(int profile_num) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ProfileManager* profile_manager = g_browser_process->profile_manager(); base::FilePath profile_path = profile_manager->user_data_dir(); profile_path = profile_path.AppendASCII( diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 7a9f755da711f1..2274b32ce65b4b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -1510,7 +1510,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, StartAndStop) { EXPECT_TRUE(csd_service->enabled()); // Add a new Profile. SBS should keep running. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); std::unique_ptr profile2(Profile::CreateProfile( temp_profile_dir_.GetPath(), nullptr, Profile::CREATE_MODE_SYNCHRONOUS)); @@ -1704,7 +1704,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceShutdownTest, // the profile will get destroyed in the normal browser shutdown process. ProfileManager* profile_manager = g_browser_process->profile_manager(); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(temp_profile_dir_.CreateUniqueTempDir()); } profile_manager->CreateProfileAsync( diff --git a/chrome/browser/service_process/service_process_control_browsertest.cc b/chrome/browser/service_process/service_process_control_browsertest.cc index 75269946251375..393b401f3b65b3 100644 --- a/chrome/browser/service_process/service_process_control_browsertest.cc +++ b/chrome/browser/service_process/service_process_control_browsertest.cc @@ -103,7 +103,7 @@ class ServiceProcessControlBrowserTest } void ProcessControlLaunched() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ProcessId service_pid; EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); EXPECT_NE(static_cast(0), service_pid); @@ -327,7 +327,7 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_ForceShutdown) { // Make sure we are connected to the service process. ASSERT_TRUE(ServiceProcessControl::GetInstance()->IsConnected()); base::ProcessId service_pid; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); EXPECT_NE(static_cast(0), service_pid); ForceServiceProcessShutdown(version_info::GetVersionNumber(), service_pid); @@ -341,7 +341,7 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_ForceShutdown) { #endif IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_CheckPid) { base::ProcessId service_pid; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(GetServiceProcessData(NULL, &service_pid)); // Launch the service process. LaunchServiceProcessControl(true); diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index e0ac6379dec67d..d978d54c870c2b 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -1448,7 +1448,7 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorageAfterTabReplace) { } IN_PROC_BROWSER_TEST_F(SessionRestoreTest, TabWithDownloadDoesNotGetRestored) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir download_directory; ASSERT_TRUE(download_directory.CreateUniqueTempDir()); ASSERT_TRUE(embedded_test_server()->Start()); diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc index 35c137238eed81..a00b4c63a7c1f8 100644 --- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc @@ -428,7 +428,7 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) { spellcheck::GetVersionedFileName("en-US", dict_dir); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; size_t actual = base::WriteFile( bdict_path, reinterpret_cast(kCorruptedBDICT), arraysize(kCorruptedBDICT)); @@ -464,7 +464,7 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) { content::RunAllTasksUntilIdle(); EXPECT_EQ(SpellcheckService::BDICT_CORRUPTED, SpellcheckService::GetStatusEvent()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (base::PathExists(bdict_path)) { ADD_FAILURE(); EXPECT_TRUE(base::DeleteFile(bdict_path, true)); diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 81d71298a1bd8f..08faffd283e6c0 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -1665,7 +1665,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestWithClientCert, TestWSSClientCert) { base::FilePath cert_path = net::GetTestCertsDirectory().Append( FILE_PATH_LITERAL("websocket_client_cert.p12")); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_TRUE(base::ReadFileToString(cert_path, &pkcs12_data)); } EXPECT_EQ(net::OK, @@ -1744,7 +1744,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { GURL url_non_dangerous = embedded_test_server()->GetURL("/title1.html"); GURL url_dangerous = https_server_expired_.GetURL("/downloads/dangerous/dangerous.exe"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir downloads_directory_; // Need empty temp dir to avoid having Chrome ask us for a new filename @@ -2775,7 +2775,7 @@ class SSLUIWorkerFetchTest protected: void WriteFile(const base::FilePath::StringType& filename, base::StringPiece contents) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_EQ(base::checked_cast(contents.size()), base::WriteFile(tmp_dir_.GetPath().Append(filename), contents.data(), contents.size())); @@ -6178,7 +6178,7 @@ class SymantecMessageSSLUITest : public CertVerifierBrowserTest { void SetUpCertVerifier(bool use_chrome_66_date) { net::CertVerifyResult verify_result; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; verify_result.verified_cert = net::CreateCertificateChainFromFile( net::GetTestCertsDirectory(), use_chrome_66_date ? "pre_june_2016.pem" : "post_june_2016.pem", diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index b933b6ff04df35..8f5f3731668c62 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -855,7 +855,7 @@ gfx::Image CreateFavicon(SkColor color) { } gfx::Image Create1xFaviconFromPNGFile(const std::string& path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; const char* kPNGExtension = ".png"; if (!base::EndsWith(path, kPNGExtension, base::CompareCase::INSENSITIVE_ASCII)) diff --git a/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc b/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc index ddf9c6f8d8b885..db35c11a4b9209 100644 --- a/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc @@ -34,7 +34,7 @@ namespace { // will avoid seeing any of those, and return iff Directory database files still // exist. bool FolderContainsFiles(const FilePath& folder) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (base::DirectoryExists(folder)) { return !FileEnumerator(folder, false, FileEnumerator::FILES).Next().empty(); } else { diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 13fa2e7bdd12a8..76454e38624006 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -84,7 +84,7 @@ void SyncExtensionHelper::SetupIfNecessary(SyncTest* test) { std::string SyncExtensionHelper::InstallExtension( Profile* profile, const std::string& name, Manifest::Type type) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; scoped_refptr extension = GetExtension(profile, name, type); if (!extension.get()) { NOTREACHED() << "Could not install extension " << name; diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 3ba85c257e9e7f..1a5977cd9b4b17 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -341,7 +341,7 @@ bool SyncTest::CreateGaiaAccount(const std::string& username, } bool SyncTest::CreateProfile(int index) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; tmp_profile_paths_[index] = new base::ScopedTempDir(); if (UsingExternalServers() && num_clients_ > 1) { // For multi profile UI signin, profile paths should be outside user data @@ -515,7 +515,7 @@ void SyncTest::DisableVerifier() { } bool SyncTest::SetupClients() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (num_clients_ <= 0) LOG(FATAL) << "num_clients_ incorrectly initialized."; if (!profiles_.empty() || !browsers_.empty() || !clients_.empty()) @@ -657,7 +657,7 @@ void SyncTest::InitializeInvalidations(int index) { } bool SyncTest::SetupSync() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Create sync profiles and clients if they haven't already been created. if (profiles_.empty()) { if (!SetupClients()) { diff --git a/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc b/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc index e717f9877a0026..0b95fd6704820e 100644 --- a/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc +++ b/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc @@ -297,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(TabContentsTagTest, NavigateToPageNoFavicon) { PathService::Get(chrome::DIR_TEST_DATA, &test_dir); std::string favicon_string; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ReadFileToString( test_dir.AppendASCII("favicon").AppendASCII("icon.png"), &favicon_string); diff --git a/chrome/browser/themes/theme_service_browsertest.cc b/chrome/browser/themes/theme_service_browsertest.cc index b4d5222b65d272..1f80334b0be6a9 100644 --- a/chrome/browser/themes/theme_service_browsertest.cc +++ b/chrome/browser/themes/theme_service_browsertest.cc @@ -76,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(ThemeServiceBrowserTest, PRE_ThemeDataPackInvalid) { // Add a vestigial .pak file that should be removed when the new one is // created. // TODO(estade): remove when vestigial .pak file deletion is removed. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_EQ( 1, base::WriteFile(profile->GetPrefs() ->GetFilePath(prefs::kCurrentThemePackFilename) @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(ThemeServiceBrowserTest, ThemeDataPackInvalid) { ->GetPrefs() ->GetFilePath(prefs::kCurrentThemePackFilename) .AppendASCII("Cached Theme Material Design.pak"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; EXPECT_FALSE(base::PathExists(old_path)) << "File not deleted: " << old_path.value(); } diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index d7d6ec01c4d919..c25738d4994f23 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc @@ -172,7 +172,7 @@ class BrowserFocusTest : public InProcessBrowserTest { class TestInterstitialPage : public content::InterstitialPageDelegate { public: explicit TestInterstitialPage(WebContents* tab) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath file_path; bool success = PathService::Get(chrome::DIR_TEST_DATA, &file_path); EXPECT_TRUE(success); diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm index 62479d2cb396ed..6b1d185a528c67 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm @@ -19,7 +19,7 @@ scoped_refptr LoadInstallPromptExtension( const char* extension_dir_name, const char* manifest_file) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; scoped_refptr extension; base::FilePath path; @@ -51,7 +51,7 @@ } gfx::Image LoadInstallPromptIcon() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions") diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index fd0de4abb38bfb..ddc9e3e37f0dbb 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -434,7 +434,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) { base::FilePath().AppendASCII("LongFind.txt")); std::string query; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ReadFileToString(path, &query); } EXPECT_EQ(1, FindInPage16(web_contents, base::UTF8ToUTF16(query), @@ -498,7 +498,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) { std::string query; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ReadFileToString(path, &query); } EXPECT_EQ(1, FindInPage16(web_contents, base::UTF8ToUTF16(query), diff --git a/chrome/browser/ui/global_error/global_error_browsertest.cc b/chrome/browser/ui/global_error/global_error_browsertest.cc index 980d5249d74c23..66278e3e99b066 100644 --- a/chrome/browser/ui/global_error/global_error_browsertest.cc +++ b/chrome/browser/ui/global_error/global_error_browsertest.cc @@ -148,7 +148,7 @@ void GlobalErrorBubbleTest::ShowDialog(const std::string& name) { // To trigger a bubble alert (rather than a menu alert), the extension must // come from the webstore, which needs the update to come from a signed crx. const char kExtensionWithUpdateUrl[] = "akjooamlhcgeopfifcmlggaebeocgokj"; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; base::FilePath crx_path = PackCRXInTempDir( &temp_dir, "update_from_webstore", "update_from_webstore.pem"); diff --git a/chrome/browser/ui/search/local_ntp_browsertest.cc b/chrome/browser/ui/search/local_ntp_browsertest.cc index c0b7dfe43d7f6a..5dc7fa8bcf3b21 100644 --- a/chrome/browser/ui/search/local_ntp_browsertest.cc +++ b/chrome/browser/ui/search/local_ntp_browsertest.cc @@ -89,7 +89,7 @@ content::WebContents* OpenNewTab(Browser* browser, const GURL& url) { // Switches the browser language to French, and returns true iff successful. bool SwitchToFrench() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // Make sure the default language is not French. std::string default_locale = g_browser_process->GetApplicationLocale(); EXPECT_NE("fr", default_locale); @@ -149,7 +149,7 @@ class LocalNTPTest : public InProcessBrowserTest { void SetUserSelectedDefaultSearchProvider(const std::string& base_url, const std::string& ntp_url) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; TemplateURLData data; data.SetShortName(base::UTF8ToUTF16(base_url)); data.SetKeyword(base::UTF8ToUTF16(base_url)); diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 5df7fca00c4a07..8b06e999b2098a 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc @@ -494,7 +494,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) { Profile* other_profile = nullptr; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; other_profile = profile_manager->GetProfile(dest_path); } ASSERT_TRUE(other_profile); @@ -682,7 +682,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, base::FilePath dest_path4 = profile_manager->user_data_dir().Append( FILE_PATH_LITERAL("New Profile 4")); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; Profile* profile_home1 = profile_manager->GetProfile(dest_path1); ASSERT_TRUE(profile_home1); Profile* profile_home2 = profile_manager->GetProfile(dest_path2); @@ -795,7 +795,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) { Profile* profile_last = nullptr; Profile* profile_urls = nullptr; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; profile_home = profile_manager->GetProfile(dest_path1); ASSERT_TRUE(profile_home); profile_last = profile_manager->GetProfile(dest_path2); @@ -1162,7 +1162,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, MAYBE_WelcomePages) { Profile* profile1 = nullptr; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; profile1 = Profile::CreateProfile( dest_path.Append(FILE_PATH_LITERAL("New Profile 1")), nullptr, Profile::CreateMode::CREATE_MODE_SYNCHRONOUS); diff --git a/chrome/browser/ui/startup/startup_browser_creator_corrupt_profiles_browsertest_win.cc b/chrome/browser/ui/startup/startup_browser_creator_corrupt_profiles_browsertest_win.cc index a7af7ad8902cea..171bc72ec84079 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_corrupt_profiles_browsertest_win.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_corrupt_profiles_browsertest_win.cc @@ -273,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorCorruptProfileTest, CloseBrowsersSynchronouslyForProfileBasePath("Profile 1"); CreateAndSwitchToProfile("Profile 2"); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::CreateDirectory(ProfileManager::GetGuestProfilePath())); ASSERT_TRUE(base::CreateDirectory(ProfileManager::GetSystemProfilePath())); } @@ -303,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorCorruptProfileTest, // Create the guest profile path, but not the system profile one. This will // make it impossible to create the system profile once the permissions are // locked down during setup. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::CreateDirectory(ProfileManager::GetGuestProfilePath())); } @@ -404,7 +404,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorCorruptProfileTest, // manager instead. IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorCorruptProfileTest, PRE_DeletedProfileFallbackToUserManager) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::CreateDirectory(ProfileManager::GetGuestProfilePath())); ASSERT_TRUE(base::CreateDirectory(ProfileManager::GetSystemProfilePath())); } diff --git a/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc b/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc index d664dc8268a8ba..ee39eeb81472a6 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_interactive_uitest.cc @@ -29,7 +29,7 @@ typedef InProcessBrowserTest StartupBrowserCreatorTest; // And this test is useless without that functionality. #if !defined(OS_CHROMEOS) && !defined(OS_MACOSX) IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, LastUsedProfileActivated) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ProfileManager* profile_manager = g_browser_process->profile_manager(); // Create 4 profiles, they will be scheduled for destruction when the last diff --git a/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc b/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc index 2da167c3f88027..09ac1dd30b5c85 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_triggered_reset_browsertest_win.cc @@ -244,7 +244,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTriggeredResetTest, profile_manager->user_data_dir().AppendASCII("test_profile"); Profile* other_profile = nullptr; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; other_profile = Profile::CreateProfile(path, nullptr, Profile::CREATE_MODE_SYNCHRONOUS); } diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc index b3e6c3a2f3fbfd..d3cb25db0b96e6 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc @@ -43,7 +43,7 @@ namespace { Profile* CreateTestingProfile(const std::string& profile_name) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ProfileManager* profile_manager = g_browser_process->profile_manager(); size_t starting_number_of_profiles = profile_manager->GetNumberOfProfiles(); @@ -62,7 +62,7 @@ Profile* CreateTestingProfile(const std::string& profile_name) { } Profile* CreateProfileOutsideUserDataDir() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &path)) NOTREACHED() << "Could not create directory at " << path.MaybeAsASCII(); @@ -77,7 +77,7 @@ Profile* CreateProfileOutsideUserDataDir() { // Set up the profiles to enable Lock. Takes as parameter a profile that will be // signed in, and also creates a supervised user (necessary for lock). void SetupProfilesForLock(Profile* signed_in) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; const char signed_in_email[] = "me@google.com"; // Set up the |signed_in| profile. diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc index 6114dededdc85b..56ce9b2234c1c3 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc @@ -299,7 +299,7 @@ void NetInternalsTest::MessageHandler::CloseIncognitoBrowser( void NetInternalsTest::MessageHandler::GetNetLogFileContents( const base::ListValue* list_value) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::unique_ptr state = base::MakeUnique(); @@ -343,7 +343,7 @@ void NetInternalsTest::MessageHandler::EnableDataReductionProxy( void NetInternalsTest::MessageHandler::OnFinishedWritingNetLog( std::unique_ptr state) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::string log_contents; ASSERT_TRUE(base::ReadFileToString(state->log_path, &log_contents)); diff --git a/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chrome/browser/ui/webui/policy_ui_browsertest.cc index 48a7664a3e8985..9fff3ea6905b8c 100644 --- a/chrome/browser/ui/webui/policy_ui_browsertest.cc +++ b/chrome/browser/ui/webui/policy_ui_browsertest.cc @@ -274,7 +274,7 @@ void PolicyUITest::VerifyExportingPolicies( base::TaskScheduler::GetInstance()->FlushForTesting(); // Open the created file. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::string file_contents; EXPECT_TRUE( base::ReadFileToString(export_policies_test_file_path, &file_contents)); @@ -478,7 +478,7 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, SendPolicyValues) { IN_PROC_BROWSER_TEST_F(PolicyUITest, ExtensionLoadAndSendPolicy) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIPolicyURL)); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir_; ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); diff --git a/chrome/browser/ui/webui/test_files_request_filter.cc b/chrome/browser/ui/webui/test_files_request_filter.cc index 2d5291221d490a..b9604f3e5a764a 100644 --- a/chrome/browser/ui/webui/test_files_request_filter.cc +++ b/chrome/browser/ui/webui/test_files_request_filter.cc @@ -17,7 +17,7 @@ namespace { bool HandleTestFileRequestCallback( const std::string& path, const content::WebUIDataSource::GotDataCallback& callback) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; std::vector url_substr = base::SplitString(path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); if (url_substr.size() != 2 || url_substr[0] != "test") diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index 083a6c23d48dea..90c309166bd680 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -300,7 +300,7 @@ void InProcessBrowserTest::SetUpDefaultCommandLine( } bool InProcessBrowserTest::RunAccessibilityChecks(std::string* error_message) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!browser()) { *error_message = "browser is NULL"; return false; diff --git a/chrome/test/base/javascript_browser_test.cc b/chrome/test/base/javascript_browser_test.cc index cea264e168edf6..6b57d9a834fa95 100644 --- a/chrome/test/base/javascript_browser_test.cc +++ b/chrome/test/base/javascript_browser_test.cc @@ -78,7 +78,7 @@ void JavaScriptBrowserTest::SetUpOnMainThread() { // calls. void JavaScriptBrowserTest::BuildJavascriptLibraries( std::vector* libraries) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(libraries != NULL); std::vector::iterator user_libraries_iterator; for (user_libraries_iterator = user_libraries_.begin(); diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index f1c51fc6e5a36b..9bd293ec59479f 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -394,7 +394,7 @@ TestingProfile::TestingProfile( } void TestingProfile::CreateTempProfileDir() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!temp_dir_.CreateUniqueTempDir()) { LOG(ERROR) << "Failed to create unique temporary directory."; @@ -422,7 +422,7 @@ void TestingProfile::CreateTempProfileDir() { } void TestingProfile::Init() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // If threads have been initialized, we should be on the UI thread. DCHECK(!content::BrowserThread::IsThreadInitialized( content::BrowserThread::UI) || @@ -575,7 +575,7 @@ TestingProfile::~TestingProfile() { content::RunAllPendingInMessageLoop(BrowserThread::IO); } - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ignore_result(temp_dir_.Delete()); } diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 0904f08010bf09..40fbe586925360 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -278,7 +278,7 @@ void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, base::FilePath GetTestFilePath(const base::FilePath& dir, const base::FilePath& file) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); return path.Append(dir).Append(file); @@ -289,7 +289,7 @@ GURL GetTestUrl(const base::FilePath& dir, const base::FilePath& file) { } bool GetRelativeBuildDirectory(base::FilePath* build_dir) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // This function is used to find the build directory so TestServer can serve // built files (nexes, etc). TestServer expects a path relative to the source // root. @@ -362,7 +362,7 @@ int FindInPage(WebContents* tab, } void DownloadURL(Browser* browser, const GURL& download_url) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir downloads_directory; ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); browser->profile()->GetPrefs()->SetFilePath(prefs::kDownloadDefaultDirectory, diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc index 755e38d8b5ee24..5c6721c13023b2 100644 --- a/chrome/test/base/web_ui_browser_test.cc +++ b/chrome/test/base/web_ui_browser_test.cc @@ -494,7 +494,7 @@ void WebUIBrowserTest::SetupHandlers() { GURL WebUIBrowserTest::WebUITestDataPathToURL( const base::FilePath::StringType& path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath dir_test_data; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); diff --git a/chrome/test/media_router/media_router_integration_browsertest.cc b/chrome/test/media_router/media_router_integration_browsertest.cc index 1dc5e122938331..a6c9044561569d 100644 --- a/chrome/test/media_router/media_router_integration_browsertest.cc +++ b/chrome/test/media_router/media_router_integration_browsertest.cc @@ -393,7 +393,7 @@ void MediaRouterIntegrationBrowserTest::SetTestData( std::unique_ptr value; { // crbug.com/724573 - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; value = deserializer.Deserialize(&error_code, &error_message); } CHECK(value.get()) << "Deserialize failed: " << error_message; @@ -431,7 +431,7 @@ base::FilePath MediaRouterIntegrationBrowserTest::GetResourceFile( base_dir.Append(kResourcePath).Append(relative_path); { // crbug.com/724573 - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; CHECK(PathExists(full_path)); } return full_path; diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index 9b32eac92e6e23..a1813322306a34 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc @@ -1272,7 +1272,7 @@ class PackagedAppTest : public ExtensionBrowserTest { void LaunchTestingApp(const std::string& extension_dirname) { base::FilePath data_dir; { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &data_dir)); } base::FilePath app_dir = data_dir.AppendASCII("ppapi") diff --git a/chrome/test/ppapi/ppapi_filechooser_browsertest.cc b/chrome/test/ppapi/ppapi_filechooser_browsertest.cc index e2770eafc20038..76863c22f3ad16 100644 --- a/chrome/test/ppapi/ppapi_filechooser_browsertest.cc +++ b/chrome/test/ppapi/ppapi_filechooser_browsertest.cc @@ -274,7 +274,7 @@ class PPAPIFileChooserTestWithSBService : public PPAPIFileChooserTest { IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_Open_Success) { const char kContents[] = "Hello from browser"; - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -299,7 +299,7 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_Open_Cancel) { } IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_SaveAs_Success) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath suggested_filename = temp_dir.GetPath().AppendASCII("foo"); @@ -316,7 +316,7 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_SaveAs_Success) { IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_SaveAs_SafeDefaultName) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath suggested_filename = temp_dir.GetPath().AppendASCII("foo"); @@ -339,7 +339,7 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_SaveAs_UnsafeDefaultName) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath suggested_filename = temp_dir.GetPath().AppendASCII("foo"); @@ -374,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_SaveAs_Cancel) { // file is created. This MOTW prevents the file being opened without due // security warnings if the file is executable. IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_Quarantine) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath suggested_filename = temp_dir.GetPath().AppendASCII("foo"); @@ -401,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_Quarantine) { IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTestWithSBService, FileChooser_SaveAs_DangerousExecutable_Allowed) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; safe_browsing_test_configuration_.default_result = safe_browsing::DownloadCheckResult::DANGEROUS; safe_browsing_test_configuration_.result_map.insert( @@ -458,7 +458,7 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTestWithSBService, IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTestWithSBService, FileChooser_Open_NotBlockedBySafeBrowsing) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; const char kContents[] = "Hello from browser"; base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); diff --git a/chrome/test/remoting/qunit_browser_test_runner.cc b/chrome/test/remoting/qunit_browser_test_runner.cc index b84a30a198d5b4..6f1ccda2f55304 100644 --- a/chrome/test/remoting/qunit_browser_test_runner.cc +++ b/chrome/test/remoting/qunit_browser_test_runner.cc @@ -41,7 +41,7 @@ void QUnitBrowserTestRunner::QUnitStart(content::WebContents* web_contents) { void QUnitBrowserTestRunner::RunTest(const base::FilePath& file) { { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(PathExists(file)) << "Error: The QUnit test suite <" << file.value() << "> does not exist."; } diff --git a/components/autofill/core/browser/data_driven_test.cc b/components/autofill/core/browser/data_driven_test.cc index c83fb1f93065b7..ec40bd721e1d7b 100644 --- a/components/autofill/core/browser/data_driven_test.cc +++ b/components/autofill/core/browser/data_driven_test.cc @@ -36,7 +36,7 @@ void DataDrivenTest::RunDataDrivenTest( const base::FilePath& input_directory, const base::FilePath& output_directory, const base::FilePath::StringType& file_name_pattern) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::DirectoryExists(input_directory)); ASSERT_TRUE(base::DirectoryExists(output_directory)); base::FileEnumerator input_files(input_directory, @@ -55,7 +55,7 @@ void DataDrivenTest::RunOneDataDrivenTest( const base::FilePath& test_file_name, const base::FilePath& output_directory, DataDrivenTestStatus expected_status) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // iOS doesn't get rid of removed test files. TODO(estade): remove this after // all iOS bots are clobbered. if (test_file_name.BaseName().value() == FILE_PATH_LITERAL("multimerge.in")) diff --git a/components/subresource_filter/core/common/test_ruleset_creator.cc b/components/subresource_filter/core/common/test_ruleset_creator.cc index ba02d32f0481dd..f6c22260464fad 100644 --- a/components/subresource_filter/core/common/test_ruleset_creator.cc +++ b/components/subresource_filter/core/common/test_ruleset_creator.cc @@ -29,7 +29,7 @@ static_assert(CHAR_BIT == 8, "Assumed char was 8 bits."); void WriteRulesetContents(const std::vector& contents, base::FilePath path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; int ruleset_size_as_int = base::checked_cast(contents.size()); int num_bytes_written = base::WriteFile(path, reinterpret_cast(contents.data()), @@ -70,7 +70,7 @@ TestRuleset::~TestRuleset() = default; // static base::File TestRuleset::Open(const TestRuleset& ruleset) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::File file; file.Initialize(ruleset.path, base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_SHARE_DELETE); @@ -115,7 +115,7 @@ TestRulesetCreator::TestRulesetCreator() : scoped_temp_dir_(base::MakeUnique()) {} TestRulesetCreator::~TestRulesetCreator() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; scoped_temp_dir_.reset(); } @@ -172,7 +172,7 @@ void TestRulesetCreator::CreateUnindexedRulesetWithRules( void TestRulesetCreator::GetUniqueTemporaryPath(base::FilePath* path) { DCHECK(path); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(scoped_temp_dir_->IsValid() || scoped_temp_dir_->CreateUniqueTempDir()); *path = scoped_temp_dir_->GetPath().AppendASCII( diff --git a/content/shell/browser/layout_test/layout_test_browser_main.cc b/content/shell/browser/layout_test/layout_test_browser_main.cc index e1a8970d1d6333..781f88e3171037 100644 --- a/content/shell/browser/layout_test/layout_test_browser_main.cc +++ b/content/shell/browser/layout_test/layout_test_browser_main.cc @@ -75,7 +75,7 @@ int RunTests(const std::unique_ptr& main_runner) { content::BlinkTestController test_controller; { // We're outside of the message loop here, and this is a test. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath temp_path; base::GetTempDir(&temp_path); test_controller.SetTempPath(temp_path); diff --git a/content/shell/browser/layout_test/layout_test_message_filter.cc b/content/shell/browser/layout_test/layout_test_message_filter.cc index 558994a3f45b2b..969bc250fda7df 100644 --- a/content/shell/browser/layout_test/layout_test_message_filter.cc +++ b/content/shell/browser/layout_test/layout_test_message_filter.cc @@ -92,7 +92,7 @@ bool LayoutTestMessageFilter::OnMessageReceived(const IPC::Message& message) { void LayoutTestMessageFilter::OnReadFileToString( const base::FilePath& local_file, std::string* contents) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::ReadFileToString(local_file, contents); } diff --git a/content/shell/browser/layout_test/test_info_extractor.cc b/content/shell/browser/layout_test/test_info_extractor.cc index de84333b4c12c8..beedfeb6b5fe5f 100644 --- a/content/shell/browser/layout_test/test_info_extractor.cc +++ b/content/shell/browser/layout_test/test_info_extractor.cc @@ -72,7 +72,7 @@ std::unique_ptr GetTestInfoFromLayoutTestName( test_url = GURL(path_or_url); if (!(test_url.is_valid() && test_url.has_scheme())) { // We're outside of the message loop here, and this is a test. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; #if defined(OS_WIN) base::FilePath::StringType wide_path_or_url = base::SysNativeMBToWide(path_or_url); @@ -94,7 +94,7 @@ std::unique_ptr GetTestInfoFromLayoutTestName( base::FilePath current_working_directory; // We're outside of the message loop here, and this is a test. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (net::FileURLToFilePath(test_url, &local_path)) current_working_directory = local_path.DirName(); else diff --git a/crypto/scoped_test_nss_db.cc b/crypto/scoped_test_nss_db.cc index 03470c130371b0..e2d4eb52ebb56f 100644 --- a/crypto/scoped_test_nss_db.cc +++ b/crypto/scoped_test_nss_db.cc @@ -18,7 +18,7 @@ ScopedTestNSSDB::ScopedTestNSSDB() { // NSS is allowed to do IO on the current thread since dispatching // to a dedicated thread would still have the affect of blocking // the current thread, due to NSS's internal locking requirements - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!temp_dir_.CreateUniqueTempDir()) return; @@ -47,7 +47,7 @@ ScopedTestNSSDB::~ScopedTestNSSDB() { // NSS is allowed to do IO on the current thread since dispatching // to a dedicated thread would still have the affect of blocking // the current thread, due to NSS's internal locking requirements - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (slot_) { SECStatus status = SECMOD_CloseUserDB(slot_.get()); diff --git a/extensions/browser/api/printer_provider/printer_provider_apitest.cc b/extensions/browser/api/printer_provider/printer_provider_apitest.cc index cb5eff6cbbc23e..03beac06e839ed 100644 --- a/extensions/browser/api/printer_provider/printer_provider_apitest.cc +++ b/extensions/browser/api/printer_provider/printer_provider_apitest.cc @@ -101,7 +101,7 @@ class PrinterProviderApiTest : public ShellApiTest { PrinterProviderApiTest() {} ~PrinterProviderApiTest() override { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ignore_result(data_dir_.Delete()); } @@ -244,7 +244,7 @@ class PrinterProviderApiTest : public ShellApiTest { break; case PRINT_REQUEST_DATA_TYPE_FILE_DELETED: { ASSERT_TRUE(StartPrintRequestUsingFileInfo(extension_id, callback)); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(data_dir_.Delete()); break; } @@ -355,7 +355,7 @@ class PrinterProviderApiTest : public ShellApiTest { int size, base::FilePath* path, base::File::Info* file_info) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; if (!data_dir_.IsValid() && !data_dir_.CreateUniqueTempDir()) return false; diff --git a/extensions/browser/guest_view/app_view/app_view_apitest.cc b/extensions/browser/guest_view/app_view/app_view_apitest.cc index 80d4bea1efa499..b6a87bf948bbe7 100644 --- a/extensions/browser/guest_view/app_view/app_view_apitest.cc +++ b/extensions/browser/guest_view/app_view/app_view_apitest.cc @@ -114,7 +114,7 @@ class AppViewTest : public AppShellTest, } const Extension* LoadApp(const std::string& app_location) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; PathService::Get(DIR_TEST_DATA, &test_data_dir); test_data_dir = test_data_dir.AppendASCII(app_location.c_str()); diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc index abbdd6a374dec9..6363ff22b55617 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.cc +++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc @@ -140,7 +140,7 @@ WebViewAPITest::WebViewAPITest() { } void WebViewAPITest::LaunchApp(const std::string& app_location) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; PathService::Get(DIR_TEST_DATA, &test_data_dir); test_data_dir = test_data_dir.AppendASCII(app_location.c_str()); @@ -196,7 +196,7 @@ void WebViewAPITest::StartTestServer(const std::string& app_location) { test_config_.SetInteger(kTestServerPort, embedded_test_server()->port()); - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; PathService::Get(DIR_TEST_DATA, &test_data_dir); test_data_dir = test_data_dir.AppendASCII(app_location.c_str()); diff --git a/extensions/shell/test/shell_apitest.cc b/extensions/shell/test/shell_apitest.cc index a52a1afc3b6667..156a34b057560f 100644 --- a/extensions/shell/test/shell_apitest.cc +++ b/extensions/shell/test/shell_apitest.cc @@ -23,7 +23,7 @@ ShellApiTest::~ShellApiTest() { } const Extension* ShellApiTest::LoadExtension(const std::string& extension_dir) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); base::FilePath extension_path = test_data_dir.AppendASCII(extension_dir); @@ -32,7 +32,7 @@ const Extension* ShellApiTest::LoadExtension(const std::string& extension_dir) { } const Extension* ShellApiTest::LoadApp(const std::string& app_dir) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath test_data_dir; PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir); base::FilePath app_path = test_data_dir.AppendASCII(app_dir); diff --git a/net/test/cert_test_util.cc b/net/test/cert_test_util.cc index e3150954bbd72f..0295d7b8963a45 100644 --- a/net/test/cert_test_util.cc +++ b/net/test/cert_test_util.cc @@ -64,7 +64,7 @@ scoped_refptr CreateCertificateChainFromFile( scoped_refptr ImportCertFromFile( const base::FilePath& certs_dir, const std::string& cert_file) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath cert_path = certs_dir.AppendASCII(cert_file); std::string cert_data; if (!base::ReadFileToString(cert_path, &cert_data)) diff --git a/net/test/embedded_test_server/request_handler_util.cc b/net/test/embedded_test_server/request_handler_util.cc index eb46ac740a9684..e84904b6a26b3a 100644 --- a/net/test/embedded_test_server/request_handler_util.cc +++ b/net/test/embedded_test_server/request_handler_util.cc @@ -124,7 +124,7 @@ std::unique_ptr HandleFileRequest( const HttpRequest& request) { // This is a test-only server. Ignore I/O thread restrictions. // TODO(svaldez): Figure out why thread is I/O restricted in the first place. - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; // A proxy request will have an absolute path. Simulate the proxy by stripping // the scheme, host, and port. diff --git a/net/test/spawned_test_server/remote_test_server_config.cc b/net/test/spawned_test_server/remote_test_server_config.cc index 1e561881a6baaf..38ea63e63789a3 100644 --- a/net/test/spawned_test_server/remote_test_server_config.cc +++ b/net/test/spawned_test_server/remote_test_server_config.cc @@ -43,7 +43,7 @@ RemoteTestServerConfig& RemoteTestServerConfig::operator=( const RemoteTestServerConfig&) = default; RemoteTestServerConfig RemoteTestServerConfig::Load() { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; RemoteTestServerConfig result; diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc index d0fb20b8a4106f..8191bfb0468521 100644 --- a/net/url_request/test_url_fetcher_factory.cc +++ b/net/url_request/test_url_fetcher_factory.cc @@ -240,7 +240,7 @@ void TestURLFetcher::Start() { // If the response should go into a file, write it out now. if (fake_status_.is_success() && fake_response_code_ == net::HTTP_OK && write_response_file_ && !fake_response_file_path_.empty()) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; size_t written_bytes = base::WriteFile(fake_response_file_path_, fake_response_string_.c_str(), fake_response_string_.size()); diff --git a/sql/test/test_helpers.cc b/sql/test/test_helpers.cc index 20e2316ba6f4f6..d5ed71c6858709 100644 --- a/sql/test/test_helpers.cc +++ b/sql/test/test_helpers.cc @@ -101,7 +101,7 @@ bool CorruptSizeInHeader(const base::FilePath& db_path) { } bool CorruptSizeInHeaderWithLock(const base::FilePath& db_path) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; sql::Connection db; if (!db.Open(db_path)) return false; diff --git a/storage/browser/blob/blob_transport_strategy_unittest.cc b/storage/browser/blob/blob_transport_strategy_unittest.cc index 2440d428df14f9..be4e07bd8f4e9d 100644 --- a/storage/browser/blob/blob_transport_strategy_unittest.cc +++ b/storage/browser/blob/blob_transport_strategy_unittest.cc @@ -365,7 +365,7 @@ TEST_F(BlobTransportStrategyTest, Files_WriteFailed) { FileInfoVector files(1); { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; ASSERT_TRUE(base::CreateTemporaryFileInDir(data_dir_.GetPath(), &path)); files[0].file = @@ -409,7 +409,7 @@ TEST_F(BlobTransportStrategyTest, Files_ValidBytesOneElement) { 1 + data.size() / kTestBlobStorageMaxFileSizeBytes; FileInfoVector files(expected_file_count); for (size_t i = 0; i < expected_file_count; ++i) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; ASSERT_TRUE(base::CreateTemporaryFileInDir(data_dir_.GetPath(), &path)); files[i].file = @@ -472,7 +472,7 @@ TEST_F(BlobTransportStrategyTest, Files_ValidBytesMultipleElements) { 1 + 4 * data.size() / kTestBlobStorageMaxFileSizeBytes; FileInfoVector files(expected_file_count); for (size_t i = 0; i < expected_file_count; ++i) { - base::ThreadRestrictions::ScopedAllowIO allow_io; + base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath path; ASSERT_TRUE(base::CreateTemporaryFileInDir(data_dir_.GetPath(), &path)); files[i].file =