| OLD | NEW |
| 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 "chrome/browser/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_service_test_base.h" | 11 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 12 #include "chrome/browser/extensions/unpacked_installer.h" | 12 #include "chrome/browser/extensions/unpacked_installer.h" |
| 13 #include "chrome/browser/supervised_user/supervised_user_service.h" | |
| 14 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | |
| 15 #include "chrome/browser/themes/custom_theme_supplier.h" | 13 #include "chrome/browser/themes/custom_theme_supplier.h" |
| 16 #include "chrome/browser/themes/theme_service_factory.h" | 14 #include "chrome/browser/themes/theme_service_factory.h" |
| 17 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 20 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 21 #include "chrome/test/base/testing_profile_manager.h" | 19 #include "chrome/test/base/testing_profile_manager.h" |
| 22 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
| 23 #include "extensions/browser/extension_registry.h" | 21 #include "extensions/browser/extension_registry.h" |
| 24 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 24 |
| 25 #if defined(ENABLE_MANAGED_USERS) |
| 26 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 27 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 28 #endif |
| 29 |
| 27 using extensions::ExtensionRegistry; | 30 using extensions::ExtensionRegistry; |
| 28 | 31 |
| 29 namespace theme_service_internal { | 32 namespace theme_service_internal { |
| 30 | 33 |
| 31 class ThemeServiceTest : public extensions::ExtensionServiceTestBase { | 34 class ThemeServiceTest : public extensions::ExtensionServiceTestBase { |
| 32 public: | 35 public: |
| 33 ThemeServiceTest() : is_supervised_(false), | 36 ThemeServiceTest() : is_supervised_(false), |
| 34 registry_(NULL) {} | 37 registry_(NULL) {} |
| 35 virtual ~ThemeServiceTest() {} | 38 virtual ~ThemeServiceTest() {} |
| 36 | 39 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 EXPECT_TRUE(registry_->GetExtensionById(extension1_id, | 226 EXPECT_TRUE(registry_->GetExtensionById(extension1_id, |
| 224 ExtensionRegistry::DISABLED)); | 227 ExtensionRegistry::DISABLED)); |
| 225 | 228 |
| 226 // 2) Upgrading a disabled theme should not change the current theme. | 229 // 2) Upgrading a disabled theme should not change the current theme. |
| 227 UpdateUnpackedTheme(extension1_id); | 230 UpdateUnpackedTheme(extension1_id); |
| 228 EXPECT_EQ(extension2_id, theme_service->GetThemeID()); | 231 EXPECT_EQ(extension2_id, theme_service->GetThemeID()); |
| 229 EXPECT_TRUE(registry_->GetExtensionById(extension1_id, | 232 EXPECT_TRUE(registry_->GetExtensionById(extension1_id, |
| 230 ExtensionRegistry::DISABLED)); | 233 ExtensionRegistry::DISABLED)); |
| 231 } | 234 } |
| 232 | 235 |
| 236 #if defined(ENABLE_MANAGED_USERS) |
| 233 class ThemeServiceSupervisedUserTest : public ThemeServiceTest { | 237 class ThemeServiceSupervisedUserTest : public ThemeServiceTest { |
| 234 public: | 238 public: |
| 235 ThemeServiceSupervisedUserTest() {} | 239 ThemeServiceSupervisedUserTest() {} |
| 236 virtual ~ThemeServiceSupervisedUserTest() {} | 240 virtual ~ThemeServiceSupervisedUserTest() {} |
| 237 | 241 |
| 238 virtual void SetUp() OVERRIDE { | 242 virtual void SetUp() OVERRIDE { |
| 239 is_supervised_ = true; | 243 is_supervised_ = true; |
| 240 ThemeServiceTest::SetUp(); | 244 ThemeServiceTest::SetUp(); |
| 241 } | 245 } |
| 242 }; | 246 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 260 profile_->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); | 264 profile_->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); |
| 261 ThemeService* theme_service = | 265 ThemeService* theme_service = |
| 262 ThemeServiceFactory::GetForProfile(profile_.get()); | 266 ThemeServiceFactory::GetForProfile(profile_.get()); |
| 263 theme_service->UseDefaultTheme(); | 267 theme_service->UseDefaultTheme(); |
| 264 EXPECT_TRUE(theme_service->UsingDefaultTheme()); | 268 EXPECT_TRUE(theme_service->UsingDefaultTheme()); |
| 265 EXPECT_TRUE(get_theme_supplier(theme_service)); | 269 EXPECT_TRUE(get_theme_supplier(theme_service)); |
| 266 EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(), | 270 EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(), |
| 267 CustomThemeSupplier::SUPERVISED_USER_THEME); | 271 CustomThemeSupplier::SUPERVISED_USER_THEME); |
| 268 } | 272 } |
| 269 #endif | 273 #endif |
| 274 #endif |
| 270 | 275 |
| 271 }; // namespace theme_service_internal | 276 }; // namespace theme_service_internal |
| OLD | NEW |