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

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

Issue 7003068: Fix crash when you uninstall a permissions-upgrade disabled extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize extension to NULL Created 9 years, 6 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_infobar_delegate.cc ('k') | no next file » | 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 e76cb79b2c130ae3d2c43c10090b3a85c97f51d6..d80f37c1910fa91bbf9a4739d03c9c909c9166aa 100644
--- a/chrome/browser/extensions/extension_management_browsertest.cc
+++ b/chrome/browser/extensions/extension_management_browsertest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/ui_test_utils.h"
@@ -149,6 +150,31 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, UpdatePermissions) {
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());
+ TabContentsWrapper* wrapper = browser()->GetTabContentsWrapperAt(0);
+ ASSERT_EQ(1U, wrapper->infobar_count());
+
+ // Uninstall, and check that the infobar went away.
+ ExtensionService* service = browser()->profile()->GetExtensionService();
+ std::string id = service->disabled_extensions()->at(0)->id();
+ UninstallExtension(id);
+ ASSERT_EQ(0U, wrapper->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();
« no previous file with comments | « chrome/browser/extensions/extension_disabled_infobar_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698