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

Side by Side Diff: remoting/base/resources_unittest.cc

Issue 21059003: Localized Chromoting Host on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/base/resources_mac.mm ('k') | remoting/base/resources_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/base/resources.h" 5 #include "remoting/base/resources.h"
6 6
7 #include "remoting/base/common_resources.h"
8 #include "remoting/base/string_resources.h" 7 #include "remoting/base/string_resources.h"
9 #include "ui/base/l10n/l10n_util.h" 8 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/base/resource/resource_bundle.h"
11 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
12 10
13 namespace remoting { 11 namespace remoting {
14 12
15 // TODO(sergeyu): Resources loading doesn't work yet on OSX. Fix it and enable
16 // the test.
17 #if !defined(OS_MACOSX)
18 #define MAYBE_ProductName ProductName
19 #define MAYBE_ProductLogo ProductLogo
20 #else // !defined(OS_MACOSX)
21 #define MAYBE_ProductName DISABLED_ProductName
22 #define MAYBE_ProductLogo DISABLED_ProductLogo
23 #endif // defined(OS_MACOSX)
24
25 class ResourcesTest : public testing::Test { 13 class ResourcesTest : public testing::Test {
26 protected: 14 protected:
15 ResourcesTest(): resources_available_(false) {
16 }
17
27 virtual void SetUp() OVERRIDE { 18 virtual void SetUp() OVERRIDE {
28 ASSERT_TRUE(LoadResources("en-US")); 19 resources_available_ = LoadResources("en-US");
29 } 20 }
30 21
31 virtual void TearDown() OVERRIDE { 22 virtual void TearDown() OVERRIDE {
32 ui::ResourceBundle::CleanupSharedInstance(); 23 UnloadResources();
33 } 24 }
25
26 bool resources_available_;
34 }; 27 };
35 28
36 TEST_F(ResourcesTest, MAYBE_ProductName) { 29 TEST_F(ResourcesTest, ProductName) {
37 #if defined(GOOGLE_CHROME_BUILD) 30 #if defined(GOOGLE_CHROME_BUILD)
38 std::string expected_product_name = "Chrome Remote Desktop"; 31 std::string expected_product_name = "Chrome Remote Desktop";
39 #else // defined(GOOGLE_CHROME_BUILD) 32 #else // defined(GOOGLE_CHROME_BUILD)
40 std::string expected_product_name = "Chromoting"; 33 std::string expected_product_name = "Chromoting";
41 #endif // !defined(GOOGLE_CHROME_BUILD) 34 #endif // !defined(GOOGLE_CHROME_BUILD)
42 EXPECT_EQ(expected_product_name,
43 l10n_util::GetStringUTF8(IDR_PRODUCT_NAME));
44 }
45 35
46 TEST_F(ResourcesTest, MAYBE_ProductLogo) { 36 // Chrome-style i18n is not used on Windows.
47 gfx::Image logo16 = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 37 #if defined(OS_WIN)
48 IDR_PRODUCT_LOGO_16); 38 EXPECT_FALSE(resources_available_);
49 EXPECT_FALSE(logo16.IsEmpty()); 39 #else
50 gfx::Image logo32 = ui::ResourceBundle::GetSharedInstance().GetImageNamed( 40 EXPECT_TRUE(resources_available_);
51 IDR_PRODUCT_LOGO_32); 41 #endif
52 EXPECT_FALSE(logo32.IsEmpty()); 42
43 if (resources_available_) {
44 EXPECT_EQ(expected_product_name,
45 l10n_util::GetStringUTF8(IDR_PRODUCT_NAME));
46 }
53 } 47 }
54 48
55 } // namespace remoting 49 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/resources_mac.mm ('k') | remoting/base/resources_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698