[fuchsia] Remove DIR_MODULE & FILE_MODULE from cross-platform code.
Also, do not define these keys on Fuchsia as the module location is not useful and there is no legitimate use in obtaining it. Bug: 1263691, 1184980, 1262430 Change-Id: I856b6dbf79312006b96ce2714d999cef7059b454 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3188614 Commit-Queue: Mason Bendixen <masonben@chromium.org> Auto-Submit: Mason Bendixen <masonben@chromium.org> Reviewed-by: David Dorwin <ddorwin@chromium.org> Reviewed-by: Michael Spang <spang@chromium.org> Reviewed-by: Wez <wez@chromium.org> Reviewed-by: Ken Rockot <rockot@google.com> Reviewed-by: Peter Kvitek <kvitekp@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Reviewed-by: Ben Wells <benwells@chromium.org> Reviewed-by: Colin Blundell <blundell@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Cr-Commit-Position: refs/heads/main@{#944621}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f400fcd78b
commit
d798600c69
ash
base
chrome
browser
common
test
base
chromedriver
chrome
data
media_router
chromecast/browser
chromeos/components
components
dom_distiller
content
standalone
exo
wayland
fuzzer
ntp_tiles
pdf
device/test
extensions/shell/app
headless/lib
pdf/test
ui
views
views_content_client
@@ -104,7 +104,7 @@ void InitializeKeyboardResources() {
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
base::FilePath pak_dir;
|
base::FilePath pak_dir;
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
base::PathService::Get(base::DIR_ASSETS, &pak_dir);
|
||||||
base::FilePath pak_file =
|
base::FilePath pak_file =
|
||||||
pak_dir.Append(FILE_PATH_LITERAL("keyboard_resources.pak"));
|
pak_dir.Append(FILE_PATH_LITERAL("keyboard_resources.pak"));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(pak_file,
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(pak_file,
|
||||||
|
@@ -46,7 +46,7 @@ void AshTestSuite::Initialize() {
|
|||||||
|
|
||||||
// Load ash test resources and en-US strings; not 'common' (Chrome) resources.
|
// Load ash test resources and en-US strings; not 'common' (Chrome) resources.
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
base::PathService::Get(base::DIR_MODULE, &path);
|
base::PathService::Get(base::DIR_ASSETS, &path);
|
||||||
base::FilePath ash_test_strings =
|
base::FilePath ash_test_strings =
|
||||||
path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
|
path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
|
||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
|
||||||
|
@@ -27,10 +27,10 @@ void InitI18n() {
|
|||||||
ASSERT_TRUE(base::PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
|
ASSERT_TRUE(base::PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
|
||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
||||||
|
|
||||||
base::FilePath dir_module_path;
|
base::FilePath dir_assets_path;
|
||||||
ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &dir_module_path));
|
ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &dir_assets_path));
|
||||||
base::FilePath chromeos_test_strings_path =
|
base::FilePath chromeos_test_strings_path =
|
||||||
dir_module_path.Append(FILE_PATH_LITERAL("chromeos_test_strings.pak"));
|
dir_assets_path.Append(FILE_PATH_LITERAL("chromeos_test_strings.pak"));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
chromeos_test_strings_path, ui::kScaleFactorNone);
|
chromeos_test_strings_path, ui::kScaleFactorNone);
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ bool PathProvider(int key, FilePath* result) {
|
|||||||
return false;
|
return false;
|
||||||
*result = result->DirName();
|
*result = result->DirName();
|
||||||
return true;
|
return true;
|
||||||
|
#if !defined(OS_FUCHSIA)
|
||||||
case DIR_MODULE:
|
case DIR_MODULE:
|
||||||
if (!PathService::Get(FILE_MODULE, result))
|
if (!PathService::Get(FILE_MODULE, result))
|
||||||
return false;
|
return false;
|
||||||
@@ -26,15 +27,18 @@ bool PathProvider(int key, FilePath* result) {
|
|||||||
return true;
|
return true;
|
||||||
case DIR_ASSETS:
|
case DIR_ASSETS:
|
||||||
return PathService::Get(DIR_MODULE, result);
|
return PathService::Get(DIR_MODULE, result);
|
||||||
|
#endif // !defined(OS_FUCHSIA)
|
||||||
case DIR_TEMP:
|
case DIR_TEMP:
|
||||||
return GetTempDir(result);
|
return GetTempDir(result);
|
||||||
case DIR_HOME:
|
case DIR_HOME:
|
||||||
*result = GetHomeDir();
|
*result = GetHomeDir();
|
||||||
return true;
|
return true;
|
||||||
case DIR_GEN_TEST_DATA_ROOT:
|
case DIR_GEN_TEST_DATA_ROOT:
|
||||||
|
#if !defined(OS_FUCHSIA)
|
||||||
// On most platforms, all build output is in the same directory, so
|
// On most platforms, all build output is in the same directory, so
|
||||||
// use DIR_MODULE to get the path to the current binary.
|
// use DIR_MODULE to get the path to the current binary.
|
||||||
return PathService::Get(DIR_MODULE, result);
|
return PathService::Get(DIR_MODULE, result);
|
||||||
|
#endif // !defined(OS_FUCHSIA)
|
||||||
case DIR_TEST_DATA: {
|
case DIR_TEST_DATA: {
|
||||||
FilePath test_data_path;
|
FilePath test_data_path;
|
||||||
if (!PathService::Get(DIR_SRC_TEST_DATA_ROOT, &test_data_path))
|
if (!PathService::Get(DIR_SRC_TEST_DATA_ROOT, &test_data_path))
|
||||||
|
@@ -28,14 +28,26 @@ enum BasePathKey {
|
|||||||
PATH_START = 0,
|
PATH_START = 0,
|
||||||
|
|
||||||
// The following refer to the current application.
|
// The following refer to the current application.
|
||||||
FILE_EXE, // Path and filename of the current executable.
|
FILE_EXE, // Path and filename of the current executable.
|
||||||
|
#if !defined(OS_FUCHSIA)
|
||||||
|
// Prefer keys (e.g., DIR_ASSETS) that are specific to the use case as the
|
||||||
|
// module location may not work as expected on some platforms. For this
|
||||||
|
// reason, this key is not defined on Fuchsia. See crbug.com/1263691 for
|
||||||
|
// details.
|
||||||
FILE_MODULE, // Path and filename of the module containing the code for
|
FILE_MODULE, // Path and filename of the module containing the code for
|
||||||
// the PathService (which could differ from FILE_EXE if the
|
// the PathService (which could differ from FILE_EXE if the
|
||||||
// PathService were compiled into a shared object, for
|
// PathService were compiled into a shared object, for
|
||||||
// example).
|
// example).
|
||||||
DIR_EXE, // Directory containing FILE_EXE.
|
#endif
|
||||||
DIR_MODULE, // Directory containing FILE_MODULE.
|
DIR_EXE, // Directory containing FILE_EXE.
|
||||||
DIR_ASSETS, // Directory that contains application assets.
|
#if !defined(OS_FUCHSIA)
|
||||||
|
// Prefer keys (e.g., DIR_ASSETS) that are specific to the use case as the
|
||||||
|
// module location may not work as expected on some platforms. For this
|
||||||
|
// reason, this key is not defined on Fuchsia. See crbug.com/1263691 for
|
||||||
|
// details.
|
||||||
|
DIR_MODULE, // Directory containing FILE_MODULE.
|
||||||
|
#endif
|
||||||
|
DIR_ASSETS, // Directory that contains application assets.
|
||||||
|
|
||||||
// The following refer to system and system user directories.
|
// The following refer to system and system user directories.
|
||||||
DIR_TEMP, // Temporary directory for the system and/or user.
|
DIR_TEMP, // Temporary directory for the system and/or user.
|
||||||
|
@@ -17,9 +17,6 @@ namespace base {
|
|||||||
|
|
||||||
bool PathProviderFuchsia(int key, FilePath* result) {
|
bool PathProviderFuchsia(int key, FilePath* result) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case FILE_MODULE:
|
|
||||||
NOTIMPLEMENTED_LOG_ONCE() << " for FILE_MODULE.";
|
|
||||||
return false;
|
|
||||||
case FILE_EXE:
|
case FILE_EXE:
|
||||||
*result = CommandLine::ForCurrentProcess()->GetProgram();
|
*result = CommandLine::ForCurrentProcess()->GetProgram();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -130,9 +130,7 @@ TEST_F(PathServiceTest, Get) {
|
|||||||
#elif defined(OS_FUCHSIA)
|
#elif defined(OS_FUCHSIA)
|
||||||
constexpr std::array<int, 3> kUnsupportedKeys = {
|
constexpr std::array<int, 3> kUnsupportedKeys = {
|
||||||
// TODO(crbug.com/1231928): Implement DIR_USER_DESKTOP.
|
// TODO(crbug.com/1231928): Implement DIR_USER_DESKTOP.
|
||||||
DIR_USER_DESKTOP,
|
DIR_USER_DESKTOP};
|
||||||
// TODO(crbug.com/1184980), Do not define FILE_MODULE and DIR_MODULE.
|
|
||||||
FILE_MODULE, DIR_MODULE};
|
|
||||||
#else
|
#else
|
||||||
constexpr std::array<int, 0> kUnsupportedKeys = {};
|
constexpr std::array<int, 0> kUnsupportedKeys = {};
|
||||||
#endif // defined(OS_ANDROID)
|
#endif // defined(OS_ANDROID)
|
||||||
|
@@ -394,8 +394,13 @@ NativeLibrary LoadOtherLibrary() {
|
|||||||
// macros in a function returning non-null.
|
// macros in a function returning non-null.
|
||||||
const auto load = [](NativeLibrary* library) {
|
const auto load = [](NativeLibrary* library) {
|
||||||
FilePath other_library_path;
|
FilePath other_library_path;
|
||||||
|
#if defined(OS_FUCHSIA)
|
||||||
|
// TODO(crbug.com/1262430): Find a solution that works across platforms.
|
||||||
|
ASSERT_TRUE(PathService::Get(DIR_ASSETS, &other_library_path));
|
||||||
|
#else
|
||||||
// The module is next to the test module rather than with test data.
|
// The module is next to the test module rather than with test data.
|
||||||
ASSERT_TRUE(PathService::Get(DIR_MODULE, &other_library_path));
|
ASSERT_TRUE(PathService::Get(DIR_MODULE, &other_library_path));
|
||||||
|
#endif // defined(OS_FUCHSIA)
|
||||||
other_library_path = other_library_path.AppendASCII(
|
other_library_path = other_library_path.AppendASCII(
|
||||||
GetLoadableModuleName("base_profiler_test_support_library"));
|
GetLoadableModuleName("base_profiler_test_support_library"));
|
||||||
NativeLibraryLoadError load_error;
|
NativeLibraryLoadError load_error;
|
||||||
|
@@ -77,7 +77,7 @@ struct Environment {
|
|||||||
base::PathService::CheckedGet(ui::UI_TEST_PAK);
|
base::PathService::CheckedGet(ui::UI_TEST_PAK);
|
||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
||||||
|
|
||||||
base::FilePath pak_path = base::PathService::CheckedGet(base::DIR_MODULE);
|
base::FilePath pak_path = base::PathService::CheckedGet(base::DIR_ASSETS);
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
pak_path.AppendASCII("components_tests_resources.pak"),
|
pak_path.AppendASCII("components_tests_resources.pak"),
|
||||||
ui::kScaleFactorNone);
|
ui::kScaleFactorNone);
|
||||||
|
@@ -180,7 +180,10 @@ const struct {
|
|||||||
{chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr, kDontBlockChildren},
|
{chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr, kDontBlockChildren},
|
||||||
// The Chrome installation itself should not be modified by the web.
|
// The Chrome installation itself should not be modified by the web.
|
||||||
{base::DIR_EXE, nullptr, kBlockAllChildren},
|
{base::DIR_EXE, nullptr, kBlockAllChildren},
|
||||||
|
#if !defined(OS_FUCHSIA)
|
||||||
{base::DIR_MODULE, nullptr, kBlockAllChildren},
|
{base::DIR_MODULE, nullptr, kBlockAllChildren},
|
||||||
|
#endif
|
||||||
|
{base::DIR_ASSETS, nullptr, kBlockAllChildren},
|
||||||
// And neither should the configuration of at least the currently running
|
// And neither should the configuration of at least the currently running
|
||||||
// Chrome instance (note that this does not take --user-data-dir command
|
// Chrome instance (note that this does not take --user-data-dir command
|
||||||
// line overrides into account).
|
// line overrides into account).
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
#include "base/scoped_native_library.h"
|
#include "base/scoped_native_library.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "base/time/time.h"
|
#include "base/time/time.h"
|
||||||
#include "build/build_config.h"
|
|
||||||
#include "media/media_buildflags.h"
|
#include "media/media_buildflags.h"
|
||||||
#include "testing/gtest/include/gtest/gtest.h"
|
#include "testing/gtest/include/gtest/gtest.h"
|
||||||
#include "testing/perf/perf_result_reporter.h"
|
#include "testing/perf/perf_result_reporter.h"
|
||||||
|
@@ -32,7 +32,7 @@ void VrTestSuite::Initialize() {
|
|||||||
ui::RegisterPathProvider();
|
ui::RegisterPathProvider();
|
||||||
base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path);
|
base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path);
|
||||||
#else
|
#else
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_path);
|
base::PathService::Get(base::DIR_ASSETS, &pak_path);
|
||||||
#endif
|
#endif
|
||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(
|
||||||
pak_path.AppendASCII("vr_test.pak"));
|
pak_path.AppendASCII("vr_test.pak"));
|
||||||
|
@@ -136,15 +136,14 @@ bool PathProvider(int key, base::FilePath* result) {
|
|||||||
return base::PathService::Get(chrome::DIR_USER_DATA, result);
|
return base::PathService::Get(chrome::DIR_USER_DATA, result);
|
||||||
#else
|
#else
|
||||||
// Debug builds write next to the binary (in the build tree)
|
// Debug builds write next to the binary (in the build tree)
|
||||||
|
// TODO(crbug.com/1262330): implement workable solution for Fuchsia.
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
// Apps may not write into their own bundle.
|
// Apps may not write into their own bundle.
|
||||||
if (base::mac::AmIBundled()) {
|
if (base::mac::AmIBundled()) {
|
||||||
return base::PathService::Get(chrome::DIR_USER_DATA, result);
|
return base::PathService::Get(chrome::DIR_USER_DATA, result);
|
||||||
}
|
}
|
||||||
return base::PathService::Get(base::DIR_EXE, result);
|
|
||||||
#else
|
|
||||||
return base::PathService::Get(base::DIR_EXE, result);
|
|
||||||
#endif // defined(OS_MAC)
|
#endif // defined(OS_MAC)
|
||||||
|
return base::PathService::Get(base::DIR_EXE, result);
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,9 @@ void ChromeTestSuite::Initialize() {
|
|||||||
|
|
||||||
if (!browser_dir_.empty()) {
|
if (!browser_dir_.empty()) {
|
||||||
base::PathService::Override(base::DIR_EXE, browser_dir_);
|
base::PathService::Override(base::DIR_EXE, browser_dir_);
|
||||||
|
#if !defined(OS_FUCHSIA)
|
||||||
base::PathService::Override(base::DIR_MODULE, browser_dir_);
|
base::PathService::Override(base::DIR_MODULE, browser_dir_);
|
||||||
|
#endif // !defined(OS_FUCHSIA)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable external libraries load if we are under python process in
|
// Disable external libraries load if we are under python process in
|
||||||
|
@@ -505,7 +505,7 @@ void BaseWebUIBrowserTest::SetUpOnMainThread() {
|
|||||||
JavaScriptBrowserTest::SetUpOnMainThread();
|
JavaScriptBrowserTest::SetUpOnMainThread();
|
||||||
|
|
||||||
base::FilePath pak_path;
|
base::FilePath pak_path;
|
||||||
ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &pak_path));
|
ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &pak_path));
|
||||||
pak_path = pak_path.AppendASCII("browser_tests.pak");
|
pak_path = pak_path.AppendASCII("browser_tests.pak");
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
pak_path, ui::kScaleFactorNone);
|
pak_path, ui::kScaleFactorNone);
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "base/environment.h"
|
#include "base/environment.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
|
#include "base/logging.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/string_split.h"
|
#include "base/strings/string_split.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
@@ -149,12 +150,21 @@ bool FindChrome(base::FilePath* browser_exe) {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LOG_IF(ERROR, browser_exes_array[0].empty()) << "Unsupported platform.";
|
||||||
|
|
||||||
std::vector<base::FilePath> browser_exes(
|
std::vector<base::FilePath> browser_exes(
|
||||||
browser_exes_array, browser_exes_array + base::size(browser_exes_array));
|
browser_exes_array, browser_exes_array + base::size(browser_exes_array));
|
||||||
base::FilePath module_dir;
|
base::FilePath module_dir;
|
||||||
|
#if defined(OS_FUCHSIA)
|
||||||
|
// Use -1 to allow this to compile.
|
||||||
|
// TODO(crbug.com/1262176): Determine whether Fuchsia should support this and
|
||||||
|
// if so provide an appropriate implementation for this function.
|
||||||
|
if (base::PathService::Get(-1, &module_dir)) {
|
||||||
|
#else
|
||||||
if (base::PathService::Get(base::DIR_MODULE, &module_dir)) {
|
if (base::PathService::Get(base::DIR_MODULE, &module_dir)) {
|
||||||
for (size_t i = 0; i < browser_exes.size(); ++i) {
|
#endif
|
||||||
base::FilePath path = module_dir.Append(browser_exes[i]);
|
for (const base::FilePath& file_path : browser_exes) {
|
||||||
|
base::FilePath path = module_dir.Append(file_path);
|
||||||
if (base::PathExists(path)) {
|
if (base::PathExists(path)) {
|
||||||
*browser_exe = path;
|
*browser_exe = path;
|
||||||
return true;
|
return true;
|
||||||
|
@@ -203,7 +203,7 @@ class MojoJSInterfaceBrokerBrowserTest : public InProcessBrowserTest {
|
|||||||
|
|
||||||
void SetUpOnMainThread() override {
|
void SetUpOnMainThread() override {
|
||||||
base::FilePath pak_path;
|
base::FilePath pak_path;
|
||||||
ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &pak_path));
|
ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &pak_path));
|
||||||
pak_path = pak_path.AppendASCII("browser_tests.pak");
|
pak_path = pak_path.AppendASCII("browser_tests.pak");
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
pak_path, ui::kScaleFactorNone);
|
pak_path, ui::kScaleFactorNone);
|
||||||
|
@@ -296,7 +296,7 @@ void MediaRouterIntegrationBrowserTest::CheckStartFailed(
|
|||||||
base::FilePath MediaRouterIntegrationBrowserTest::GetResourceFile(
|
base::FilePath MediaRouterIntegrationBrowserTest::GetResourceFile(
|
||||||
base::FilePath::StringPieceType relative_path) const {
|
base::FilePath::StringPieceType relative_path) const {
|
||||||
const base::FilePath full_path =
|
const base::FilePath full_path =
|
||||||
base::PathService::CheckedGet(base::DIR_MODULE)
|
base::PathService::CheckedGet(base::DIR_ASSETS)
|
||||||
.Append(kResourcePath)
|
.Append(kResourcePath)
|
||||||
.Append(relative_path);
|
.Append(relative_path);
|
||||||
{
|
{
|
||||||
|
@@ -33,7 +33,7 @@ class MediaRouterIntegrationOneUABrowserTest
|
|||||||
// Set up embedded test server to serve offscreen presentation with relative
|
// Set up embedded test server to serve offscreen presentation with relative
|
||||||
// URL "presentation_receiver.html".
|
// URL "presentation_receiver.html".
|
||||||
base::FilePath resource_dir =
|
base::FilePath resource_dir =
|
||||||
base::PathService::CheckedGet(base::DIR_MODULE)
|
base::PathService::CheckedGet(base::DIR_ASSETS)
|
||||||
.Append(FILE_PATH_LITERAL("media_router/browser_test_resources/"));
|
.Append(FILE_PATH_LITERAL("media_router/browser_test_resources/"));
|
||||||
embedded_test_server()->ServeFilesFromDirectory(resource_dir);
|
embedded_test_server()->ServeFilesFromDirectory(resource_dir);
|
||||||
ASSERT_TRUE(embedded_test_server()->Start());
|
ASSERT_TRUE(embedded_test_server()->Start());
|
||||||
|
@@ -286,13 +286,13 @@ base::FilePath GetApplicationFontsDir() {
|
|||||||
std::string fontconfig_sysroot;
|
std::string fontconfig_sysroot;
|
||||||
if (env->GetVar("FONTCONFIG_SYSROOT", &fontconfig_sysroot)) {
|
if (env->GetVar("FONTCONFIG_SYSROOT", &fontconfig_sysroot)) {
|
||||||
// Running with hermetic fontconfig; using the full path will not work.
|
// Running with hermetic fontconfig; using the full path will not work.
|
||||||
// Assume the root is base::DIR_MODULE as set by
|
// Assume the root is base::DIR_ASSETS as set by
|
||||||
// test_fonts::SetUpFontconfig().
|
// test_fonts::SetUpFontconfig().
|
||||||
return base::FilePath("/fonts");
|
return base::FilePath("/fonts");
|
||||||
} else {
|
} else {
|
||||||
base::FilePath dir_module;
|
base::FilePath dir_assets;
|
||||||
base::PathService::Get(base::DIR_MODULE, &dir_module);
|
base::PathService::Get(base::DIR_ASSETS, &dir_assets);
|
||||||
return dir_module.Append("fonts");
|
return dir_assets.Append("fonts");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,10 +26,10 @@ void InitI18n() {
|
|||||||
ASSERT_TRUE(base::PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
|
ASSERT_TRUE(base::PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
|
||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
||||||
|
|
||||||
base::FilePath dir_module_path;
|
base::FilePath dir_assets_path;
|
||||||
ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &dir_module_path));
|
ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &dir_assets_path));
|
||||||
base::FilePath chromeos_test_strings_path =
|
base::FilePath chromeos_test_strings_path =
|
||||||
dir_module_path.Append(FILE_PATH_LITERAL("chromeos_test_strings.pak"));
|
dir_assets_path.Append(FILE_PATH_LITERAL("chromeos_test_strings.pak"));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
chromeos_test_strings_path, ui::kScaleFactorNone);
|
chromeos_test_strings_path, ui::kScaleFactorNone);
|
||||||
}
|
}
|
||||||
|
@@ -61,8 +61,10 @@ class DomDistillerDistillablePageUtilsTest : public content::ContentBrowserTest,
|
|||||||
#if defined(OS_ANDROID)
|
#if defined(OS_ANDROID)
|
||||||
CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
||||||
pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
||||||
#else
|
#elif defined(OS_MAC)
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||||
|
#else
|
||||||
|
base::PathService::Get(base::DIR_ASSETS, &pak_dir);
|
||||||
#endif // OS_ANDROID
|
#endif // OS_ANDROID
|
||||||
pak_file =
|
pak_file =
|
||||||
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
||||||
|
@@ -92,8 +92,10 @@ class DomDistillerJsTest : public content::ContentBrowserTest {
|
|||||||
#if defined(OS_ANDROID)
|
#if defined(OS_ANDROID)
|
||||||
CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
||||||
pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
||||||
#else
|
#elif defined(OS_MAC)
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||||
|
#else
|
||||||
|
base::PathService::Get(base::DIR_ASSETS, &pak_dir);
|
||||||
#endif // OS_ANDROID
|
#endif // OS_ANDROID
|
||||||
pak_file =
|
pak_file =
|
||||||
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
||||||
|
@@ -116,8 +116,10 @@ void AddComponentsResources() {
|
|||||||
#if defined(OS_ANDROID)
|
#if defined(OS_ANDROID)
|
||||||
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir));
|
||||||
pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks"));
|
||||||
#else
|
#elif defined(OS_MAC)
|
||||||
PathService::Get(base::DIR_MODULE, &pak_dir);
|
PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||||
|
#else
|
||||||
|
PathService::Get(base::DIR_ASSETS, &pak_dir);
|
||||||
#endif // OS_ANDROID
|
#endif // OS_ANDROID
|
||||||
pak_file =
|
pak_file =
|
||||||
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
||||||
|
@@ -173,7 +173,7 @@ std::unique_ptr<DomDistillerService> CreateDomDistillerService(
|
|||||||
void AddComponentsTestResources() {
|
void AddComponentsTestResources() {
|
||||||
base::FilePath pak_file;
|
base::FilePath pak_file;
|
||||||
base::FilePath pak_dir;
|
base::FilePath pak_dir;
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
base::PathService::Get(base::DIR_ASSETS, &pak_dir);
|
||||||
pak_file =
|
pak_file =
|
||||||
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
|
@@ -56,7 +56,7 @@ void ServerEnvironment::SetUpOnUIThread(base::WaitableEvent* event) {
|
|||||||
// Load ash test resources and en-US strings; not 'common' (Chrome)
|
// Load ash test resources and en-US strings; not 'common' (Chrome)
|
||||||
// resources.
|
// resources.
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
base::PathService::Get(base::DIR_MODULE, &path);
|
base::PathService::Get(base::DIR_ASSETS, &path);
|
||||||
base::FilePath ash_test_strings =
|
base::FilePath ash_test_strings =
|
||||||
path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
|
path.Append(FILE_PATH_LITERAL("ash_test_strings.pak"));
|
||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ash_test_strings);
|
||||||
|
@@ -172,7 +172,7 @@ class IconCacherTestPopularSites : public IconCacherTestBase {
|
|||||||
#if defined(OS_ANDROID)
|
#if defined(OS_ANDROID)
|
||||||
base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path);
|
base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_path);
|
||||||
#else
|
#else
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_path);
|
base::PathService::Get(base::DIR_ASSETS, &pak_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
base::FilePath ui_test_pak_path;
|
base::FilePath ui_test_pak_path;
|
||||||
|
@@ -114,7 +114,7 @@ class PdfAccessibilityTreeTest : public content::RenderViewTest {
|
|||||||
content::RenderViewTest::SetUp();
|
content::RenderViewTest::SetUp();
|
||||||
|
|
||||||
base::FilePath pak_dir;
|
base::FilePath pak_dir;
|
||||||
base::PathService::Get(base::DIR_MODULE, &pak_dir);
|
base::PathService::Get(base::DIR_ASSETS, &pak_dir);
|
||||||
base::FilePath pak_file =
|
base::FilePath pak_file =
|
||||||
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak"));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
|
@@ -39,7 +39,7 @@ class DeviceTestSuite : public base::TestSuite {
|
|||||||
#if defined(OS_ANDROID)
|
#if defined(OS_ANDROID)
|
||||||
ASSERT_TRUE(base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &path));
|
ASSERT_TRUE(base::PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &path));
|
||||||
#else
|
#else
|
||||||
ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &path));
|
ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &path));
|
||||||
#endif // defined(OS_ANDROID)
|
#endif // defined(OS_ANDROID)
|
||||||
base::FilePath bluetooth_test_strings =
|
base::FilePath bluetooth_test_strings =
|
||||||
path.Append(FILE_PATH_LITERAL("bluetooth_test_strings.pak"));
|
path.Append(FILE_PATH_LITERAL("bluetooth_test_strings.pak"));
|
||||||
|
@@ -123,7 +123,7 @@ void InitLogging() {
|
|||||||
// Returns the path to the extensions_shell_and_test.pak file.
|
// Returns the path to the extensions_shell_and_test.pak file.
|
||||||
base::FilePath GetResourcesPakFilePath() {
|
base::FilePath GetResourcesPakFilePath() {
|
||||||
base::FilePath extensions_shell_and_test_pak_path;
|
base::FilePath extensions_shell_and_test_pak_path;
|
||||||
base::PathService::Get(base::DIR_MODULE, &extensions_shell_and_test_pak_path);
|
base::PathService::Get(base::DIR_ASSETS, &extensions_shell_and_test_pak_path);
|
||||||
extensions_shell_and_test_pak_path =
|
extensions_shell_and_test_pak_path =
|
||||||
extensions_shell_and_test_pak_path.AppendASCII(
|
extensions_shell_and_test_pak_path.AppendASCII(
|
||||||
"extensions_shell_and_test.pak");
|
"extensions_shell_and_test.pak");
|
||||||
|
@@ -277,7 +277,13 @@ void HeadlessContentMainDelegate::InitLogging(
|
|||||||
|
|
||||||
// Otherwise we log to where the executable is.
|
// Otherwise we log to where the executable is.
|
||||||
if (log_path.empty()) {
|
if (log_path.empty()) {
|
||||||
|
#if defined(OS_FUCHSIA)
|
||||||
|
// TODO(crbug.com/1262330): Use the same solution as used for LOG_DIR.
|
||||||
|
// Use -1 to allow this to compile.
|
||||||
|
if (base::PathService::Get(-1, &log_path)) {
|
||||||
|
#else
|
||||||
if (base::PathService::Get(base::DIR_MODULE, &log_path)) {
|
if (base::PathService::Get(base::DIR_MODULE, &log_path)) {
|
||||||
|
#endif
|
||||||
log_path = log_path.Append(log_filename);
|
log_path = log_path.Append(log_filename);
|
||||||
} else {
|
} else {
|
||||||
log_path = log_filename;
|
log_path = log_filename;
|
||||||
|
@@ -95,7 +95,7 @@ class PdfTestSuite final : public base::TestSuite {
|
|||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
||||||
|
|
||||||
base::FilePath pdf_tests_pak_path;
|
base::FilePath pdf_tests_pak_path;
|
||||||
ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &pdf_tests_pak_path));
|
ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &pdf_tests_pak_path));
|
||||||
pdf_tests_pak_path =
|
pdf_tests_pak_path =
|
||||||
pdf_tests_pak_path.AppendASCII("pdf_tests_resources.pak");
|
pdf_tests_pak_path.AppendASCII("pdf_tests_resources.pak");
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
|
@@ -134,7 +134,7 @@ ExamplesExitCode ExamplesMainProc(bool under_test) {
|
|||||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
|
||||||
|
|
||||||
base::FilePath views_examples_resources_pak_path;
|
base::FilePath views_examples_resources_pak_path;
|
||||||
CHECK(base::PathService::Get(base::DIR_MODULE,
|
CHECK(base::PathService::Get(base::DIR_ASSETS,
|
||||||
&views_examples_resources_pak_path));
|
&views_examples_resources_pak_path));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
views_examples_resources_pak_path.AppendASCII(
|
views_examples_resources_pak_path.AppendASCII(
|
||||||
|
@@ -27,7 +27,7 @@ namespace {
|
|||||||
|
|
||||||
void OnResourcesLoaded() {
|
void OnResourcesLoaded() {
|
||||||
base::FilePath views_examples_resources_pak_path;
|
base::FilePath views_examples_resources_pak_path;
|
||||||
CHECK(base::PathService::Get(base::DIR_MODULE,
|
CHECK(base::PathService::Get(base::DIR_ASSETS,
|
||||||
&views_examples_resources_pak_path));
|
&views_examples_resources_pak_path));
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
views_examples_resources_pak_path.AppendASCII(
|
views_examples_resources_pak_path.AppendASCII(
|
||||||
|
@@ -70,7 +70,7 @@ void ViewsContentMainDelegate::PreSandboxStartup() {
|
|||||||
|
|
||||||
// Load content resources to provide, e.g., sandbox configuration data on Mac.
|
// Load content resources to provide, e.g., sandbox configuration data on Mac.
|
||||||
base::FilePath content_resources_pak_path;
|
base::FilePath content_resources_pak_path;
|
||||||
base::PathService::Get(base::DIR_MODULE, &content_resources_pak_path);
|
base::PathService::Get(base::DIR_ASSETS, &content_resources_pak_path);
|
||||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||||
content_resources_pak_path.AppendASCII("content_resources.pak"),
|
content_resources_pak_path.AppendASCII("content_resources.pak"),
|
||||||
ui::k100Percent);
|
ui::k100Percent);
|
||||||
|
Reference in New Issue
Block a user