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_unittest.h" | 10 #include "chrome/browser/extensions/extension_service_unittest.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // Let the ThemeService uninstall unused themes. | 111 // Let the ThemeService uninstall unused themes. |
112 base::MessageLoop::current()->RunUntilIdle(); | 112 base::MessageLoop::current()->RunUntilIdle(); |
113 | 113 |
114 base::ScopedTempDir temp_dir; | 114 base::ScopedTempDir temp_dir; |
115 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 115 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
116 const std::string& extension_id = LoadUnpackedThemeAt(temp_dir.path()); | 116 const std::string& extension_id = LoadUnpackedThemeAt(temp_dir.path()); |
117 EXPECT_FALSE(theme_service->UsingDefaultTheme()); | 117 EXPECT_FALSE(theme_service->UsingDefaultTheme()); |
118 EXPECT_EQ(extension_id, theme_service->GetThemeID()); | 118 EXPECT_EQ(extension_id, theme_service->GetThemeID()); |
119 | 119 |
120 // Now uninstall the extension, should revert to the default theme. | 120 // Now uninstall the extension, should revert to the default theme. |
121 service_->UninstallExtension(extension_id, false, NULL); | 121 service_->UninstallExtension( |
| 122 extension_id, ExtensionService::kUninstallReasonDefault, NULL); |
122 EXPECT_TRUE(theme_service->UsingDefaultTheme()); | 123 EXPECT_TRUE(theme_service->UsingDefaultTheme()); |
123 } | 124 } |
124 | 125 |
125 // Test that a theme extension is disabled when not in use. A theme may be | 126 // Test that a theme extension is disabled when not in use. A theme may be |
126 // installed but not in use if it there is an infobar to revert to the previous | 127 // installed but not in use if it there is an infobar to revert to the previous |
127 // theme. | 128 // theme. |
128 TEST_F(ThemeServiceTest, DisableUnusedTheme) { | 129 TEST_F(ThemeServiceTest, DisableUnusedTheme) { |
129 ThemeService* theme_service = | 130 ThemeService* theme_service = |
130 ThemeServiceFactory::GetForProfile(profile_.get()); | 131 ThemeServiceFactory::GetForProfile(profile_.get()); |
131 theme_service->UseDefaultTheme(); | 132 theme_service->UseDefaultTheme(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 ThemeServiceFactory::GetForProfile(profile_.get()); | 261 ThemeServiceFactory::GetForProfile(profile_.get()); |
261 theme_service->UseDefaultTheme(); | 262 theme_service->UseDefaultTheme(); |
262 EXPECT_TRUE(theme_service->UsingDefaultTheme()); | 263 EXPECT_TRUE(theme_service->UsingDefaultTheme()); |
263 EXPECT_TRUE(get_theme_supplier(theme_service)); | 264 EXPECT_TRUE(get_theme_supplier(theme_service)); |
264 EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(), | 265 EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(), |
265 CustomThemeSupplier::MANAGED_USER_THEME); | 266 CustomThemeSupplier::MANAGED_USER_THEME); |
266 } | 267 } |
267 #endif | 268 #endif |
268 | 269 |
269 }; // namespace theme_service_internal | 270 }; // namespace theme_service_internal |
OLD | NEW |