| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 EXPECT_EQ(1u, service_->extensions()->size()); | 2546 EXPECT_EQ(1u, service_->extensions()->size()); |
| 2547 | 2547 |
| 2548 { // Scope for pref update notification. | 2548 { // Scope for pref update notification. |
| 2549 PrefService* prefs = profile_->GetPrefs(); | 2549 PrefService* prefs = profile_->GetPrefs(); |
| 2550 ListPrefUpdate update(prefs, prefs::kExtensionInstallDenyList); | 2550 ListPrefUpdate update(prefs, prefs::kExtensionInstallDenyList); |
| 2551 ListValue* blacklist = update.Get(); | 2551 ListValue* blacklist = update.Get(); |
| 2552 ASSERT_TRUE(blacklist != NULL); | 2552 ASSERT_TRUE(blacklist != NULL); |
| 2553 | 2553 |
| 2554 // Blacklist this extension. | 2554 // Blacklist this extension. |
| 2555 blacklist->Append(Value::CreateStringValue(good_crx)); | 2555 blacklist->Append(Value::CreateStringValue(good_crx)); |
| 2556 prefs->ScheduleSavePersistentPrefs(); | |
| 2557 } | 2556 } |
| 2558 | 2557 |
| 2559 // Extension should not be running now. | 2558 // Extension should not be running now. |
| 2560 loop_.RunAllPending(); | 2559 loop_.RunAllPending(); |
| 2561 EXPECT_EQ(0u, service_->extensions()->size()); | 2560 EXPECT_EQ(0u, service_->extensions()->size()); |
| 2562 } | 2561 } |
| 2563 | 2562 |
| 2564 // Tests disabling extensions | 2563 // Tests disabling extensions |
| 2565 TEST_F(ExtensionServiceTest, DisableExtension) { | 2564 TEST_F(ExtensionServiceTest, DisableExtension) { |
| 2566 InitializeEmptyExtensionService(); | 2565 InitializeEmptyExtensionService(); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 service_->CheckForExternalUpdates(); | 3069 service_->CheckForExternalUpdates(); |
| 3071 loop_.RunAllPending(); | 3070 loop_.RunAllPending(); |
| 3072 ASSERT_EQ(0u, loaded_.size()); | 3071 ASSERT_EQ(0u, loaded_.size()); |
| 3073 ValidatePrefKeyCount(1); | 3072 ValidatePrefKeyCount(1); |
| 3074 ValidateIntegerPref(good_crx, "state", | 3073 ValidateIntegerPref(good_crx, "state", |
| 3075 Extension::EXTERNAL_EXTENSION_UNINSTALLED); | 3074 Extension::EXTERNAL_EXTENSION_UNINSTALLED); |
| 3076 ValidateIntegerPref(good_crx, "location", location); | 3075 ValidateIntegerPref(good_crx, "location", location); |
| 3077 | 3076 |
| 3078 // Now clear the preference and reinstall. | 3077 // Now clear the preference and reinstall. |
| 3079 SetPrefInteg(good_crx, "state", Extension::ENABLED); | 3078 SetPrefInteg(good_crx, "state", Extension::ENABLED); |
| 3080 profile_->GetPrefs()->ScheduleSavePersistentPrefs(); | |
| 3081 | 3079 |
| 3082 loaded_.clear(); | 3080 loaded_.clear(); |
| 3083 service_->CheckForExternalUpdates(); | 3081 service_->CheckForExternalUpdates(); |
| 3084 loop_.RunAllPending(); | 3082 loop_.RunAllPending(); |
| 3085 ASSERT_EQ(1u, loaded_.size()); | 3083 ASSERT_EQ(1u, loaded_.size()); |
| 3086 } else { | 3084 } else { |
| 3087 // Policy controlled extesions should not have been touched by uninstall. | 3085 // Policy controlled extesions should not have been touched by uninstall. |
| 3088 ASSERT_TRUE(file_util::PathExists(install_path)); | 3086 ASSERT_TRUE(file_util::PathExists(install_path)); |
| 3089 } | 3087 } |
| 3090 ValidatePrefKeyCount(1); | 3088 ValidatePrefKeyCount(1); |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4154 ASSERT_FALSE(AddPendingSyncInstall()); | 4152 ASSERT_FALSE(AddPendingSyncInstall()); |
| 4155 | 4153 |
| 4156 // Wait for the external source to install. | 4154 // Wait for the external source to install. |
| 4157 WaitForCrxInstall(crx_path_, true); | 4155 WaitForCrxInstall(crx_path_, true); |
| 4158 ASSERT_TRUE(IsCrxInstalled()); | 4156 ASSERT_TRUE(IsCrxInstalled()); |
| 4159 | 4157 |
| 4160 // Now that the extension is installed, sync request should fail | 4158 // Now that the extension is installed, sync request should fail |
| 4161 // because the extension is already installed. | 4159 // because the extension is already installed. |
| 4162 ASSERT_FALSE(AddPendingSyncInstall()); | 4160 ASSERT_FALSE(AddPendingSyncInstall()); |
| 4163 } | 4161 } |
| OLD | NEW |