OLD | NEW |
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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/extensions/apps_promo.h" | 7 #include "chrome/browser/extensions/apps_promo.h" |
8 #include "chrome/browser/prefs/browser_prefs.h" | 8 #include "chrome/browser/prefs/browser_prefs.h" |
9 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" | 9 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 &promo_just_expired)); | 101 &promo_just_expired)); |
102 | 102 |
103 // We should be able to disable the web store as well. | 103 // We should be able to disable the web store as well. |
104 AppsPromo::SetWebStoreSupportedForLocale(false); | 104 AppsPromo::SetWebStoreSupportedForLocale(false); |
105 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); | 105 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); |
106 EXPECT_FALSE(apps_promo()->ShouldShowAppLauncher(installed_ids)); | 106 EXPECT_FALSE(apps_promo()->ShouldShowAppLauncher(installed_ids)); |
107 EXPECT_FALSE(apps_promo()->ShouldShowPromo(installed_ids, | 107 EXPECT_FALSE(apps_promo()->ShouldShowPromo(installed_ids, |
108 &promo_just_expired)); | 108 &promo_just_expired)); |
109 | 109 |
110 // Once the promo is set, we show both the promo and app launcher. | 110 // Once the promo is set, we show both the promo and app launcher. |
111 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 111 AppsPromo::PromoData promo_data(kPromoId, kPromoHeader, kPromoButton, |
112 GURL(kPromoLink), kPromoExpire, GURL(""), | 112 GURL(kPromoLink), kPromoExpire, GURL(""), |
113 kPromoUserGroup); | 113 kPromoUserGroup); |
| 114 AppsPromo::SetPromo(promo_data); |
114 AppsPromo::SetWebStoreSupportedForLocale(true); | 115 AppsPromo::SetWebStoreSupportedForLocale(true); |
115 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 116 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
116 EXPECT_TRUE(apps_promo()->ShouldShowAppLauncher(installed_ids)); | 117 EXPECT_TRUE(apps_promo()->ShouldShowAppLauncher(installed_ids)); |
117 EXPECT_TRUE(apps_promo()->ShouldShowPromo(installed_ids, | 118 EXPECT_TRUE(apps_promo()->ShouldShowPromo(installed_ids, |
118 &promo_just_expired)); | 119 &promo_just_expired)); |
119 EXPECT_FALSE(promo_just_expired); | 120 EXPECT_FALSE(promo_just_expired); |
120 | 121 |
121 // Now install an app and the promo should not be shown. | 122 // Now install an app and the promo should not be shown. |
122 installed_ids.insert(*(default_app_ids.begin())); | 123 installed_ids.insert(*(default_app_ids.begin())); |
123 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 124 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
(...skipping 17 matching lines...) Expand all Loading... |
141 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 142 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
142 EXPECT_TRUE(apps_promo()->ShouldShowAppLauncher(installed_ids)); | 143 EXPECT_TRUE(apps_promo()->ShouldShowAppLauncher(installed_ids)); |
143 EXPECT_TRUE(apps_promo()->ShouldShowPromo(installed_ids, | 144 EXPECT_TRUE(apps_promo()->ShouldShowPromo(installed_ids, |
144 &promo_just_expired)); | 145 &promo_just_expired)); |
145 EXPECT_FALSE(promo_just_expired); | 146 EXPECT_FALSE(promo_just_expired); |
146 } | 147 } |
147 | 148 |
148 // Tests get and set of promo content. | 149 // Tests get and set of promo content. |
149 TEST_F(ExtensionAppsPromo, PromoPrefs) { | 150 TEST_F(ExtensionAppsPromo, PromoPrefs) { |
150 // Store a promo.... | 151 // Store a promo.... |
151 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 152 AppsPromo::PromoData promo_data(kPromoId, kPromoHeader, kPromoButton, |
152 GURL(kPromoLink), kPromoExpire, GURL(""), | 153 GURL(kPromoLink), kPromoExpire, GURL(""), |
153 kPromoUserGroup); | 154 kPromoUserGroup); |
| 155 AppsPromo::SetPromo(promo_data); |
154 | 156 |
155 // ... then make sure AppsPromo can access it. | 157 // ... then make sure AppsPromo can access it. |
156 EXPECT_EQ(kPromoId, AppsPromo::GetPromoId()); | 158 AppsPromo::PromoData actual_data = AppsPromo::GetPromo(); |
157 EXPECT_EQ(kPromoHeader, AppsPromo::GetPromoHeaderText()); | 159 EXPECT_EQ(kPromoId, actual_data.id); |
158 EXPECT_EQ(kPromoButton, AppsPromo::GetPromoButtonText()); | 160 EXPECT_EQ(kPromoHeader, actual_data.header); |
159 EXPECT_EQ(GURL(kPromoLink), AppsPromo::GetPromoLink()); | 161 EXPECT_EQ(kPromoButton, actual_data.button); |
160 EXPECT_EQ(kPromoExpire, AppsPromo::GetPromoExpireText()); | 162 EXPECT_EQ(GURL(kPromoLink), actual_data.link); |
161 EXPECT_EQ(kPromoUserGroup, AppsPromo::GetPromoUserGroup()); | 163 EXPECT_EQ(kPromoExpire, actual_data.expire); |
| 164 EXPECT_EQ(kPromoUserGroup, actual_data.user_group); |
162 // The promo logo should be the default value. | 165 // The promo logo should be the default value. |
163 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromoLogo()); | 166 EXPECT_EQ(GURL(kPromoLogo), actual_data.logo); |
164 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 167 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
165 | 168 |
166 AppsPromo::ClearPromo(); | 169 AppsPromo::ClearPromo(); |
167 EXPECT_EQ("", AppsPromo::GetPromoId()); | 170 actual_data = AppsPromo::GetPromo(); |
168 EXPECT_EQ("", AppsPromo::GetPromoHeaderText()); | 171 EXPECT_EQ("", actual_data.id); |
169 EXPECT_EQ("", AppsPromo::GetPromoButtonText()); | 172 EXPECT_EQ("", actual_data.header); |
170 EXPECT_EQ(GURL(""), AppsPromo::GetPromoLink()); | 173 EXPECT_EQ("", actual_data.button); |
171 EXPECT_EQ("", AppsPromo::GetPromoExpireText()); | 174 EXPECT_EQ(GURL(""), actual_data.link); |
172 EXPECT_EQ(AppsPromo::USERS_NONE, AppsPromo::GetPromoUserGroup()); | 175 EXPECT_EQ("", actual_data.expire); |
173 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromoLogo()); | 176 EXPECT_EQ(AppsPromo::USERS_NONE, actual_data.user_group); |
| 177 EXPECT_EQ(GURL(kPromoLogo), actual_data.logo); |
174 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); | 178 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); |
175 | 179 |
176 // Make sure we can set the logo to something other than the default. | 180 // Make sure we can set the logo to something other than the default. |
177 std::string promo_logo = "data:image/png;base64,iVBORw0kGgoAAAN"; | 181 std::string promo_logo = "data:image/png;base64,iVBORw0kGgoAAAN"; |
178 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 182 promo_data.logo = GURL(promo_logo); |
179 GURL(kPromoLink), kPromoExpire, GURL(promo_logo), | 183 AppsPromo::SetPromo(promo_data); |
180 kPromoUserGroup); | 184 EXPECT_EQ(GURL(promo_logo), AppsPromo::GetPromo().logo); |
181 EXPECT_EQ(GURL(promo_logo), AppsPromo::GetPromoLogo()); | |
182 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 185 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
183 | 186 |
184 // Verify that the default is returned instead of http or https URLs. | 187 // Verify that the default is returned instead of HTTP or HTTPS URLs. |
185 promo_logo = "http://google.com/logo.png"; | 188 promo_data.logo = GURL("http://google.com/logo.png"); |
186 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 189 AppsPromo::SetPromo(promo_data); |
187 GURL(kPromoLink), kPromoExpire, GURL(promo_logo), | 190 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromo().logo); |
188 kPromoUserGroup); | |
189 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromoLogo()); | |
190 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 191 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
191 | 192 |
192 promo_logo = "https://google.com/logo.png"; | 193 promo_data.logo = GURL("https://google.com/logo.png"); |
193 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 194 AppsPromo::SetPromo(promo_data); |
194 GURL(kPromoLink), kPromoExpire, GURL(promo_logo), | 195 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromo().logo); |
195 kPromoUserGroup); | |
196 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromoLogo()); | |
197 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 196 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
198 | 197 |
199 // Try an invalid URL. | 198 // Try an invalid URL. |
200 promo_logo = "sldkfjlsdn"; | 199 promo_data.logo = GURL("sldkfjlsdn"); |
201 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 200 AppsPromo::SetPromo(promo_data); |
202 GURL(kPromoLink), kPromoExpire, GURL(promo_logo), | 201 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromo().logo); |
203 kPromoUserGroup); | |
204 EXPECT_EQ(GURL(kPromoLogo), AppsPromo::GetPromoLogo()); | |
205 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); | 202 EXPECT_TRUE(AppsPromo::IsPromoSupportedForLocale()); |
206 | 203 |
207 // Try the web store supported flag. | 204 // Try the web store supported flag. |
208 EXPECT_FALSE(AppsPromo::IsWebStoreSupportedForLocale()); | 205 EXPECT_FALSE(AppsPromo::IsWebStoreSupportedForLocale()); |
209 AppsPromo::SetWebStoreSupportedForLocale(true); | 206 AppsPromo::SetWebStoreSupportedForLocale(true); |
210 EXPECT_TRUE(AppsPromo::IsWebStoreSupportedForLocale()); | 207 EXPECT_TRUE(AppsPromo::IsWebStoreSupportedForLocale()); |
211 AppsPromo::SetWebStoreSupportedForLocale(false); | 208 AppsPromo::SetWebStoreSupportedForLocale(false); |
212 EXPECT_FALSE(AppsPromo::IsWebStoreSupportedForLocale()); | 209 EXPECT_FALSE(AppsPromo::IsWebStoreSupportedForLocale()); |
| 210 |
| 211 // Try setting and getting the source logo URL. |
| 212 GURL expected_source("https://www.google.com/images/test.png"); |
| 213 AppsPromo::SetSourcePromoLogoURL(expected_source); |
| 214 EXPECT_EQ(expected_source, AppsPromo::GetSourcePromoLogoURL()); |
213 } | 215 } |
214 | 216 |
215 // Tests maximizing the promo for USERS_NONE. | 217 // Tests maximizing the promo for USERS_NONE. |
216 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersNone) { | 218 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersNone) { |
217 // Verify that the apps section is not already maximized. | 219 // Verify that the apps section is not already maximized. |
218 ExpectAppsSectionMaximized(prefs(), false); | 220 ExpectAppsSectionMaximized(prefs(), false); |
219 | 221 |
220 // The promo shouldn't maximize for anyone. | 222 // The promo shouldn't maximize for anyone. |
221 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 223 AppsPromo::PromoData promo_data(kPromoId, kPromoHeader, kPromoButton, |
222 GURL(kPromoLink), kPromoExpire, GURL(""), | 224 GURL(kPromoLink), kPromoExpire, GURL(""), |
223 AppsPromo::USERS_NONE); | 225 AppsPromo::USERS_NONE); |
| 226 AppsPromo::SetPromo(promo_data); |
224 apps_promo()->MaximizeAppsIfNecessary(); | 227 apps_promo()->MaximizeAppsIfNecessary(); |
225 ExpectAppsSectionMaximized(prefs(), false); | 228 ExpectAppsSectionMaximized(prefs(), false); |
226 | 229 |
227 // The promo still shouldn't maximize if we change it's ID. | 230 // The promo still shouldn't maximize if we change it's ID. |
228 AppsPromo::SetPromo("lkksdf", kPromoHeader, kPromoButton, | 231 promo_data.id = "lkksdf"; |
229 GURL(kPromoLink), kPromoExpire, GURL(""), | 232 AppsPromo::SetPromo(promo_data); |
230 AppsPromo::USERS_NONE); | |
231 apps_promo()->MaximizeAppsIfNecessary(); | 233 apps_promo()->MaximizeAppsIfNecessary(); |
232 ExpectAppsSectionMaximized(prefs(), false); | 234 ExpectAppsSectionMaximized(prefs(), false); |
233 } | 235 } |
234 | 236 |
235 // Tests maximizing the promo for USERS_EXISTING. | 237 // Tests maximizing the promo for USERS_EXISTING. |
236 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersExisting) { | 238 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersExisting) { |
237 // Verify that the apps section is not already maximized. | 239 // Verify that the apps section is not already maximized. |
238 ExpectAppsSectionMaximized(prefs(), false); | 240 ExpectAppsSectionMaximized(prefs(), false); |
239 | 241 |
240 // Set the promo content. | 242 // Set the promo content. |
241 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 243 AppsPromo::PromoData promo_data(kPromoId, kPromoHeader, kPromoButton, |
242 GURL(kPromoLink), kPromoExpire, GURL(""), | 244 GURL(kPromoLink), kPromoExpire, GURL(""), |
243 AppsPromo::USERS_EXISTING); | 245 AppsPromo::USERS_EXISTING); |
244 | 246 AppsPromo::SetPromo(promo_data); |
245 // This is a new user so the apps section shouldn't maximize. | 247 // This is a new user so the apps section shouldn't maximize. |
246 apps_promo()->MaximizeAppsIfNecessary(); | 248 apps_promo()->MaximizeAppsIfNecessary(); |
247 ExpectAppsSectionMaximized(prefs(), false); | 249 ExpectAppsSectionMaximized(prefs(), false); |
248 | 250 |
249 | |
250 // Set a new promo and now it should maximize. | 251 // Set a new promo and now it should maximize. |
251 AppsPromo::SetPromo("lksdf", kPromoHeader, kPromoButton, | 252 promo_data.id = "lksdf"; |
252 GURL(kPromoLink), kPromoExpire, GURL(""), | 253 AppsPromo::SetPromo(promo_data); |
253 AppsPromo::USERS_EXISTING); | |
254 | 254 |
255 apps_promo()->MaximizeAppsIfNecessary(); | 255 apps_promo()->MaximizeAppsIfNecessary(); |
256 ExpectAppsSectionMaximized(prefs(), true); | 256 ExpectAppsSectionMaximized(prefs(), true); |
257 | 257 |
258 apps_promo()->HidePromo(); | 258 apps_promo()->HidePromo(); |
259 ExpectAppsPromoHidden(prefs()); | 259 ExpectAppsPromoHidden(prefs()); |
260 } | 260 } |
261 | 261 |
262 // Tests maximizing the promo for USERS_NEW. | 262 // Tests maximizing the promo for USERS_NEW. |
263 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersNew) { | 263 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersNew) { |
264 // Verify that the apps section is not already maximized. | 264 // Verify that the apps section is not already maximized. |
265 ExpectAppsSectionMaximized(prefs(), false); | 265 ExpectAppsSectionMaximized(prefs(), false); |
266 | 266 |
267 // The promo should maximize for new users. | 267 // The promo should maximize for new users. |
268 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 268 AppsPromo::PromoData promo_data(kPromoId, kPromoHeader, kPromoButton, |
269 GURL(kPromoLink), kPromoExpire, GURL(""), | 269 GURL(kPromoLink), kPromoExpire, GURL(""), |
270 AppsPromo::USERS_NEW); | 270 AppsPromo::USERS_NEW); |
| 271 AppsPromo::SetPromo(promo_data); |
271 apps_promo()->MaximizeAppsIfNecessary(); | 272 apps_promo()->MaximizeAppsIfNecessary(); |
272 ExpectAppsSectionMaximized(prefs(), true); | 273 ExpectAppsSectionMaximized(prefs(), true); |
273 | 274 |
274 // Try hiding the promo. | 275 // Try hiding the promo. |
275 apps_promo()->HidePromo(); | 276 apps_promo()->HidePromo(); |
276 ExpectAppsPromoHidden(prefs()); | 277 ExpectAppsPromoHidden(prefs()); |
277 | 278 |
278 // The same promo should not maximize twice. | 279 // The same promo should not maximize twice. |
279 apps_promo()->MaximizeAppsIfNecessary(); | 280 apps_promo()->MaximizeAppsIfNecessary(); |
280 ExpectAppsSectionMaximized(prefs(), false); | 281 ExpectAppsSectionMaximized(prefs(), false); |
281 | 282 |
282 // Another promo targetting new users should not maximize. | 283 // Another promo targetting new users should not maximize. |
283 AppsPromo::SetPromo("lksdf", kPromoHeader, kPromoButton, | 284 promo_data.id = "lksdf"; |
284 GURL(kPromoLink), kPromoExpire, GURL(""), | 285 AppsPromo::SetPromo(promo_data); |
285 AppsPromo::USERS_NEW); | |
286 apps_promo()->MaximizeAppsIfNecessary(); | 286 apps_promo()->MaximizeAppsIfNecessary(); |
287 ExpectAppsSectionMaximized(prefs(), false); | 287 ExpectAppsSectionMaximized(prefs(), false); |
288 } | 288 } |
289 | 289 |
290 // Tests maximizing the promo for USERS_NEW | USERS_EXISTING. | 290 // Tests maximizing the promo for USERS_NEW | USERS_EXISTING. |
291 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersAll) { | 291 TEST_F(ExtensionAppsPromo, UpdatePromoFocus_UsersAll) { |
292 // Verify that the apps section is not already maximized. | 292 // Verify that the apps section is not already maximized. |
293 ExpectAppsSectionMaximized(prefs(), false); | 293 ExpectAppsSectionMaximized(prefs(), false); |
294 | 294 |
295 // The apps section should maximize for all users. | 295 // The apps section should maximize for all users. |
296 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 296 AppsPromo::PromoData promo_data( |
297 GURL(kPromoLink), kPromoExpire, GURL(""), | 297 kPromoId, kPromoHeader, kPromoButton, GURL(kPromoLink), kPromoExpire, |
298 AppsPromo::USERS_NEW | AppsPromo::USERS_EXISTING); | 298 GURL(""), AppsPromo::USERS_NEW | AppsPromo::USERS_EXISTING); |
| 299 AppsPromo::SetPromo(promo_data); |
299 apps_promo()->MaximizeAppsIfNecessary(); | 300 apps_promo()->MaximizeAppsIfNecessary(); |
300 ExpectAppsSectionMaximized(prefs(), true); | 301 ExpectAppsSectionMaximized(prefs(), true); |
301 | 302 |
302 apps_promo()->HidePromo(); | 303 apps_promo()->HidePromo(); |
303 ExpectAppsPromoHidden(prefs()); | 304 ExpectAppsPromoHidden(prefs()); |
304 | 305 |
305 // The same promo should not maximize twice. | 306 // The same promo should not maximize twice. |
306 apps_promo()->MaximizeAppsIfNecessary(); | 307 apps_promo()->MaximizeAppsIfNecessary(); |
307 ExpectAppsSectionMaximized(prefs(), false); | 308 ExpectAppsSectionMaximized(prefs(), false); |
308 | 309 |
309 // A promo with a new ID should maximize though. | 310 // A promo with a new ID should maximize though. |
310 AppsPromo::SetPromo("lkksdf", kPromoHeader, kPromoButton, | 311 promo_data.id = "lkksdf"; |
311 GURL(kPromoLink), kPromoExpire, GURL(""), | 312 AppsPromo::SetPromo(promo_data); |
312 AppsPromo::USERS_NEW | AppsPromo::USERS_EXISTING); | |
313 apps_promo()->MaximizeAppsIfNecessary(); | 313 apps_promo()->MaximizeAppsIfNecessary(); |
314 ExpectAppsSectionMaximized(prefs(), true); | 314 ExpectAppsSectionMaximized(prefs(), true); |
315 } | 315 } |
316 | 316 |
317 TEST_F(ExtensionAppsPromo, PromoHiddenByPref) { | 317 TEST_F(ExtensionAppsPromo, PromoHiddenByPref) { |
318 prefs()->SetInteger(prefs::kAppsPromoCounter, 0); | 318 prefs()->SetInteger(prefs::kAppsPromoCounter, 0); |
319 prefs()->SetBoolean(prefs::kDefaultAppsInstalled, true); | 319 prefs()->SetBoolean(prefs::kDefaultAppsInstalled, true); |
320 | 320 |
321 // When the "hide" pref is false, the promo should still appear. | 321 // When the "hide" pref is false, the promo should still appear. |
322 prefs()->SetBoolean(prefs::kNTPHideWebStorePromo, false); | 322 prefs()->SetBoolean(prefs::kNTPHideWebStorePromo, false); |
323 AppsPromo::SetPromo(kPromoId, kPromoHeader, kPromoButton, | 323 AppsPromo::PromoData promo_data( |
324 GURL(kPromoLink), kPromoExpire, GURL(""), | 324 kPromoId, kPromoHeader, kPromoButton, GURL(kPromoLink), kPromoExpire, |
325 AppsPromo::USERS_NEW | AppsPromo::USERS_EXISTING); | 325 GURL(""), AppsPromo::USERS_NEW | AppsPromo::USERS_EXISTING); |
| 326 AppsPromo::SetPromo(promo_data); |
326 bool just_expired; | 327 bool just_expired; |
327 bool show_promo = apps_promo()->ShouldShowPromo( | 328 bool show_promo = apps_promo()->ShouldShowPromo( |
328 apps_promo()->old_default_apps(), &just_expired); | 329 apps_promo()->old_default_apps(), &just_expired); |
329 EXPECT_TRUE(show_promo); | 330 EXPECT_TRUE(show_promo); |
330 | 331 |
331 // When the "hide" pref is true, the promo should NOT appear. | 332 // When the "hide" pref is true, the promo should NOT appear. |
332 prefs()->SetBoolean(prefs::kNTPHideWebStorePromo, true); | 333 prefs()->SetBoolean(prefs::kNTPHideWebStorePromo, true); |
333 show_promo = apps_promo()->ShouldShowPromo( | 334 show_promo = apps_promo()->ShouldShowPromo( |
334 apps_promo()->old_default_apps(), &just_expired); | 335 apps_promo()->old_default_apps(), &just_expired); |
335 EXPECT_FALSE(show_promo); | 336 EXPECT_FALSE(show_promo); |
336 } | 337 } |
337 | 338 |
338 #endif // OS_CHROMEOS | 339 #endif // OS_CHROMEOS |
OLD | NEW |