summaryrefslogtreecommitdiffstats
path: root/base/i18n
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 04:25:35 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 04:25:35 +0000
commita88f63686baa4751ab6638413ca7b62f8a3c2738 (patch)
tree0b8a7e13326055789131f47ef4dd60ba707d33f7 /base/i18n
parentd75d14350f6875855cc465ba06a2e3807b879269 (diff)
downloadchromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.zip
chromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.tar.gz
chromium_src-a88f63686baa4751ab6638413ca7b62f8a3c2738.tar.bz2
Run ContentMain in a browser_test's browser process. This removes duplication of code in the browser test harness for setting up the browser process, and also ensures that initialization code in ContentMainRunner runs.
Most of the changes are to unit tests which run in browser test executables. These were getting all the setup that these binaries did for browser tests even though they were unit tests. Now they have to explicitly setup objects that they need. This would be done automatically if they were in a unit test binary and therefore using the unit test harness. The goal should be to move these tests to unit test binaries, and make them support launching some tests in separate processes building on the work that Pawel did. BUG=350550 R=sky@chromium.org Review URL: https://codereview.chromium.org/190663012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n')
-rw-r--r--base/i18n/icu_util.cc27
-rw-r--r--base/i18n/icu_util.h3
2 files changed, 23 insertions, 7 deletions
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index bbb73f9..b623a32 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -44,14 +44,21 @@
namespace base {
namespace i18n {
+namespace {
+
+#if !defined(NDEBUG)
+// Assert that we are not called more than once. Even though calling this
+// function isn't harmful (ICU can handle it), being called twice probably
+// indicates a programming error.
+bool g_called_once = false;
+bool g_check_called_once = true;
+#endif
+}
+
bool InitializeICU() {
-#ifndef NDEBUG
- // Assert that we are not called more than once. Even though calling this
- // function isn't harmful (ICU can handle it), being called twice probably
- // indicates a programming error.
- static bool called_once = false;
- DCHECK(!called_once);
- called_once = true;
+#if !defined(NDEBUG)
+ DCHECK(!g_check_called_once || !g_called_once);
+ g_called_once = true;
#endif
#if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED)
@@ -124,5 +131,11 @@ bool InitializeICU() {
#endif
}
+void AllowMultipleInitializeCallsForTesting() {
+#if !defined(NDEBUG)
+ g_check_called_once = false;
+#endif
+}
+
} // namespace i18n
} // namespace base
diff --git a/base/i18n/icu_util.h b/base/i18n/icu_util.h
index ef5dede..4c1c5fd 100644
--- a/base/i18n/icu_util.h
+++ b/base/i18n/icu_util.h
@@ -14,6 +14,9 @@ namespace i18n {
// function should be called before ICU is used.
BASE_I18N_EXPORT bool InitializeICU();
+// In a test binary, the call above might occur twice.
+BASE_I18N_EXPORT void AllowMultipleInitializeCallsForTesting();
+
} // namespace i18n
} // namespace base