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

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

Issue 50433008: Dispatch browser action clicks to the profile for the browser window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (c) Created 7 years, 1 month 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_toolbar_model.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_apitest.cc
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index dc680e30177caf737c931b086c9f9cd9956534a7..81ebc798f603f5f560c9bffe19675730b52fa0a6 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -571,6 +571,39 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoDragging) {
EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1));
}
+// Tests that events are dispatched to the correct profile for split mode
+// extensions.
+IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, IncognitoSplit) {
+ ResultCatcher catcher;
+ const Extension* extension = LoadExtensionWithFlags(
+ test_data_dir_.AppendASCII("browser_action/split_mode"),
+ kFlagEnableIncognito);
+ ASSERT_TRUE(extension) << message_;
+
+ // Open an incognito window.
+ Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
+ Browser* incognito_browser =
+ new Browser(Browser::CreateParams(incognito_profile,
+ browser()->host_desktop_type()));
+ // Navigate just to have a tab in this window, otherwise wonky things happen.
+ ui_test_utils::OpenURLOffTheRecord(browser()->profile(), GURL("about:blank"));
+ ASSERT_EQ(1,
+ BrowserActionTestUtil(incognito_browser).NumberOfBrowserActions());
+
+ // A click in the regular profile should open a tab in the regular profile.
+ ExtensionService* service = extensions::ExtensionSystem::Get(
+ browser()->profile())->extension_service();
+ service->toolbar_model()->ExecuteBrowserAction(
+ extension, browser(), NULL, true);
+ ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
+
+ // A click in the incognito profile should open a tab in the
+ // incognito profile.
+ service->toolbar_model()->ExecuteBrowserAction(
+ extension, incognito_browser, NULL, true);
+ ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
+}
+
// Disabled because of failures (crashes) on ASAN bot.
// See http://crbug.com/98861.
IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_CloseBackgroundPage) {
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_toolbar_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698