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

Unified Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 10834191: new implementation of default apps (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: disable default_app unit_test for chromeos Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/external_provider_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service_unittest.cc
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index bfa27f6bed66920b56b7e5ac4f50c4b976067400..06ba12923b6ae5c63949315fcd4872c233bc84c0 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/extensions/app_sync_data.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/extensions/crx_installer.h"
+#include "chrome/browser/extensions/default_apps.h"
#include "chrome/browser/extensions/extension_creator.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
#include "chrome/browser/extensions/extension_error_ui.h"
@@ -3827,6 +3828,54 @@ TEST_F(ExtensionServiceTest, ExternalInstallPref) {
TestExternalProvider(pref_provider, Extension::EXTERNAL_PREF);
}
+#if !defined(OS_CHROMEOS)
Mihai Parparita -not on Chrome 2012/08/23 23:14:22 Just realized that this might make sense in a sepa
+// Chrome OS has different way of installing default apps.
+TEST_F(ExtensionServiceTest, DefaultAppsInstall) {
+ scoped_ptr<TestingProfile> profile(new TestingProfile());
+
+ // The default apps should be installed if kDefaultAppsInstallState
+ // is unknown.
+ EXPECT_TRUE(default_apps::ShouldInstallInProfile(profile.get()));
+ int state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
+ EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps);
+
+ // The default apps should only be installed once.
+ EXPECT_FALSE(default_apps::ShouldInstallInProfile(profile.get()));
+ state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
+ EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps);
+
+ // The default apps should not be installed if the state is
+ // kNeverProvideDefaultApps
+ profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState,
+ default_apps::kNeverInstallDefaultApps);
+ EXPECT_FALSE(default_apps::ShouldInstallInProfile(profile.get()));
+ state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
+ EXPECT_TRUE(state == default_apps::kNeverInstallDefaultApps);
+
+ // The old default apps with kAlwaysInstallDefaultAppss should be migrated.
+ profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState,
+ default_apps::kProvideLegacyDefaultApps);
+ EXPECT_TRUE(default_apps::ShouldInstallInProfile(profile.get()));
+ state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
+ EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps);
+
+ class DefaultTestingProfile : public TestingProfile {
+ virtual bool WasCreatedByVersionOrLater(
+ const std::string& version) OVERRIDE {
+ return false;
+ }
+ };
+ profile.reset(new DefaultTestingProfile);
+ // The old default apps with kProvideLegacyDefaultApps should be migrated
+ // even if the profile version is older than Chrome version.
+ profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState,
+ default_apps::kProvideLegacyDefaultApps);
+ EXPECT_TRUE(default_apps::ShouldInstallInProfile(profile.get()));
+ state = profile->GetPrefs()->GetInteger(prefs::kDefaultAppsInstallState);
+ EXPECT_TRUE(state == default_apps::kAlreadyInstalledDefaultApps);
+}
+#endif
+
TEST_F(ExtensionServiceTest, ExternalInstallPrefUpdateUrl) {
// This should all work, even when normal extension installation is disabled.
InitializeEmptyExtensionService();
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/external_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698