Index: chrome/browser/extensions/webstore_inline_installer_browsertest.cc |
diff --git a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc |
index f06cfa6f237132848b74bdf18430422ac528df48..270d7cf84b3b0a5c0ac15b240494c32072101cd8 100644 |
--- a/chrome/browser/extensions/webstore_inline_installer_browsertest.cc |
+++ b/chrome/browser/extensions/webstore_inline_installer_browsertest.cc |
@@ -2,6 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/extensions/extension_install_prompt.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/extensions/tab_helper.h" |
@@ -11,8 +12,10 @@ |
#include "chrome/browser/extensions/webstore_standalone_installer.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/test/base/ui_test_utils.h" |
+#include "components/content_settings/core/browser/host_content_settings_map.h" |
#include "content/public/browser/web_contents.h" |
#include "extensions/browser/extension_registry.h" |
#include "extensions/browser/extension_system.h" |
@@ -126,7 +129,7 @@ class WebstoreInlineInstallerForTestFactory : |
}; |
IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
- CloseTabBeforeInstallConfirmation) { |
+ CloseTabBeforeInstallConfirmation) { |
GURL install_url = GenerateTestServerUrl(kAppDomain, "install.html"); |
ui_test_utils::NavigateToURL(browser(), install_url); |
WebContents* web_contents = |
@@ -141,6 +144,25 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
ProgrammableInstallPrompt::Accept(); |
} |
+IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
+ ShouldBlockInlineInstallFromPopupWindow) { |
+ GURL install_url = |
+ GenerateTestServerUrl(kAppDomain, "install_from_popup.html"); |
+ // Disable popup blocking for the test url. |
+ browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( |
+ ContentSettingsPattern::FromURL(install_url), |
+ ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_POPUPS, |
+ std::string(), CONTENT_SETTING_ALLOW); |
+ ui_test_utils::NavigateToURL(browser(), install_url); |
+ // The test page opens a popup which is a new |browser| window. |
+ Browser* popup_browser = chrome::FindLastActiveWithProfile( |
+ browser()->profile(), chrome::GetActiveDesktop()); |
+ WebContents* popup_contents = |
+ popup_browser->tab_strip_model()->GetActiveWebContents(); |
+ EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle()); |
+ RunTest(popup_contents, "runTest"); |
+} |
+ |
// Ensure that inline-installing a disabled extension simply re-enables it. |
IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
ReinstallDisabledExtension) { |