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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc

Issue 1035143002: Add IDN decoding test for SafeBrowsingBlockingPage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make IDN test parameterized Created 5 years, 9 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4443edd3991cddfb242bb68f3430db168463eea8 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;
@@ -796,3 +799,39 @@ INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageBrowserTestWithThreatType,
testing::Values(SB_THREAT_TYPE_URL_MALWARE,
SB_THREAT_TYPE_URL_PHISHING,
SB_THREAT_TYPE_URL_UNWANTED));
+
+// Test that SafeBrowsingBlockingPage properly decodes IDN URLs that are
+// displayed.
+class SafeBrowsingBlockingPageIDNTest
+ : public SecurityInterstitialIDNTest,
+ public testing::WithParamInterface<SBThreatType> {
+ protected:
+ // SecurityInterstitialIDNTest implementation
+ SecurityInterstitialPage* CreateInterstitial(
+ content::WebContents* contents,
+ const GURL& request_url) const override {
+ SafeBrowsingService* sb_service =
+ g_browser_process->safe_browsing_service();
+ SafeBrowsingBlockingPage::UnsafeResource resource;
+
+ resource.url = request_url;
+ resource.is_subresource = false;
+ resource.threat_type = GetParam();
+ resource.render_process_host_id = contents->GetRenderProcessHost()->GetID();
+ resource.render_view_id = contents->GetRenderViewHost()->GetRoutingID();
+
+ return SafeBrowsingBlockingPage::CreateBlockingPage(
+ sb_service->ui_manager().get(), contents, resource);
+ }
+};
+
+IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest,
+ SafeBrowsingBlockingPageDecodesIDN) {
+ EXPECT_TRUE(VerifyIDNDecoded());
+}
+
+INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageIDNTestWithThreatType,
+ SafeBrowsingBlockingPageIDNTest,
+ testing::Values(SB_THREAT_TYPE_URL_MALWARE,
+ SB_THREAT_TYPE_URL_PHISHING,
+ SB_THREAT_TYPE_URL_UNWANTED));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698