| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); | 434 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); |
| 435 const Extension* extension = service->GetExtensionById(kExtensionId, false); | 435 const Extension* extension = service->GetExtensionById(kExtensionId, false); |
| 436 ASSERT_TRUE(extension); | 436 ASSERT_TRUE(extension); |
| 437 ASSERT_EQ("2.0", extension->VersionString()); | 437 ASSERT_EQ("2.0", extension->VersionString()); |
| 438 | 438 |
| 439 // Uninstalling the extension should set a pref that keeps the extension from | 439 // Uninstalling the extension should set a pref that keeps the extension from |
| 440 // being installed again the next time external_extensions.json is read. | 440 // being installed again the next time external_extensions.json is read. |
| 441 | 441 |
| 442 UninstallExtension(kExtensionId); | 442 UninstallExtension(kExtensionId); |
| 443 | 443 |
| 444 extensions::ExtensionPrefs* extension_prefs = service->extension_prefs(); | 444 extensions::ExtensionPrefs* extension_prefs = |
| 445 extensions::ExtensionPrefs::Get(browser()->profile()); |
| 445 EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) | 446 EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) |
| 446 << "Uninstalling should set kill bit on externaly installed extension."; | 447 << "Uninstalling should set kill bit on externaly installed extension."; |
| 447 | 448 |
| 448 // Try to install the extension again from an external source. It should fail | 449 // Try to install the extension again from an external source. It should fail |
| 449 // because of the killbit. | 450 // because of the killbit. |
| 450 EXPECT_FALSE(pending_extension_manager->AddFromExternalUpdateUrl( | 451 EXPECT_FALSE(pending_extension_manager->AddFromExternalUpdateUrl( |
| 451 kExtensionId, GURL("http://localhost/autoupdate/manifest"), | 452 kExtensionId, GURL("http://localhost/autoupdate/manifest"), |
| 452 Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS, false)); | 453 Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS, false)); |
| 453 EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId)) | 454 EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId)) |
| 454 << "External reinstall of a killed extension shouldn't work."; | 455 << "External reinstall of a killed extension shouldn't work."; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 forcelist, kExtensionId, "http://localhost/autoupdate/manifest"); | 637 forcelist, kExtensionId, "http://localhost/autoupdate/manifest"); |
| 637 } | 638 } |
| 638 ASSERT_TRUE(WaitForExtensionInstall()); | 639 ASSERT_TRUE(WaitForExtensionInstall()); |
| 639 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); | 640 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); |
| 640 extension = service->GetExtensionById(kExtensionId, false); | 641 extension = service->GetExtensionById(kExtensionId, false); |
| 641 ASSERT_TRUE(extension); | 642 ASSERT_TRUE(extension); |
| 642 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); | 643 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); |
| 643 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); | 644 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); |
| 644 EXPECT_TRUE(registry->disabled_extensions().is_empty()); | 645 EXPECT_TRUE(registry->disabled_extensions().is_empty()); |
| 645 } | 646 } |
| OLD | NEW |