diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 10:13:27 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-17 10:13:27 +0000 |
commit | 9b5dc52f6ae610f987a2989a8bbf006143870b24 (patch) | |
tree | 681428b713688fe9bf57a054e0ab23bd6dcc007e /remoting/base | |
parent | c73c0407cf4d752911c9c60a4f9698fcca66db3f (diff) | |
download | chromium_src-9b5dc52f6ae610f987a2989a8bbf006143870b24.zip chromium_src-9b5dc52f6ae610f987a2989a8bbf006143870b24.tar.gz chromium_src-9b5dc52f6ae610f987a2989a8bbf006143870b24.tar.bz2 |
Add common_resources.grd for non-localizeable chromoting resources.
The new common_resources.grd will be used for non-loalizeable resources,
such as images.
Review URL: https://chromiumcodereview.appspot.com/11087059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162342 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base')
-rw-r--r-- | remoting/base/resources.cc | 12 | ||||
-rw-r--r-- | remoting/base/resources_unittest.cc | 25 |
2 files changed, 32 insertions, 5 deletions
diff --git a/remoting/base/resources.cc b/remoting/base/resources.cc index cd7e486..32e62c4 100644 --- a/remoting/base/resources.cc +++ b/remoting/base/resources.cc @@ -11,16 +11,24 @@ namespace remoting { +namespace { +const char kLocaleResourcesDirName[] = "remoting_locales"; +const char kCommonResourcesFileName[] = "chrome_remote_desktop.pak"; +} // namespace + // Loads chromoting resources. bool LoadResources(const std::string& locale) { FilePath path; if (!PathService::Get(base::DIR_MODULE, &path)) return false; - path = path.Append(FILE_PATH_LITERAL("remoting_locales")); - PathService::Override(ui::DIR_LOCALES, path); + PathService::Override(ui::DIR_LOCALES, + path.AppendASCII(kLocaleResourcesDirName)); ui::ResourceBundle::InitSharedInstanceLocaleOnly(locale, NULL); + ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( + path.AppendASCII(kCommonResourcesFileName), ui::SCALE_FACTOR_100P); + return true; } diff --git a/remoting/base/resources_unittest.cc b/remoting/base/resources_unittest.cc index 45f94ee..aa94ec3 100644 --- a/remoting/base/resources_unittest.cc +++ b/remoting/base/resources_unittest.cc @@ -4,6 +4,7 @@ #include "remoting/base/resources.h" +#include "remoting/base/common_resources.h" #include "remoting/base/string_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -15,19 +16,37 @@ namespace remoting { // the test. #if !defined(OS_MACOSX) #define MAYBE_ProductName ProductName +#define MAYBE_ProductLogo ProductLogo #else // !defined(OS_MACOSX) #define MAYBE_ProductName DISABLED_ProductName +#define MAYBE_ProductLogo DISABLED_ProductLogo #endif // defined(OS_MACOSX) -TEST(Resources, MAYBE_ProductName) { + +class ResourcesTest : public testing::Test { + protected: + void SetUp() OVERRIDE { + ASSERT_TRUE(LoadResources("en-US")); + } + + void TearDown() OVERRIDE { + ui::ResourceBundle::CleanupSharedInstance(); + } +}; + +TEST_F(ResourcesTest, MAYBE_ProductName) { #if defined(GOOGLE_CHROME_BUILD) std::string expected_product_name = "Chrome Remote Desktop"; #else // defined(GOOGLE_CHROME_BUILD) std::string expected_product_name = "Chromoting"; #endif // !defined(GOOGLE_CHROME_BUILD) - ASSERT_TRUE(LoadResources("en-US")); EXPECT_EQ(expected_product_name, l10n_util::GetStringUTF8(IDR_REMOTING_PRODUCT_NAME)); - ui::ResourceBundle::CleanupSharedInstance(); +} + +TEST_F(ResourcesTest, MAYBE_ProductLogo) { + gfx::Image logo = ui::ResourceBundle::GetSharedInstance().GetImageNamed( + IDR_PRODUCT_LOGO_16); + EXPECT_FALSE(logo.IsEmpty()); } } // namespace remoting |