Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "remoting/base/resources.h" |
| 6 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 7 | #include "remoting/base/string_resources.h" |
| 8 | #include "ui/base/l10n/l10n_util.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 9 | #include "testing/gtest/include/gtest/gtest.h" |
| 10 | |
| 11 | namespace remoting { |
| 12 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 13 | class ResourcesTest : public testing::Test { |
| 14 | protected: |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 15 | ResourcesTest(): resources_available_(false) { |
| 16 | } |
| 17 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 18 | virtual void SetUp() OVERRIDE { |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 19 | resources_available_ = LoadResources("en-US"); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 20 | } |
| 21 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 22 | virtual void TearDown() OVERRIDE { |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 23 | UnloadResources(); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 24 | } |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 25 | |
| 26 | bool resources_available_; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
Ben Murdoch | bb1529c | 2013-08-08 10:24:53 +0100 | [diff] [blame^] | 29 | // TODO(alexeypa): Reenable the test once http://crbug.com/269143 (ChromeOS) and |
| 30 | // http://crbug.com/268043 (MacOS) are fixed. |
| 31 | TEST_F(ResourcesTest, DISABLED_ProductName) { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 32 | #if defined(GOOGLE_CHROME_BUILD) |
| 33 | std::string expected_product_name = "Chrome Remote Desktop"; |
| 34 | #else // defined(GOOGLE_CHROME_BUILD) |
| 35 | std::string expected_product_name = "Chromoting"; |
| 36 | #endif // !defined(GOOGLE_CHROME_BUILD) |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 37 | |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 38 | // Chrome-style i18n is not used on Windows. |
| 39 | #if defined(OS_WIN) |
| 40 | EXPECT_FALSE(resources_available_); |
| 41 | #else |
| 42 | EXPECT_TRUE(resources_available_); |
| 43 | #endif |
| 44 | |
| 45 | if (resources_available_) { |
| 46 | EXPECT_EQ(expected_product_name, |
| 47 | l10n_util::GetStringUTF8(IDR_PRODUCT_NAME)); |
| 48 | } |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | } // namespace remoting |