| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 | 1227 |
| 1228 // Try adding the same extension from an external update URL. | 1228 // Try adding the same extension from an external update URL. |
| 1229 ASSERT_FALSE(service()->pending_extension_manager()->AddFromExternalUpdateUrl( | 1229 ASSERT_FALSE(service()->pending_extension_manager()->AddFromExternalUpdateUrl( |
| 1230 good_crx, | 1230 good_crx, |
| 1231 std::string(), | 1231 std::string(), |
| 1232 GURL("http:://fake.update/url"), | 1232 GURL("http:://fake.update/url"), |
| 1233 Manifest::EXTERNAL_PREF_DOWNLOAD, | 1233 Manifest::EXTERNAL_PREF_DOWNLOAD, |
| 1234 Extension::NO_FLAGS, | 1234 Extension::NO_FLAGS, |
| 1235 false)); | 1235 false)); |
| 1236 | 1236 |
| 1237 // Installation of the same extension through the policy should be successful. |
| 1238 ASSERT_TRUE(service()->pending_extension_manager()->AddFromExternalUpdateUrl( |
| 1239 good_crx, |
| 1240 std::string(), |
| 1241 GURL("http:://fake.update/url"), |
| 1242 Manifest::EXTERNAL_POLICY_DOWNLOAD, |
| 1243 Extension::NO_FLAGS, |
| 1244 false)); |
| 1245 EXPECT_TRUE(service()->pending_extension_manager()->IsIdPending(good_crx)); |
| 1246 EXPECT_TRUE(service()->pending_extension_manager()->Remove(good_crx)); |
| 1247 |
| 1237 ASSERT_FALSE(service()->pending_extension_manager()->IsIdPending(good_crx)); | 1248 ASSERT_FALSE(service()->pending_extension_manager()->IsIdPending(good_crx)); |
| 1238 } | 1249 } |
| 1239 | 1250 |
| 1240 // Test that uninstalling an external extension does not crash when | 1251 // Test that uninstalling an external extension does not crash when |
| 1241 // the extension could not be loaded. | 1252 // the extension could not be loaded. |
| 1242 // This extension shown in preferences file requires an experimental permission. | 1253 // This extension shown in preferences file requires an experimental permission. |
| 1243 // It could not be loaded without such permission. | 1254 // It could not be loaded without such permission. |
| 1244 TEST_F(ExtensionServiceTest, UninstallingNotLoadedExtension) { | 1255 TEST_F(ExtensionServiceTest, UninstallingNotLoadedExtension) { |
| 1245 base::FilePath source_install_dir = | 1256 base::FilePath source_install_dir = |
| 1246 data_dir().AppendASCII("good").AppendASCII("Extensions"); | 1257 data_dir().AppendASCII("good").AppendASCII("Extensions"); |
| (...skipping 5692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6939 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); | 6950 ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); |
| 6940 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); | 6951 EXPECT_TRUE(registry()->disabled_extensions().Contains(id)); |
| 6941 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6952 EXPECT_TRUE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6942 | 6953 |
| 6943 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); | 6954 base::FilePath v2_path = data_dir().AppendASCII("good2.crx"); |
| 6944 UpdateExtension(id, v2_path, ENABLED); | 6955 UpdateExtension(id, v2_path, ENABLED); |
| 6945 | 6956 |
| 6946 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); | 6957 EXPECT_FALSE(registry()->disabled_extensions().Contains(id)); |
| 6947 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); | 6958 EXPECT_FALSE(prefs->HasDisableReason(id, Extension::DISABLE_CORRUPTED)); |
| 6948 } | 6959 } |
| OLD | NEW |