| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 6 #include "chrome/browser/extensions/extension_install_prompt.h" | 7 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 9 #include "chrome/browser/extensions/webstore_inline_installer.h" | 10 #include "chrome/browser/extensions/webstore_inline_installer.h" |
| 10 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" | 11 #include "chrome/browser/extensions/webstore_inline_installer_factory.h" |
| 11 #include "chrome/browser/extensions/webstore_installer_test.h" | 12 #include "chrome/browser/extensions/webstore_installer_test.h" |
| 12 #include "chrome/browser/extensions/webstore_standalone_installer.h" | 13 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 base::RunLoop().RunUntilIdle(); | 143 base::RunLoop().RunUntilIdle(); |
| 143 web_contents->Close(); | 144 web_contents->Close(); |
| 144 ProgrammableInstallPrompt::Accept(); | 145 ProgrammableInstallPrompt::Accept(); |
| 145 } | 146 } |
| 146 | 147 |
| 147 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, | 148 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerTest, |
| 148 ShouldBlockInlineInstallFromPopupWindow) { | 149 ShouldBlockInlineInstallFromPopupWindow) { |
| 149 GURL install_url = | 150 GURL install_url = |
| 150 GenerateTestServerUrl(kAppDomain, "install_from_popup.html"); | 151 GenerateTestServerUrl(kAppDomain, "install_from_popup.html"); |
| 151 // Disable popup blocking for the test url. | 152 // Disable popup blocking for the test url. |
| 152 browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( | 153 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
| 153 ContentSettingsPattern::FromURL(install_url), | 154 ->SetContentSetting(ContentSettingsPattern::FromURL(install_url), |
| 154 ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_POPUPS, | 155 ContentSettingsPattern::Wildcard(), |
| 155 std::string(), CONTENT_SETTING_ALLOW); | 156 CONTENT_SETTINGS_TYPE_POPUPS, |
| 157 std::string(), |
| 158 CONTENT_SETTING_ALLOW); |
| 156 ui_test_utils::NavigateToURL(browser(), install_url); | 159 ui_test_utils::NavigateToURL(browser(), install_url); |
| 157 // The test page opens a popup which is a new |browser| window. | 160 // The test page opens a popup which is a new |browser| window. |
| 158 Browser* popup_browser = chrome::FindLastActiveWithProfile( | 161 Browser* popup_browser = chrome::FindLastActiveWithProfile( |
| 159 browser()->profile(), chrome::GetActiveDesktop()); | 162 browser()->profile(), chrome::GetActiveDesktop()); |
| 160 WebContents* popup_contents = | 163 WebContents* popup_contents = |
| 161 popup_browser->tab_strip_model()->GetActiveWebContents(); | 164 popup_browser->tab_strip_model()->GetActiveWebContents(); |
| 162 EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle()); | 165 EXPECT_EQ(base::ASCIIToUTF16("POPUP"), popup_contents->GetTitle()); |
| 163 RunTest(popup_contents, "runTest"); | 166 RunTest(popup_contents, "runTest"); |
| 164 } | 167 } |
| 165 | 168 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, | 241 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, |
| 239 DownloadProgressListenerTest) { | 242 DownloadProgressListenerTest) { |
| 240 RunTest("download_progress_listener.html"); | 243 RunTest("download_progress_listener.html"); |
| 241 } | 244 } |
| 242 | 245 |
| 243 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { | 246 IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallerListenerTest, BothListenersTest) { |
| 244 RunTest("both_listeners.html"); | 247 RunTest("both_listeners.html"); |
| 245 } | 248 } |
| 246 | 249 |
| 247 } // namespace extensions | 250 } // namespace extensions |
| OLD | NEW |