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

Side by Side Diff: chrome/browser/extensions/apps_promo_unittest.cc

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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 "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/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 void ExtensionAppsPromo::SetUp() { 51 void ExtensionAppsPromo::SetUp() {
52 browser::RegisterUserPrefs(&prefs_); 52 browser::RegisterUserPrefs(&prefs_);
53 } 53 }
54 54
55 // TODO(dpolukhin): On Chrome OS all apps are installed via external extensions, 55 // TODO(dpolukhin): On Chrome OS all apps are installed via external extensions,
56 // and the web store promo is never shown. 56 // and the web store promo is never shown.
57 #if !defined(OS_CHROMEOS) 57 #if !defined(OS_CHROMEOS)
58 58
59 TEST_F(ExtensionAppsPromo, HappyPath) { 59 TEST_F(ExtensionAppsPromo, HappyPath) {
60 const ExtensionIdSet& default_app_ids = apps_promo()->old_default_apps(); 60 const extensions::ExtensionIdSet& default_app_ids =
61 apps_promo()->old_default_apps();
61 62
62 EXPECT_GT(default_app_ids.size(), 0u); 63 EXPECT_GT(default_app_ids.size(), 0u);
63 64
64 // The promo counter should default to the max, since we only use the counter 65 // The promo counter should default to the max, since we only use the counter
65 // if they were installed from older versions of Chrome. 66 // if they were installed from older versions of Chrome.
66 EXPECT_EQ(AppsPromo::kDefaultAppsCounterMax + 1, 67 EXPECT_EQ(AppsPromo::kDefaultAppsCounterMax + 1,
67 apps_promo()->GetPromoCounter()); 68 apps_promo()->GetPromoCounter());
68 69
69 // The app launcher and promo should not be shown if there are no extensions 70 // The app launcher and promo should not be shown if there are no extensions
70 // installed and no promo is set. 71 // installed and no promo is set.
71 ExtensionIdSet installed_ids; 72 extensions::ExtensionIdSet installed_ids;
72 bool promo_just_expired = false; 73 bool promo_just_expired = false;
73 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); 74 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale());
74 EXPECT_FALSE(apps_promo()->ShouldShowAppLauncher(installed_ids)); 75 EXPECT_FALSE(apps_promo()->ShouldShowAppLauncher(installed_ids));
75 EXPECT_FALSE(apps_promo()->ShouldShowPromo(installed_ids, 76 EXPECT_FALSE(apps_promo()->ShouldShowPromo(installed_ids,
76 &promo_just_expired)); 77 &promo_just_expired));
77 EXPECT_FALSE(promo_just_expired); 78 EXPECT_FALSE(promo_just_expired);
78 79
79 // Make sure the web store can be supported even when the promo is not active. 80 // Make sure the web store can be supported even when the promo is not active.
80 AppsPromo::SetWebStoreSupportedForLocale(true); 81 AppsPromo::SetWebStoreSupportedForLocale(true);
81 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); 82 EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale());
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 EXPECT_TRUE(show_promo); 214 EXPECT_TRUE(show_promo);
214 215
215 // When the "hide" pref is true, the promo should NOT appear. 216 // When the "hide" pref is true, the promo should NOT appear.
216 prefs()->SetBoolean(prefs::kNtpHideWebStorePromo, true); 217 prefs()->SetBoolean(prefs::kNtpHideWebStorePromo, true);
217 show_promo = apps_promo()->ShouldShowPromo( 218 show_promo = apps_promo()->ShouldShowPromo(
218 apps_promo()->old_default_apps(), &just_expired); 219 apps_promo()->old_default_apps(), &just_expired);
219 EXPECT_FALSE(show_promo); 220 EXPECT_FALSE(show_promo);
220 } 221 }
221 222
222 #endif // OS_CHROMEOS 223 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « chrome/browser/extensions/apps_promo.cc ('k') | chrome/browser/extensions/chrome_app_api_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698