Chromium Code Reviews| Index: chrome/browser/themes/theme_service_unittest.cc |
| diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc |
| index 803b288bf9e37f04bda6a01fb3a0041b7034f116..4db46f1dae36a75de7e07c1867602fd18a90bed9 100644 |
| --- a/chrome/browser/themes/theme_service_unittest.cc |
| +++ b/chrome/browser/themes/theme_service_unittest.cc |
| @@ -6,13 +6,15 @@ |
| #include "base/json/json_reader.h" |
| #include "chrome/browser/extensions/extension_service_unittest.h" |
| +#include "chrome/browser/themes/custom_theme_supplier.h" |
| #include "chrome/browser/themes/theme_service_factory.h" |
| #include "chrome/common/extensions/extension.h" |
| #include "chrome/common/extensions/extension_manifest_constants.h" |
| +#include "chrome/common/pref_names.h" |
| #include "chrome/test/base/testing_profile.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -namespace { |
| +namespace theme_service_internal { |
| class ThemeServiceTest : public ExtensionServiceTestBase { |
| public: |
| @@ -39,6 +41,10 @@ class ThemeServiceTest : public ExtensionServiceTestBase { |
| ExtensionServiceTestBase::SetUp(); |
| InitializeEmptyExtensionService(); |
| } |
| + |
| + const CustomThemeSupplier* GetThemeSupplier(ThemeService* theme_service) { |
|
Elliot Glaysher
2013/07/23 19:57:31
unix_hacker_case().
Adrian Kuegel
2013/07/24 12:31:35
Done.
|
| + return theme_service->get_theme_supplier(); |
| + } |
| }; |
| // Installs then uninstalls a theme and makes sure that the ThemeService |
| @@ -85,4 +91,32 @@ TEST_F(ThemeServiceTest, ThemeUpgrade) { |
| EXPECT_FALSE(theme_service->UsingDefaultTheme()); |
| } |
| -}; // namespace |
| +// Checks that managed users have their own default theme. |
| +TEST_F(ThemeServiceTest, ManagedUserThemeReplacesDefaultTheme) { |
| + profile_->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true); |
| + ThemeService* theme_service = |
| + ThemeServiceFactory::GetForProfile(profile_.get()); |
| + theme_service->UseDefaultTheme(); |
| + EXPECT_TRUE(theme_service->UsingDefaultTheme()); |
| + EXPECT_TRUE(GetThemeSupplier(theme_service)); |
| + EXPECT_EQ(GetThemeSupplier(theme_service)->GetThemeType(), |
| + CustomThemeSupplier::MANAGED_USER_THEME); |
| +} |
| + |
| +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| +// Checks that managed users don't use the system theme even if it is the |
| +// default. The system theme is only available on Linux. |
| +TEST_F(ThemeServiceTest, ManagedUserThemeReplacesNativeTheme) { |
| + profile_->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true); |
| + profile_->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); |
| + ThemeService* theme_service = |
| + ThemeServiceFactory::GetForProfile(profile_.get()); |
| + theme_service->UseDefaultTheme(); |
| + EXPECT_TRUE(theme_service->UsingDefaultTheme()); |
| + EXPECT_TRUE(GetThemeSupplier(theme_service)); |
| + EXPECT_EQ(GetThemeSupplier(theme_service)->GetThemeType(), |
| + CustomThemeSupplier::MANAGED_USER_THEME); |
| +} |
| +#endif |
| + |
| +}; // namespace theme_service_internal |