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

Unified Diff: chrome/browser/extensions/extension_management_browsertest.cc

Issue 9718008: Replace extension disabled infobar with a global error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar Created 8 years, 9 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
« no previous file with comments | « chrome/browser/extensions/extension_disabled_ui_browsertest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_management_browsertest.cc
diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc
index 6d532c1e437e7befe7d079d3ae2684e5a008cb5c..a0ea44bc3849887694f9f0450c9a03361e3fbdff 100644
--- a/chrome/browser/extensions/extension_management_browsertest.cc
+++ b/chrome/browser/extensions/extension_management_browsertest.cc
@@ -59,33 +59,6 @@ class ExtensionManagementTest : public ExtensionBrowserTest {
return false;
return true;
}
-
- // Helper method that installs a low permission extension then updates
- // to the second version requiring increased permissions. Returns whether
- // the operation was completed successfully.
- bool InstallAndUpdateIncreasingPermissionsExtension() {
- ExtensionService* service = browser()->profile()->GetExtensionService();
- size_t size_before = service->extensions()->size();
-
- // Install the initial version, which should happen just fine.
- const Extension* extension = InstallExtension(
- test_data_dir_.AppendASCII("permissions-low-v1.crx"), 1);
- if (!extension)
- return false;
- if (service->extensions()->size() != size_before + 1)
- return false;
-
- // Upgrade to a version that wants more permissions. We should disable the
- // extension and prompt the user to reenable.
- if (UpdateExtension(
- extension->id(),
- test_data_dir_.AppendASCII("permissions-high-v2.crx"), -1))
- return false;
- EXPECT_EQ(size_before, service->extensions()->size());
- if (service->disabled_extensions()->size() != 1u)
- return false;
- return true;
- }
};
#if defined(OS_LINUX)
@@ -148,58 +121,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, InstallRequiresConfirm) {
UninstallExtension(id);
}
-// Tests the process of updating an extension to one that requires higher
-// permissions.
-IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) {
- ExtensionService* service = browser()->profile()->GetExtensionService();
- ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension());
- const size_t size_before = service->extensions()->size();
-
- // Now try reenabling it.
- const std::string id = (*service->disabled_extensions()->begin())->id();
- service->EnableExtension(id);
- EXPECT_EQ(size_before + 1, service->extensions()->size());
- EXPECT_EQ(0u, service->disabled_extensions()->size());
-}
-
-// Tests uninstalling an extension that was disabled due to higher permissions.
-IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissionsAndUninstall) {
- ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension());
-
- // Make sure the "disable extension" infobar is present.
- ASSERT_EQ(0, browser()->active_index());
- InfoBarTabHelper* infobar_helper = browser()->GetTabContentsWrapperAt(0)->
- infobar_tab_helper();
- ASSERT_EQ(1U, infobar_helper->infobar_count());
-
- // Uninstall, and check that the infobar went away.
- ExtensionService* service = browser()->profile()->GetExtensionService();
- std::string id = (*service->disabled_extensions()->begin())->id();
- UninstallExtension(id);
- ASSERT_EQ(0U, infobar_helper->infobar_count());
-
- // Now select a new tab, and switch back to the first tab which had the
- // infobar. We should not crash.
- ASSERT_EQ(1, browser()->tab_count());
- ASSERT_EQ(0, browser()->active_index());
- browser()->NewTab();
- ASSERT_EQ(2, browser()->tab_count());
- ASSERT_EQ(1, browser()->active_index());
- browser()->ActivateTabAt(0, true);
-}
-
-// Tests that we can uninstall a disabled extension.
-IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UninstallDisabled) {
- ExtensionService* service = browser()->profile()->GetExtensionService();
- ASSERT_TRUE(InstallAndUpdateIncreasingPermissionsExtension());
- const size_t size_before = service->extensions()->size();
-
- // Now try uninstalling it.
- UninstallExtension((*service->disabled_extensions()->begin())->id());
- EXPECT_EQ(size_before, service->extensions()->size());
- EXPECT_EQ(0u, service->disabled_extensions()->size());
-}
-
// Tests that disabling and re-enabling an extension works.
IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) {
ExtensionProcessManager* manager = browser()->profile()->
« no previous file with comments | « chrome/browser/extensions/extension_disabled_ui_browsertest.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698