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

Unified Diff: chrome/browser/media_galleries/media_file_system_registry_unittest.cc

Issue 24269007: Media Galleries API: Fix MediaGalleriesPreferences finders race. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/media_galleries/media_file_system_registry_unittest.cc
diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
index 559a94b44ed57b82e6a86bf812cf699bc2c28480..0106b4c695367fbacab243bcf6ff20353cdc2ad7 100644
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
@@ -474,7 +474,12 @@ ProfileState::~ProfileState() {
}
MediaGalleriesPreferences* ProfileState::GetMediaGalleriesPrefs() {
- return MediaGalleriesPreferencesFactory::GetForProfile(profile_.get());
+ MediaGalleriesPreferences* prefs =
+ MediaGalleriesPreferencesFactory::GetForProfile(profile_.get());
+ base::RunLoop loop;
+ prefs->EnsureInitialized(loop.QuitClosure());
+ loop.Run();
+ return prefs;
}
void ProfileState::CheckGalleries(
@@ -612,7 +617,11 @@ ProfileState* MediaFileSystemRegistryTest::GetProfileState(size_t i) {
MediaGalleriesPreferences* MediaFileSystemRegistryTest::GetPreferences(
Profile* profile) {
- return registry()->GetPreferences(profile);
+ MediaGalleriesPreferences* prefs = registry()->GetPreferences(profile);
+ base::RunLoop loop;
+ prefs->EnsureInitialized(loop.QuitClosure());
+ loop.Run();
+ return prefs;
}
std::string MediaFileSystemRegistryTest::AddUserGallery(

Powered by Google App Engine
This is Rietveld 408576698