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

Unified Diff: chrome/browser/managed_mode_unittest.cc

Issue 10542023: Disable modifying extensions when in managed mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixed Evan's nits Created 8 years, 6 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/managed_mode.cc ('k') | chrome/browser/resources/extensions/extensions.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/managed_mode_unittest.cc
===================================================================
--- chrome/browser/managed_mode_unittest.cc (revision 142678)
+++ chrome/browser/managed_mode_unittest.cc (working copy)
@@ -37,12 +37,17 @@
}
// ManagedMode overrides:
- virtual bool IsInManagedModeImpl() OVERRIDE {
+ virtual bool IsInManagedModeImpl() const OVERRIDE {
return in_managed_mode_;
}
- virtual void SetInManagedMode(bool in_managed_mode) OVERRIDE {
- in_managed_mode_ = in_managed_mode;
+ virtual void SetInManagedMode(Profile* newly_managed_profile) OVERRIDE {
+ if (newly_managed_profile) {
+ ASSERT_TRUE(!managed_profile_ ||
+ managed_profile_ == newly_managed_profile);
+ }
+ managed_profile_ = newly_managed_profile;
+ in_managed_mode_ = (newly_managed_profile != NULL);
}
virtual bool PlatformConfirmEnter() OVERRIDE {
@@ -96,7 +101,7 @@
}
void CheckManagedMode(bool success) {
- EXPECT_EQ(managed_mode_->IsInManagedModeImpl(), success);
+ EXPECT_EQ(success, managed_mode_->IsInManagedModeImpl());
DidEnterManagedMode(success);
}
@@ -151,8 +156,9 @@
BrowserFixture managed_mode_browser(&managed_mode_, &managed_mode_profile_);
BrowserFixture other_browser(&managed_mode_, &other_profile_);
- // If we're already in managed mode, entering should immediately succeed.
- managed_mode_.SetInManagedMode(true);
+ // If we're already in managed mode in this profile, entering should
+ // immediately succeed.
+ managed_mode_.SetInManagedMode(&managed_mode_profile_);
managed_mode_.EnterManagedModeForTesting(&managed_mode_profile_,
CreateExpectedCallback(true));
}
@@ -228,3 +234,18 @@
managed_mode_.EnterManagedModeForTesting(&managed_mode_profile_,
CreateExpectedCallback(false));
}
+
+TEST_F(ManagedModeTest, ExtensionManagementPolicyProvider) {
+ BrowserFixture managed_mode_browser(&managed_mode_, &managed_mode_profile_);
+
+ EXPECT_TRUE(managed_mode_.UserMayLoad(NULL, NULL));
+ EXPECT_TRUE(managed_mode_.UserMayModifySettings(NULL, NULL));
+
+ managed_mode_.SetInManagedMode(&managed_mode_profile_);
+ EXPECT_FALSE(managed_mode_.UserMayLoad(NULL, NULL));
+ EXPECT_FALSE(managed_mode_.UserMayModifySettings(NULL, NULL));
+
+#ifndef NDEBUG
+ EXPECT_FALSE(managed_mode_.GetDebugPolicyProviderName().empty());
+#endif
+}
« no previous file with comments | « chrome/browser/managed_mode.cc ('k') | chrome/browser/resources/extensions/extensions.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698