Chromium Code Reviews| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc |
| diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc |
| index e79310f10843fe4833403dfe6ea8757311e42454..5fe2d14036cbf01d394eeb13018236a1711e8d8d 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc |
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc |
| @@ -13,6 +13,7 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/values.h" |
| #include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/safe_browsing/database_manager.h" |
| #include "chrome/browser/safe_browsing/malware_details.h" |
| @@ -33,12 +34,14 @@ |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/notification_types.h" |
| #include "content/public/browser/render_frame_host.h" |
| +#include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/test/browser_test_utils.h" |
| #include "content/public/test/test_browser_thread.h" |
| #include "content/public/test/test_utils.h" |
| +using chrome_browser_interstitials::SecurityInterstitialIDNTest; |
| using content::BrowserThread; |
| using content::InterstitialPage; |
| using content::NavigationController; |
| @@ -791,6 +794,38 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, LearnMore) { |
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); |
| } |
| +// Test that SafeBrowsingBlockingPage properly decodes IDN URLs that are |
| +// displayed. |
| +class SafeBrowsingBlockingPageIDNTest : public SecurityInterstitialIDNTest { |
| + protected: |
| + // SecurityInterstitialIDNTest implementation |
| + SecurityInterstitialPage* CreateInterstitial( |
| + content::WebContents* contents, |
| + const GURL& request_url) const override { |
| + SafeBrowsingService* sb_service = |
| + g_browser_process->safe_browsing_service(); |
| + SafeBrowsingBlockingPage::UnsafeResourceList resource_list; |
| + SafeBrowsingBlockingPage::UnsafeResource resource; |
| + |
| + resource.url = request_url; |
| + resource.is_subresource = false; |
| + resource.threat_type = SB_THREAT_TYPE_URL_MALWARE; |
| + resource.render_process_host_id = contents->GetRenderProcessHost()->GetID(); |
| + resource.render_view_id = contents->GetRenderViewHost()->GetRoutingID(); |
| + resource_list.push_back(resource); |
| + |
| + // Use a TestSafeBrowsingBlockingPage because it has a public |
| + // constructor, unlike the real thing. |
|
mattm
2015/03/27 22:47:25
Does that matter for this test? woudn't SafeBrowsi
estark
2015/03/27 22:51:49
Done.
|
| + return new TestSafeBrowsingBlockingPage(sb_service->ui_manager().get(), |
| + contents, resource_list); |
| + } |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageIDNTest, |
| + SafeBrowsingBlockingPageDecodesIDN) { |
| + EXPECT_TRUE(VerifyIDNDecoded()); |
| +} |
| + |
| INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageBrowserTestWithThreatType, |
| SafeBrowsingBlockingPageBrowserTest, |
| testing::Values(SB_THREAT_TYPE_URL_MALWARE, |