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

Side by Side Diff: chrome/browser/themes/theme_service_unittest.cc

Issue 284103002: Replace "external_install" boolean parameter with explicit enumeration in ExtensionUninstall method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review feedback. Created 6 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 unified diff | Download patch
OLDNEW
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"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Let the ThemeService uninstall unused themes. 112 // Let the ThemeService uninstall unused themes.
113 base::MessageLoop::current()->RunUntilIdle(); 113 base::MessageLoop::current()->RunUntilIdle();
114 114
115 base::ScopedTempDir temp_dir; 115 base::ScopedTempDir temp_dir;
116 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 116 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
117 const std::string& extension_id = LoadUnpackedThemeAt(temp_dir.path()); 117 const std::string& extension_id = LoadUnpackedThemeAt(temp_dir.path());
118 EXPECT_FALSE(theme_service->UsingDefaultTheme()); 118 EXPECT_FALSE(theme_service->UsingDefaultTheme());
119 EXPECT_EQ(extension_id, theme_service->GetThemeID()); 119 EXPECT_EQ(extension_id, theme_service->GetThemeID());
120 120
121 // Now uninstall the extension, should revert to the default theme. 121 // Now uninstall the extension, should revert to the default theme.
122 service_->UninstallExtension(extension_id, false, NULL); 122 service_->UninstallExtension(
123 extension_id, ExtensionService::UNINSTALL_REASON_DEFAULT, NULL);
123 EXPECT_TRUE(theme_service->UsingDefaultTheme()); 124 EXPECT_TRUE(theme_service->UsingDefaultTheme());
124 } 125 }
125 126
126 // Test that a theme extension is disabled when not in use. A theme may be 127 // Test that a theme extension is disabled when not in use. A theme may be
127 // installed but not in use if it there is an infobar to revert to the previous 128 // installed but not in use if it there is an infobar to revert to the previous
128 // theme. 129 // theme.
129 TEST_F(ThemeServiceTest, DisableUnusedTheme) { 130 TEST_F(ThemeServiceTest, DisableUnusedTheme) {
130 ThemeService* theme_service = 131 ThemeService* theme_service =
131 ThemeServiceFactory::GetForProfile(profile_.get()); 132 ThemeServiceFactory::GetForProfile(profile_.get());
132 theme_service->UseDefaultTheme(); 133 theme_service->UseDefaultTheme();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ThemeServiceFactory::GetForProfile(profile_.get()); 263 ThemeServiceFactory::GetForProfile(profile_.get());
263 theme_service->UseDefaultTheme(); 264 theme_service->UseDefaultTheme();
264 EXPECT_TRUE(theme_service->UsingDefaultTheme()); 265 EXPECT_TRUE(theme_service->UsingDefaultTheme());
265 EXPECT_TRUE(get_theme_supplier(theme_service)); 266 EXPECT_TRUE(get_theme_supplier(theme_service));
266 EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(), 267 EXPECT_EQ(get_theme_supplier(theme_service)->get_theme_type(),
267 CustomThemeSupplier::SUPERVISED_USER_THEME); 268 CustomThemeSupplier::SUPERVISED_USER_THEME);
268 } 269 }
269 #endif 270 #endif
270 271
271 }; // namespace theme_service_internal 272 }; // namespace theme_service_internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698