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

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: Addressing Bernhard's and Pat's comments 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
Index: chrome/browser/managed_mode_unittest.cc
===================================================================
--- chrome/browser/managed_mode_unittest.cc (revision 142678)
+++ chrome/browser/managed_mode_unittest.cc (working copy)
@@ -36,13 +36,18 @@
EnterManagedModeImpl(profile, callback);
}
+ void ForceManagedModeForTesting(Profile* profile) {
+ SetInManagedMode(profile);
+ }
+
// ManagedMode overrides:
- virtual bool IsInManagedModeImpl() OVERRIDE {
+ virtual bool IsInManagedModeImpl() const OVERRIDE {
return in_managed_mode_;
Bernhard Bauer 2012/06/19 10:01:36 We could probably save this flag now by just direc
Pam (message me for reviews) 2012/06/19 12:56:05 We still need the flag, because while we're waitin
}
- virtual void SetInManagedMode(bool in_managed_mode) OVERRIDE {
- in_managed_mode_ = in_managed_mode;
+ virtual void SetInManagedMode(Profile* newly_managed_profile) OVERRIDE {
+ 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_.ForceManagedModeForTesting(&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_.ForceManagedModeForTesting(&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
+}

Powered by Google App Engine
This is Rietveld 408576698