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

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

Issue 7830046: Allow window.close() in background pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/DCHECK/CHECK/ Created 9 years, 3 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/extensions/extension_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/browser_action_apitest.cc
diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc
index 35819e4eb2d433b3238633303850f5a71caa48da..cb1007eac7e8d469f57ca46d6f9318c18b9635ea 100644
--- a/chrome/browser/extensions/browser_action_apitest.cc
+++ b/chrome/browser/extensions/browser_action_apitest.cc
@@ -379,3 +379,29 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0));
EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1));
}
+
+IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, CloseBackgroundPage) {
+ ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(
+ "browser_action/close_background")));
+ const Extension* extension = GetSingleLoadedExtension();
+
+ // There is a background page and a browser action with no badge text.
+ ExtensionProcessManager* manager =
+ browser()->profile()->GetExtensionProcessManager();
+ ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension));
+ ExtensionAction* action = extension->browser_action();
+ ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId));
+
+ // Click the browser action.
+ browser()->profile()->GetExtensionService()->browser_event_router()->
+ BrowserActionExecuted(
+ browser()->profile(), action->extension_id(), browser());
+
+ // It can take a moment for the background page to actually get destroyed
+ // so we wait for the notification before checking that it's really gone
+ // and the badge text has been set.
+ ui_test_utils::WaitForNotification(
+ chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED);
+ ASSERT_FALSE(manager->GetBackgroundHostForExtension(extension));
+ ASSERT_EQ("X", action->GetBadgeText(ExtensionAction::kDefaultTabId));
+}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698