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

Side by Side Diff: components/url_formatter/url_formatter_unittest.cc

Issue 2613603002: url_formatter: Remove U+2010 from the displayable character set. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « components/url_formatter/url_formatter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/url_formatter/url_formatter.h" 5 #include "components/url_formatter/url_formatter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 {"google.xn--comabc-k8d", L"google.com\x0338" L"abc", false}, 283 {"google.xn--comabc-k8d", L"google.com\x0338" L"abc", false},
284 // Hyphenation Point instead of Katakana Middle dot 284 // Hyphenation Point instead of Katakana Middle dot
285 {"xn--svgy16dha.jp", L"\x30a1\x2027\x30a3.jp", false}, 285 {"xn--svgy16dha.jp", L"\x30a1\x2027\x30a3.jp", false},
286 // Gershayim with other Hebrew characters is allowed. 286 // Gershayim with other Hebrew characters is allowed.
287 {"xn--5db6bh9b.il", L"\x05e9\x05d1\x05f4\x05e6.il", true}, 287 {"xn--5db6bh9b.il", L"\x05e9\x05d1\x05f4\x05e6.il", true},
288 // Hebrew Gershayim with Latin is disallowed. 288 // Hebrew Gershayim with Latin is disallowed.
289 {"xn--ab-yod.com", L"a\x05f4" L"b.com", false}, 289 {"xn--ab-yod.com", L"a\x05f4" L"b.com", false},
290 // Hebrew Gershayim with Arabic is disallowed. 290 // Hebrew Gershayim with Arabic is disallowed.
291 {"xn--5eb7h.eg", L"\x0628\x05f4.eg", false}, 291 {"xn--5eb7h.eg", L"\x0628\x05f4.eg", false},
292 292
293 // Hyphens (http://unicode.org/cldr/utility/confusables.jsp?a=-)
294 // Hyphen-Minus (the only hyphen allowed)
295 // abc-def
296 {"abc-def.com", L"abc-def.com", true},
297 // Modifier Letter Minus Sign
298 {"xn--abcdef-5od.com", L"abc\x02d7" L"def.com", false},
299 // Hyphen
300 {"xn--abcdef-dg0c.com", L"abc\x2010" L"def.com", false},
301 // Non-Breaking Hyphen
302 // This is actually an invalid IDNA domain (U+2011 normalizes to U+2010), but
303 // it is included to ensure that we do not inadvertently allow this character
304 // to be displayed as Unicode.
305 {"xn--abcdef-kg0c.com", L"abc\x2011" L"def.com", false},
306 // Figure Dash
307 {"xn--abcdef-rg0c.com", L"abc\x2012" L"def.com", false},
308 // En Dash
309 {"xn--abcdef-yg0c.com", L"abc\x2013" L"def.com", false},
310 // Hyphen Bullet
311 {"xn--abcdef-kq0c.com", L"abc\x2043" L"def.com", false},
312 // Minus Sign
313 {"xn--abcdef-5d3c.com", L"abc\x2212" L"def.com", false},
314 // Heavy Minus Sign
315 {"xn--abcdef-kg1d.com", L"abc\x2796" L"def.com", false},
316 // Coptic Capital Letter Dialect-P Ni
317 {"xn--abcdef-yy8d.com", L"abc\x2cba" L"def.com", false},
318 // Small Em Dash
319 {"xn--abcdef-5g0c.com", L"abc\xfe58" L"def.com", false},
320
293 // Custom dangerous patterns 321 // Custom dangerous patterns
294 // Two Katakana-Hiragana combining mark in a row 322 // Two Katakana-Hiragana combining mark in a row
295 {"google.xn--com-oh4ba.evil.jp", L"google.com\x309a\x309a.evil.jp", false}, 323 {"google.xn--com-oh4ba.evil.jp", L"google.com\x309a\x309a.evil.jp", false},
296 // Katakana Letter No not enclosed by {Han,Hiragana,Katakana}. 324 // Katakana Letter No not enclosed by {Han,Hiragana,Katakana}.
297 {"google.xn--comevil-v04f.jp", L"google.com\x30ce" L"evil.jp", false}, 325 {"google.xn--comevil-v04f.jp", L"google.com\x30ce" L"evil.jp", false},
298 // TODO(jshin): Review the danger of allowing the following two. 326 // TODO(jshin): Review the danger of allowing the following two.
299 // Hiragana 'No' by itself is allowed. 327 // Hiragana 'No' by itself is allowed.
300 {"xn--ldk.jp", L"\x30ce.jp", true}, 328 {"xn--ldk.jp", L"\x30ce.jp", true},
301 // Hebrew Gershayim used by itself is allowed. 329 // Hebrew Gershayim used by itself is allowed.
302 {"xn--5eb.il", L"\x05f4.il", true}, 330 {"xn--5eb.il", L"\x05f4.il", true},
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 0, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, kNpos, kNpos, kNpos, kNpos, 921 0, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, kNpos, kNpos, kNpos, kNpos,
894 0, 1, 2, 3, 4, 5, 6, 7 922 0, 1, 2, 3, 4, 5, 6, 7
895 }; 923 };
896 CheckAdjustedOffsets("http://user@foo.com/", kFormatUrlOmitAll, 924 CheckAdjustedOffsets("http://user@foo.com/", kFormatUrlOmitAll,
897 net::UnescapeRule::NORMAL, omit_all_offsets); 925 net::UnescapeRule::NORMAL, omit_all_offsets);
898 } 926 }
899 927
900 } // namespace 928 } // namespace
901 929
902 } // namespace url_formatter 930 } // namespace url_formatter
OLDNEW
« 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