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

Unified Diff: chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc

Issue 2086193002: [Extensions UI] Fix a crash when clicking on a bubble's learn more (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Views clicking Created 4 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
Index: chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc
diff --git a/chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc b/chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc
index 74ea47d38508d8f30815135ba7eda3ad9b3b7699..35dec77a3f82d5691937432f1e75a090a3b6698f 100644
--- a/chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc
+++ b/chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc
@@ -15,9 +15,14 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/extension_message_bubble_factory.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
#include "components/omnibox/browser/omnibox_edit_model.h"
+#include "content/public/test/browser_test_utils.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/common/extension.h"
#include "extensions/common/feature_switch.h"
#include "extensions/test/extension_test_message_listener.h"
@@ -266,3 +271,58 @@ void ExtensionMessageBubbleBrowserTest::TestBubbleWithMultipleWindows() {
CheckBubbleIsNotPresent(fourth_browser, true, true);
CloseBubble(second_browser);
}
+
+void ExtensionMessageBubbleBrowserTest::TestClickingLearnMoreButton() {
+ CheckBubbleIsNotPresent(browser(), false, false);
+ LoadExtension(test_data_dir_.AppendASCII("good_unpacked"));
+ Browser* second_browser = new Browser(Browser::CreateParams(profile()));
+ base::RunLoop().RunUntilIdle();
+ CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
+ ClickLearnMoreButton(second_browser);
+ base::RunLoop().RunUntilIdle();
+ CheckBubbleIsNotPresent(second_browser, false, false);
+ // The learn more link goes to the chrome://extensions page, so it should be
+ // opened in the active tab.
+ content::WebContents* active_web_contents =
+ second_browser->tab_strip_model()->GetActiveWebContents();
+ content::WaitForLoadStop(active_web_contents);
+ EXPECT_EQ(GURL(chrome::kChromeUIExtensionsURL),
+ active_web_contents->GetLastCommittedURL());
+}
+
+void ExtensionMessageBubbleBrowserTest::TestClickingActionButton() {
+ CheckBubbleIsNotPresent(browser(), false, false);
+ const extensions::Extension* extension =
+ LoadExtension(test_data_dir_.AppendASCII("good_unpacked"));
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(profile());
+ std::string id = extension->id();
+ EXPECT_TRUE(registry->enabled_extensions().GetByID(id));
+ Browser* second_browser = new Browser(Browser::CreateParams(profile()));
+ base::RunLoop().RunUntilIdle();
+ CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
+ ClickActionButton(second_browser);
+ base::RunLoop().RunUntilIdle();
+ CheckBubbleIsNotPresent(browser(), false, false);
+ // Clicking the action button disabled the extension.
+ EXPECT_FALSE(registry->enabled_extensions().GetByID(id));
+}
+
+void ExtensionMessageBubbleBrowserTest::TestClickingDismissButton() {
+ CheckBubbleIsNotPresent(browser(), false, false);
+ const extensions::Extension* extension =
+ LoadExtension(test_data_dir_.AppendASCII("good_unpacked"));
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(profile());
+ std::string id = extension->id();
+ EXPECT_TRUE(registry->enabled_extensions().GetByID(id));
+ Browser* second_browser = new Browser(Browser::CreateParams(profile()));
+ base::RunLoop().RunUntilIdle();
+ CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
+ ClickDismissButton(second_browser);
+ base::RunLoop().RunUntilIdle();
+ CheckBubbleIsNotPresent(browser(), false, false);
+ // Clicking dismiss should have no affect, so the extension should still be
+ // active.
+ EXPECT_TRUE(registry->enabled_extensions().GetByID(id));
+}

Powered by Google App Engine
This is Rietveld 408576698