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

Unified Diff: chrome/browser/ui/webui/bidi_checker_web_ui_test.cc

Issue 10546139: Do the ReloadLocaleResources() call on the IO thread to avoid synchronization issues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove ui_test_utils:: for call within same namespace. Created 8 years, 6 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
« no previous file with comments | « chrome/browser/ui/webui/bidi_checker_web_ui_test.h ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1493d23bfeccc19426533c305784340e0853cf87 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,19 @@ void WebUIBidiCheckerBrowserTestRTL::RunBidiCheckerOnPage(
WebUIBidiCheckerBrowserTest::RunBidiCheckerOnPage(page_url, true);
}
+// static
+void WebUIBidiCheckerBrowserTestRTL::SetUpOnIOThread(
+ base::WaitableEvent* event) {
+ std::string locale;
+ {
+ base::ThreadRestrictions::ScopedAllowIO allow_io_scope;
+ locale.assign(
+ ResourceBundle::GetSharedInstance().ReloadLocaleResources("he"));
+ }
+ event->Signal();
+ ASSERT_FALSE(locale.empty());
+}
+
void WebUIBidiCheckerBrowserTestRTL::SetUpOnMainThread() {
WebUIBidiCheckerBrowserTest::SetUpOnMainThread();
FilePath pak_path;
@@ -79,8 +94,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,
+ base::Unretained(&event)));
+ ui_test_utils::WaitEventSignaled(&event);
Joao da Silva 2012/06/13 22:09:16 Why not PostTaskAndReply to IO? The posted task do
Sheridan Rawlins 2012/06/15 00:36:23 This was already committed, but I'll try this on a
+
base::i18n::SetICUDefaultLocale("he");
#if defined(OS_POSIX) && defined(TOOLKIT_GTK)
gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
« no previous file with comments | « chrome/browser/ui/webui/bidi_checker_web_ui_test.h ('k') | chrome/test/base/ui_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698