Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8582)

Unified Diff: chrome/browser/ui/startup/startup_browser_creator_browsertest.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 16b3334eb3f4ebf21ad0b24b455c893b30fdb673..b1376277d0f994612eeb2e6764a4dafc6e48c7ad 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -13,6 +13,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/histogram_tester.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -449,7 +450,11 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
base::FilePath dest_path = profile_manager->user_data_dir();
dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile 1"));
- Profile* other_profile = profile_manager->GetProfile(dest_path);
+ Profile* other_profile = nullptr;
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ other_profile = profile_manager->GetProfile(dest_path);
+ }
ASSERT_TRUE(other_profile);
// Use a couple arbitrary URLs.
@@ -635,6 +640,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;
Profile* profile_home1 = profile_manager->GetProfile(dest_path1);
ASSERT_TRUE(profile_home1);
Profile* profile_home2 = profile_manager->GetProfile(dest_path2);
@@ -743,12 +749,18 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
base::FilePath dest_path3 = profile_manager->user_data_dir().Append(
FILE_PATH_LITERAL("New Profile 3"));
- Profile* profile_home = profile_manager->GetProfile(dest_path1);
- ASSERT_TRUE(profile_home);
- Profile* profile_last = profile_manager->GetProfile(dest_path2);
- ASSERT_TRUE(profile_last);
- Profile* profile_urls = profile_manager->GetProfile(dest_path3);
- ASSERT_TRUE(profile_urls);
+ Profile* profile_home = nullptr;
+ Profile* profile_last = nullptr;
+ Profile* profile_urls = nullptr;
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ profile_home = profile_manager->GetProfile(dest_path1);
+ ASSERT_TRUE(profile_home);
+ profile_last = profile_manager->GetProfile(dest_path2);
+ ASSERT_TRUE(profile_last);
+ profile_urls = profile_manager->GetProfile(dest_path3);
+ ASSERT_TRUE(profile_urls);
+ }
// Set the profiles to open the home page, last visited pages or URLs.
SessionStartupPref pref_home(SessionStartupPref::DEFAULT);
@@ -1067,9 +1079,13 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorFirstRunTest, MAYBE_WelcomePages) {
// Open the two profiles.
base::FilePath dest_path = profile_manager->user_data_dir();
- Profile* profile1 = Profile::CreateProfile(
- dest_path.Append(FILE_PATH_LITERAL("New Profile 1")), nullptr,
- Profile::CreateMode::CREATE_MODE_SYNCHRONOUS);
+ Profile* profile1 = nullptr;
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ profile1 = Profile::CreateProfile(
+ dest_path.Append(FILE_PATH_LITERAL("New Profile 1")), nullptr,
+ Profile::CreateMode::CREATE_MODE_SYNCHRONOUS);
+ }
ASSERT_TRUE(profile1);
profile_manager->RegisterTestingProfile(profile1, true, false);

Powered by Google App Engine
This is Rietveld 408576698