#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/base/l10n/l10n_util.h"
#include <stddef.h>
#include <cstring>
#include <memory>
#include "base/containers/flat_set.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/i18n/case_conversion.h"
#include "base/i18n/rtl.h"
#include "base/i18n/time_formatting.h"
#include "base/path_service.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/icu_test_util.h"
#include "base/test/scoped_path_override.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "ui/base/grit/ui_base_test_resources.h"
#include "ui/base/l10n/l10n_util_collator.h"
#include "ui/base/ui_base_paths.h"
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
#include <cstdlib>
#endif
ASCIIToUTF16;
UTF8ToUTF16;
namespace {
class StringWrapper { … };
}
class L10nUtilTest : public PlatformTest { … };
TEST_F(L10nUtilTest, GetString) { … }
#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_POSIX) && defined(USE_GLIB) && !BUILDFLAG(IS_CHROMEOS_ASH)
const bool kPlatformHasDefaultLocale = …;
const bool kUseLocaleFromEnvironment = …;
const bool kSupportsLocalePreference = …;
#elif BUILDFLAG(IS_WIN)
const bool kPlatformHasDefaultLocale = true;
const bool kUseLocaleFromEnvironment = false;
const bool kSupportsLocalePreference = true;
#else
const bool kPlatformHasDefaultLocale = false;
const bool kUseLocaleFromEnvironment = false;
const bool kSupportsLocalePreference = true;
#endif
void SetDefaultLocaleForTest(const std::string& tag, base::Environment* env) { … }
TEST_F(L10nUtilTest, GetAppLocale) { … }
#endif
TEST_F(L10nUtilTest, SortStringsUsingFunction) { … }
void CheckUiDisplayNameForLocale(const std::string& locale,
const std::string& display_locale,
bool is_rtl) { … }
TEST_F(L10nUtilTest, GetDisplayNameForLocaleWithoutCountry) { … }
TEST_F(L10nUtilTest, GetDisplayNameForLocale) { … }
#if BUILDFLAG(IS_IOS)
#define MAYBE_GetDisplayNameForCountry …
#else
#define MAYBE_GetDisplayNameForCountry …
#endif
TEST_F(L10nUtilTest, MAYBE_GetDisplayNameForCountry) { … }
TEST_F(L10nUtilTest, GetParentLocales) { … }
TEST_F(L10nUtilTest, IsValidLocaleSyntax) { … }
TEST_F(L10nUtilTest, TimeDurationFormatAllLocales) { … }
TEST_F(L10nUtilTest, GetUserFacingUILocaleList) { … }
TEST_F(L10nUtilTest, PlatformLocalesIsSorted) { … }
TEST_F(L10nUtilTest, IsPossibleAcceptLanguage) { … }
TEST_F(L10nUtilTest, IsAcceptLanguageDisplayable) { … }
TEST_F(L10nUtilTest, KeepAcceptedLanguages) { … }
TEST_F(L10nUtilTest, FormatStringComputeCorrectOffsetInRTL) { … }