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

Unified Diff: components/url_formatter/url_formatter_unittest.cc

Issue 2880983002: Added a Python script in tools/ to generate IDN test cases. (Closed)
Patch Set: Minor refactor. Created 3 years, 7 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 | tools/security/idn_test_case_generator.py » ('j') | 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 d4ffb3ca509e8bfd6b0d04e514375411aaf7fd10..95fb234df3641ec5f6ae44a7fd57d5acb87ae6a7 100644
--- a/components/url_formatter/url_formatter_unittest.cc
+++ b/components/url_formatter/url_formatter_unittest.cc
@@ -38,6 +38,19 @@ struct IDNTestCase {
const bool unicode_allowed;
};
+// These cases can be generated with the script
+// tools/security/idn_test_case_generator.py.
+// See documentation there: you can either run it from the command line or call
+// the make_case function directly from the Python shell (which may be easier
+// for entering Unicode text).
+//
+// Q: Why not just do this conversion right here in the test, rather than having
+// a Python script to generate it?
+// A: Because then we would have to rely on complex logic (IDNA encoding) in the
+// test itself; the same code we are trying to test. By using Python's IDN
+// encoder to generate the test data, we independently verify that our
+// algorithm is correct.
+
// TODO(jshin): Replace L"..." with "..." in UTF-8 when it's easier to read.
const IDNTestCase idn_cases[] = {
// No IDN
« no previous file with comments | « no previous file | tools/security/idn_test_case_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698