| 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
|
| +}
|
|
|