Index: chrome/browser/ui/webui/bidi_checker_web_ui_test.cc |
diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc |
index 888d3653871877846e461bec3cdd136cf4f79d0b..2379370811dfb8ab07cd1fd30d8a94b995e11efc 100644 |
--- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc |
+++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc |
@@ -7,6 +7,7 @@ |
#include "base/base_paths.h" |
#include "base/i18n/rtl.h" |
#include "base/path_service.h" |
+#include "base/synchronization/waitable_event.h" |
#include "base/utf_string_conversions.h" |
#include "base/values.h" |
#include "chrome/browser/autofill/autofill_common_test.h" |
@@ -20,6 +21,7 @@ |
#include "chrome/browser/ui/browser.h" |
#include "chrome/common/url_constants.h" |
#include "chrome/test/base/ui_test_utils.h" |
+#include "content/public/browser/browser_thread.h" |
#include "ui/base/resource/resource_bundle.h" |
#if defined(TOOLKIT_GTK) |
@@ -69,6 +71,16 @@ void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage( |
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(page_url, true); |
} |
+// static |
+void WebUIBidiCheckerBrowserTestRTL::SetUpOnIOThread( |
+ base::WaitableEvent* event) { |
+ base::ThreadRestrictions::SetIOAllowed(true); |
+ ASSERT_FALSE( |
+ ResourceBundle::GetSharedInstance().ReloadLocaleResources("he").empty()); |
+ base::ThreadRestrictions::SetIOAllowed(false); |
tony
2012/06/13 16:38:15
Nit: Can you use ScopedAllowIO here? You can put
Sheridan Rawlins
2012/06/13 20:10:34
When I do, I hit the pre-submit:
"New code should
|
+ event->Signal(); |
+} |
+ |
void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() { |
WebUIBidiCheckerBrowserTest::SetUpOnMainThread(); |
FilePath pak_path; |
@@ -79,8 +91,16 @@ void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() { |
pak_path = pak_path.AppendASCII("fake-bidi"); |
pak_path = pak_path.ReplaceExtension(FILE_PATH_LITERAL("pak")); |
ResourceBundle::GetSharedInstance().OverrideLocalePakForTest(pak_path); |
- ASSERT_FALSE( |
- ResourceBundle::GetSharedInstance().ReloadLocaleResources("he").empty()); |
+ |
+ // Since synchronization isn't complete for the ResourceBundle class, reload |
+ // locale resources on the IO thread. |
+ base::WaitableEvent event(true, false); |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::IO, FROM_HERE, |
+ base::Bind(&WebUIBidiCheckerBrowserTestRTL::SetUpOnIOThread, &event)); |
+ while (!event.IsSignaled()) |
+ ui_test_utils::RunAllPendingInMessageLoop(); |
+ |
base::i18n::SetICUDefaultLocale("he"); |
#if defined(OS_POSIX) && defined(TOOLKIT_GTK) |
gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL); |