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

Unified Diff: chrome/browser/themes/theme_service_unittest.cc

Issue 19471005: Add custom default theme support and create a managed user default theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't call NotifyThemeChanged if not ready. Created 7 years, 5 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 | « chrome/browser/themes/theme_service_mac.mm ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4168f965971655ab3981d5091569a709bd04de1d 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* get_theme_supplier(ThemeService* theme_service) {
+ 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(get_theme_supplier(theme_service));
+ EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(),
+ 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(get_theme_supplier(theme_service));
+ EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(),
+ CustomThemeSupplier::MANAGED_USER_THEME);
+}
+#endif
+
+}; // namespace theme_service_internal
« no previous file with comments | « chrome/browser/themes/theme_service_mac.mm ('k') | chrome/browser/ui/gtk/gtk_theme_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698