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

Unified Diff: extensions/browser/management_policy_unittest.cc

Issue 536753003: Add recommended extension installation support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-3
Patch Set: rebase, more fix Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/management_policy.cc ('k') | extensions/browser/test_management_policy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/management_policy_unittest.cc
diff --git a/extensions/browser/management_policy_unittest.cc b/extensions/browser/management_policy_unittest.cc
index 52373c135ba75b1638b1a60280d690884bf7a103..bcedc2c7e2892bfb7d191c5f5cb6f6e30e2c0d30 100644
--- a/extensions/browser/management_policy_unittest.cc
+++ b/extensions/browser/management_policy_unittest.cc
@@ -22,6 +22,8 @@ class ManagementPolicyTest : public testing::Test {
must_remain_disabled_.SetProhibitedActions(
TestProvider::MUST_REMAIN_DISABLED);
must_remain_disabled_.SetDisableReason(Extension::DISABLE_SIDELOAD_WIPEOUT);
+ must_remain_installed_.SetProhibitedActions(
+ TestProvider::MUST_REMAIN_INSTALLED);
restrict_all_.SetProhibitedActions(TestProvider::PROHIBIT_MODIFY_STATUS |
TestProvider::PROHIBIT_LOAD |
TestProvider::MUST_REMAIN_ENABLED);
@@ -35,6 +37,7 @@ class ManagementPolicyTest : public testing::Test {
TestProvider no_load_;
TestProvider must_remain_enabled_;
TestProvider must_remain_disabled_;
+ TestProvider must_remain_installed_;
TestProvider restrict_all_;
};
@@ -176,6 +179,34 @@ TEST_F(ManagementPolicyTest, MustRemainDisabled) {
EXPECT_TRUE(error.empty());
}
+TEST_F(ManagementPolicyTest, MustRemainInstalled) {
+ // No providers registered.
+ base::string16 error;
+ EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error));
+ EXPECT_TRUE(error.empty());
+
+ // One provider, no relevant restriction.
+ policy_.RegisterProvider(&allow_all_);
+ EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error));
+ EXPECT_TRUE(error.empty());
+
+ // Two providers, no relevant restrictions.
+ policy_.RegisterProvider(&no_modify_status_);
+ EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error));
+ EXPECT_TRUE(error.empty());
+
+ // Three providers, one with a relevant restriction.
+ policy_.RegisterProvider(&must_remain_installed_);
+ EXPECT_TRUE(policy_.MustRemainInstalled(NULL, &error));
+ EXPECT_FALSE(error.empty());
+
+ // Remove the restriction.
+ policy_.UnregisterProvider(&must_remain_installed_);
+ error.clear();
+ EXPECT_FALSE(policy_.MustRemainInstalled(NULL, &error));
+ EXPECT_TRUE(error.empty());
+}
+
// Tests error handling in the ManagementPolicy.
TEST_F(ManagementPolicyTest, ErrorHandling) {
// The error parameter should be unchanged if no restriction was found.
« no previous file with comments | « extensions/browser/management_policy.cc ('k') | extensions/browser/test_management_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698