| 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 c8ab70f6f7ad999a2fc9ebda6c5df632bb367776..673765b8296610547a7d307e8932a70a4e0c30e3 100644
|
| --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
|
| +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
|
| @@ -17,7 +17,10 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_commands.h"
|
| +#include "chrome/browser/ui/browser_finder.h"
|
| +#include "chrome/browser/ui/browser_navigator_params.h"
|
| #include "chrome/browser/ui/browser_window.h"
|
| +#include "chrome/browser/ui/host_desktop.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| @@ -750,5 +753,42 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionWithRectangularIcon) {
|
| EXPECT_FALSE(gfx::test::AreImagesEqual(first_icon, next_icon));
|
| }
|
|
|
| +// Test that we don't try and show a browser action popup with
|
| +// browserAction.openPopup if there is no toolbar (e.g., for web popup windows).
|
| +// Regression test for crbug.com/584747.
|
| +IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionOpenPopupOnPopup) {
|
| + // Open a new web popup window.
|
| + chrome::NavigateParams params(browser(), GURL("http://www.google.com/"),
|
| + ui::PAGE_TRANSITION_LINK);
|
| + params.disposition = NEW_POPUP;
|
| + params.window_action = chrome::NavigateParams::SHOW_WINDOW;
|
| + ui_test_utils::NavigateToURL(¶ms);
|
| + Browser* popup_browser = params.browser;
|
| + // Verify it is a popup, and it is the active window.
|
| + ASSERT_TRUE(popup_browser);
|
| + // The window isn't considered "active" on MacOSX for odd reasons. The more
|
| + // important test is that it *is* considered the last active browser, since
|
| + // that's what we check when we try to open the popup.
|
| +#if !defined(OS_MACOSX)
|
| + EXPECT_TRUE(popup_browser->window()->IsActive());
|
| +#endif
|
| + EXPECT_FALSE(browser()->window()->IsActive());
|
| + EXPECT_FALSE(popup_browser->SupportsWindowFeature(Browser::FEATURE_TOOLBAR));
|
| + EXPECT_EQ(popup_browser,
|
| + chrome::FindLastActiveWithProfile(browser()->profile(),
|
| + chrome::GetActiveDesktop()));
|
| +
|
| + // Load up the extension, which will call chrome.browserAction.openPopup()
|
| + // when it is loaded and verify that the popup didn't open.
|
| + ExtensionTestMessageListener listener("ready", true);
|
| + EXPECT_TRUE(LoadExtension(
|
| + test_data_dir_.AppendASCII("browser_action/open_popup_on_reply")));
|
| + EXPECT_TRUE(listener.WaitUntilSatisfied());
|
| +
|
| + ResultCatcher catcher;
|
| + listener.Reply(std::string());
|
| + EXPECT_TRUE(catcher.GetNextResult()) << message_;
|
| +}
|
| +
|
| } // namespace
|
| } // namespace extensions
|
|
|