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

Side by Side Diff: chrome/browser/sync/glue/theme_util_unittest.cc

Issue 6813116: Revert 81277 - Profile shouldn't own DesktopNotificationService.DesktopNotificationService is now... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sync/glue/theme_util.h" 5 #include "chrome/browser/sync/glue/theme_util.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" 10 #include "chrome/browser/sync/protocol/theme_specifics.pb.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 public: 95 public:
96 MOCK_METHOD0(SetNativeTheme, void()); 96 MOCK_METHOD0(SetNativeTheme, void());
97 MOCK_METHOD0(UseDefaultTheme, void()); 97 MOCK_METHOD0(UseDefaultTheme, void());
98 MOCK_CONST_METHOD0(GetThemeID, std::string()); 98 MOCK_CONST_METHOD0(GetThemeID, std::string());
99 }; 99 };
100 100
101 TEST_F(ThemeUtilTest, SetCurrentThemeDefaultTheme) { 101 TEST_F(ThemeUtilTest, SetCurrentThemeDefaultTheme) {
102 sync_pb::ThemeSpecifics theme_specifics; 102 sync_pb::ThemeSpecifics theme_specifics;
103 TestingProfile profile; 103 TestingProfile profile;
104 MockThemeService* mock_theme_service = new MockThemeService; 104 MockThemeService* mock_theme_service = new MockThemeService;
105 ThemeServiceFactory::GetInstance()->ForceAssociationBetween(&profile, 105 ThemeServiceFactory::ForceAssociationBetween(&profile, mock_theme_service);
106 mock_theme_service);
107 106
108 EXPECT_CALL(*mock_theme_service, UseDefaultTheme()).Times(1); 107 EXPECT_CALL(*mock_theme_service, UseDefaultTheme()).Times(1);
109 108
110 SetCurrentThemeFromThemeSpecifics(theme_specifics, &profile); 109 SetCurrentThemeFromThemeSpecifics(theme_specifics, &profile);
111 } 110 }
112 111
113 TEST_F(ThemeUtilTest, SetCurrentThemeSystemTheme) { 112 TEST_F(ThemeUtilTest, SetCurrentThemeSystemTheme) {
114 sync_pb::ThemeSpecifics theme_specifics; 113 sync_pb::ThemeSpecifics theme_specifics;
115 theme_specifics.set_use_system_theme_by_default(true); 114 theme_specifics.set_use_system_theme_by_default(true);
116 115
117 TestingProfile profile; 116 TestingProfile profile;
118 MockThemeService* mock_theme_service = new MockThemeService; 117 MockThemeService* mock_theme_service = new MockThemeService;
119 ThemeServiceFactory::GetInstance()->ForceAssociationBetween(&profile, 118 ThemeServiceFactory::ForceAssociationBetween(&profile, mock_theme_service);
120 mock_theme_service);
121 119
122 EXPECT_CALL(*mock_theme_service, SetNativeTheme()).Times(1); 120 EXPECT_CALL(*mock_theme_service, SetNativeTheme()).Times(1);
123 121
124 SetCurrentThemeFromThemeSpecifics(theme_specifics, &profile); 122 SetCurrentThemeFromThemeSpecifics(theme_specifics, &profile);
125 } 123 }
126 124
127 // TODO(akalin): Make ExtensionService/ExtensionUpdater testable 125 // TODO(akalin): Make ExtensionService/ExtensionUpdater testable
128 // enough to be able to write a unittest for SetCurrentTheme for a 126 // enough to be able to write a unittest for SetCurrentTheme for a
129 // custom theme. 127 // custom theme.
130 128
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 EXPECT_TRUE(theme_specifics.has_use_system_theme_by_default()); 208 EXPECT_TRUE(theme_specifics.has_use_system_theme_by_default());
211 EXPECT_FALSE(theme_specifics.use_system_theme_by_default()); 209 EXPECT_FALSE(theme_specifics.use_system_theme_by_default());
212 EXPECT_EQ(kThemeName, theme_specifics.custom_theme_name()); 210 EXPECT_EQ(kThemeName, theme_specifics.custom_theme_name());
213 EXPECT_EQ(extension->id(), theme_specifics.custom_theme_id()); 211 EXPECT_EQ(extension->id(), theme_specifics.custom_theme_id());
214 EXPECT_EQ(kThemeUpdateUrl, theme_specifics.custom_theme_update_url()); 212 EXPECT_EQ(kThemeUpdateUrl, theme_specifics.custom_theme_update_url());
215 } 213 }
216 214
217 TEST_F(ThemeUtilTest, SetCurrentThemeIfNecessaryDefaultThemeNotNecessary) { 215 TEST_F(ThemeUtilTest, SetCurrentThemeIfNecessaryDefaultThemeNotNecessary) {
218 TestingProfile profile; 216 TestingProfile profile;
219 MockThemeService* mock_theme_service = new MockThemeService; 217 MockThemeService* mock_theme_service = new MockThemeService;
220 ThemeServiceFactory::GetInstance()->ForceAssociationBetween(&profile, 218 ThemeServiceFactory::ForceAssociationBetween(&profile, mock_theme_service);
221 mock_theme_service);
222 219
223 EXPECT_CALL(*mock_theme_service, GetThemeID()).WillRepeatedly(Return( 220 EXPECT_CALL(*mock_theme_service, GetThemeID()).WillRepeatedly(Return(
224 ThemeService::kDefaultThemeID)); 221 ThemeService::kDefaultThemeID));
225 222
226 // TODO(akalin): Mock out call to GetPrefs() under TOOLKIT_USES_GTK. 223 // TODO(akalin): Mock out call to GetPrefs() under TOOLKIT_USES_GTK.
227 224
228 sync_pb::ThemeSpecifics theme_specifics; 225 sync_pb::ThemeSpecifics theme_specifics;
229 SetCurrentThemeFromThemeSpecificsIfNecessary(theme_specifics, 226 SetCurrentThemeFromThemeSpecificsIfNecessary(theme_specifics,
230 &profile); 227 &profile);
231 } 228 }
232 229
233 } // namespace 230 } // namespace
234 231
235 } // namespace browser_sync 232 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_keyed_service_factory.cc ('k') | chrome/browser/themes/theme_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698