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

Unified Diff: chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc

Issue 431173002: Create ExtensionActionView class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge conflict Created 6 years, 4 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 | « no previous file | chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698