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

Unified Diff: components/test/run_all_unittests.cc

Issue 858203002: Revert of Eliminate components_unittests' dependence on chrome resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « components/components_unittests.isolate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test/run_all_unittests.cc
diff --git a/components/test/run_all_unittests.cc b/components/test/run_all_unittests.cc
index 00d8594a1ce897a6c6c2eb87d2937fc80c3d2b85..533ac9d917c8c7cf62685f813807f114d1cf9bc7 100644
--- a/components/test/run_all_unittests.cc
+++ b/components/test/run_all_unittests.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/bind.h"
-#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/statistics_recorder.h"
#include "base/path_service.h"
@@ -15,6 +14,10 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
#include "url/url_util.h"
+
+#if defined(OS_MACOSX)
+#include "base/mac/bundle_locations.h"
+#endif
#if !defined(OS_IOS)
#include "ui/gl/gl_surface.h"
@@ -53,16 +56,41 @@
invalidation::android::RegisterInvalidationJni(env);
#endif
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ // Look in the framework bundle for resources.
+ base::FilePath path;
+ PathService::Get(base::DIR_EXE, &path);
+
+ // TODO(tfarina): This is temporary. The right fix is to write a
+ // framework-Info.plist and integrate that into the build.
+ // Hardcode the framework name here to avoid having to depend on chrome's
+ // common target for chrome::kFrameworkName.
+#if defined(GOOGLE_CHROME_BUILD)
+ path = path.AppendASCII("Google Chrome Framework.framework");
+#elif defined(CHROMIUM_BUILD)
+ path = path.AppendASCII("Chromium Framework.framework");
+#else
+#error Unknown branding
+#endif
+
+ base::mac::SetOverrideFrameworkBundlePath(path);
+#endif
+
ui::RegisterPathProvider();
+ // TODO(tfarina): This should be changed to InitSharedInstanceWithPakFile()
+ // so we can load our pak file instead of chrome.pak. crbug.com/348563
+ ui::ResourceBundle::InitSharedInstanceWithLocale(
+ "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES);
base::FilePath resources_pack_path;
-#if defined(OS_ANDROID)
+#if !defined(OS_ANDROID)
+ PathService::Get(base::DIR_MODULE, &resources_pack_path);
+#else
PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &resources_pack_path);
-#else
- PathService::Get(base::DIR_MODULE, &resources_pack_path);
#endif
- ui::ResourceBundle::InitSharedInstanceWithPakPath(
- resources_pack_path.AppendASCII("components_unittests_resources.pak"));
+ ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
+ resources_pack_path.AppendASCII("resources.pak"),
+ ui::SCALE_FACTOR_NONE);
// These schemes need to be added globally to pass tests of
// autocomplete_input_unittest.cc and content_settings_pattern*
@@ -78,6 +106,10 @@
void Shutdown() override {
ui::ResourceBundle::CleanupSharedInstance();
+
+#if defined(OS_MACOSX) && !defined(OS_IOS)
+ base::mac::SetOverrideFrameworkBundle(NULL);
+#endif
base::TestSuite::Shutdown();
}
« no previous file with comments | « components/components_unittests.isolate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698