[ios] Stop defining DIR_LOCALES on iOS

The value returned by DIR_LOCALES on iOS was incorrect and never used
(it is only used in ResourceBundle::GetLocaleFilePath which is overridden
on both iOS and macOS).

Stop using DIR_MODULE in ui/base/test/run_all_unittests.cc on iOS as
the resources should instead be loaded relative to DIR_ASSETS (and in
fact DIR_MODULE will soon be undefined on iOS).

Bug: 1257402
Change-Id: Iae3d43e2b036732afb60ba3d3d62d35839b684d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4614430
Reviewed-by: Scott Violet <[email protected]>
Commit-Queue: Sylvain Defresne <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1159577}
diff --git a/ui/base/test/run_all_unittests.cc b/ui/base/test/run_all_unittests.cc
index a3183f9f..98e5c16 100644
--- a/ui/base/test/run_all_unittests.cc
+++ b/ui/base/test/run_all_unittests.cc
@@ -87,8 +87,10 @@
 #if BUILDFLAG(IS_ANDROID)
   result =
       base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &dir_resources);
-#elif BUILDFLAG(IS_APPLE)
+#elif BUILDFLAG(IS_MAC)
   result = base::PathService::Get(base::DIR_MODULE, &dir_resources);
+#elif BUILDFLAG(IS_IOS)
+  result = base::PathService::Get(base::DIR_ASSETS, &dir_resources);
 #else
   dir_resources = assets_path;
   result = true;
diff --git a/ui/base/ui_base_paths.cc b/ui/base/ui_base_paths.cc
index e80cfe9..08bb688d 100644
--- a/ui/base/ui_base_paths.cc
+++ b/ui/base/ui_base_paths.cc
@@ -23,11 +23,13 @@
 
   base::FilePath cur;
   switch (key) {
+#if !BUILDFLAG(IS_IOS)
+    // DIR_LOCALES is unsupported on iOS.
     case DIR_LOCALES:
 #if BUILDFLAG(IS_ANDROID)
       if (!base::PathService::Get(DIR_RESOURCE_PAKS_ANDROID, &cur))
         return false;
-#elif BUILDFLAG(IS_APPLE)
+#elif BUILDFLAG(IS_MAC)
       if (!base::PathService::Get(base::DIR_MODULE, &cur))
         return false;
       // On Mac, locale files are in Contents/Resources, a sibling of the
@@ -41,6 +43,7 @@
 #endif
       create_dir = true;
       break;
+#endif  // !BUILDFLAG(IS_IOS)
     // The following are only valid in the development environment, and
     // will fail if executed from an installed executable (because the
     // generated path won't exist).
diff --git a/ui/base/ui_base_paths.h b/ui/base/ui_base_paths.h
index 29c22461..1e53a85 100644
--- a/ui/base/ui_base_paths.h
+++ b/ui/base/ui_base_paths.h
@@ -16,7 +16,9 @@
 enum {
   PATH_START = 3000,
 
+#if !BUILDFLAG(IS_IOS)
   DIR_LOCALES,  // Directory where locale resources are stored.
+#endif
 
   // Valid only in development environment; TODO(darin): move this
   UI_DIR_TEST_DATA,  // Directory where unit test data resides.