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

Unified Diff: components/url_formatter/url_formatter_unittest.cc

Issue 2595723003: url_formatter: Update comments for clarity. (Closed)
Patch Set: Rebase. Created 3 years, 11 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 | « components/url_formatter/url_formatter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/url_formatter/url_formatter_unittest.cc
diff --git a/components/url_formatter/url_formatter_unittest.cc b/components/url_formatter/url_formatter_unittest.cc
index c0fe9509a6d4ac21a85ed744678e9468412c3155..128c4c3f80d13b4f206bb62a10dcd8a9f72cb15d 100644
--- a/components/url_formatter/url_formatter_unittest.cc
+++ b/components/url_formatter/url_formatter_unittest.cc
@@ -27,11 +27,28 @@ using base::ASCIIToUTF16;
const size_t kNpos = base::string16::npos;
struct IDNTestCase {
+ // The IDNA/Punycode version of the domain (plain ASCII).
const char* const input;
+ // The equivalent Unicode version of the domain. Even if we expect the domain
+ // to be displayed in Punycode, this should still contain the Unicode
+ // equivalent (see |unicode_allowed|).
const wchar_t* unicode_output;
+ // Whether we expect the domain to be displayed decoded as a Unicode string
+ // (true) or in its Punycode form (false).
const bool unicode_allowed;
};
+// These cases can be generated with the following simple Python function:
+// import codecs
+// def make_case(case_name, unicode_domain, unicode_allowed=True):
+// idna_input = codecs.encode(unicode_domain, 'idna').decode('ascii')
+// unicode_output = 'L' + (ascii(unicode_domain)
+// .replace("'", '"')
+// .replace('\\u', '\\x'))
+// print(' // %s' % case_name)
+// print(' {"%s", %s, %s},' %
+// (idna_input, unicode_output, repr(unicode_allowed).lower()))
Peter Kasting 2017/02/06 21:54:14 You said this didn't warrant a separate tool, but
+
const IDNTestCase idn_cases[] = {
// No IDN
{"www.google.com", L"www.google.com", true},
« no previous file with comments | « components/url_formatter/url_formatter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698