Index: chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc |
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc |
index b318be5e57be1ced441d1aa06f3038393a6f5f82..0bf28513a1c4e5d5143f19ca3a8eb6d21cc911f0 100644 |
--- a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc |
+++ b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc |
@@ -18,7 +18,10 @@ |
#include "chrome/test/base/interactive_test_utils.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "content/public/browser/notification_service.h" |
+#include "extensions/browser/extension_registry.h" |
#include "extensions/browser/extension_system.h" |
+#include "extensions/common/extension.h" |
+#include "extensions/common/extension_set.h" |
#include "extensions/common/permissions/permissions_data.h" |
#if defined(OS_WIN) |
@@ -263,6 +266,31 @@ IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, TabSwitchClosesPopup) { |
EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); |
} |
+IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, |
+ DeleteBrowserActionWithPopupOpen) { |
+ if (!ShouldRunPopupTest()) |
+ return; |
+ |
+ // First, we open a popup. |
+ OpenExtensionPopupViaAPI(); |
+ BrowserActionTestUtil browser_action_test_util(browser()); |
+ EXPECT_TRUE(browser_action_test_util.HasPopup()); |
+ |
+ // Then, find the extension that created it. |
+ content::WebContents* active_web_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ ASSERT_TRUE(active_web_contents); |
+ GURL url = active_web_contents->GetLastCommittedURL(); |
+ const Extension* extension = ExtensionRegistry::Get(browser()->profile())-> |
+ enabled_extensions().GetExtensionOrAppByURL(url); |
+ ASSERT_TRUE(extension); |
+ |
+ // Finally, uninstall the extension, which causes the view to be deleted and |
+ // the popup to go away. This should not crash. |
+ UninstallExtension(extension->id()); |
+ EXPECT_FALSE(browser_action_test_util.HasPopup()); |
+} |
+ |
#if defined(TOOLKIT_VIEWS) |
// Test closing the browser while inspecting an extension popup with dev tools. |
IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, CloseBrowserWithDevTools) { |