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

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

Issue 3903002: Uninstall default apps if user hides promo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add DCHECK Created 10 years, 2 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
« no previous file with comments | « chrome/browser/extensions/default_apps.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions/default_apps.h" 5 #include "chrome/browser/extensions/default_apps.h"
6 #include "chrome/common/extensions/extension.h" 6 #include "chrome/common/extensions/extension.h"
7 #include "chrome/test/testing_pref_service.h" 7 #include "chrome/test/testing_pref_service.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 TEST(DefaultApps, Basics) { 10 TEST(DefaultApps, Basics) {
11 TestingPrefService pref_service; 11 TestingPrefService pref_service;
12 DefaultApps::RegisterUserPrefs(&pref_service); 12 DefaultApps::RegisterUserPrefs(&pref_service);
13 DefaultApps default_apps(&pref_service); 13 DefaultApps default_apps(&pref_service);
14 14
15 ExtensionIdSet default_app_ids = *default_apps.GetAppsToInstall(); 15 ExtensionIdSet default_app_ids = *default_apps.GetAppsToInstall();
16 ASSERT_GT(default_app_ids.size(), 0u); 16 ASSERT_GT(default_app_ids.size(), 0u);
17 EXPECT_FALSE(default_apps.GetDefaultAppsInstalled()); 17 EXPECT_FALSE(default_apps.GetDefaultAppsInstalled());
18 EXPECT_EQ(0, default_apps.GetPromoCounter()); 18 EXPECT_EQ(0, default_apps.GetPromoCounter());
19 EXPECT_EQ(default_app_ids, *default_apps.GetDefaultApps());
19 20
20 // The promo should not be shown until the default apps have been installed. 21 // The promo should not be shown until the default apps have been installed.
21 ExtensionIdSet installed_app_ids; 22 ExtensionIdSet installed_app_ids;
22 EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids)); 23 EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids));
23 24
24 // Simulate installing the apps one by one and notifying default_apps after 25 // Simulate installing the apps one by one and notifying default_apps after
25 // each intallation. Nothing should change until we have installed all the 26 // each intallation. Nothing should change until we have installed all the
26 // default apps. 27 // default apps.
27 ExtensionIdSet extension_id_sets[] = { 28 ExtensionIdSet extension_id_sets[] = {
28 default_app_ids, 29 default_app_ids,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 installed_ids.insert("foo"); 124 installed_ids.insert("foo");
124 default_apps.DidInstallApp(installed_ids); 125 default_apps.DidInstallApp(installed_ids);
125 EXPECT_TRUE(default_apps.GetDefaultAppsInstalled()); 126 EXPECT_TRUE(default_apps.GetDefaultAppsInstalled());
126 EXPECT_FALSE(default_apps.GetAppsToInstall()); 127 EXPECT_FALSE(default_apps.GetAppsToInstall());
127 128
128 // The promo shouldn't turn on though, because it would look weird with the 129 // The promo shouldn't turn on though, because it would look weird with the
129 // user's extra, manually installed extensions. 130 // user's extra, manually installed extensions.
130 EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids)); 131 EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
131 EXPECT_EQ(DefaultApps::kAppsPromoCounterMax, default_apps.GetPromoCounter()); 132 EXPECT_EQ(DefaultApps::kAppsPromoCounterMax, default_apps.GetPromoCounter());
132 } 133 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/default_apps.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698