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

Side by Side Diff: url/url_canon_unittest.cc

Issue 1258813002: Implement a new IDN display policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comment update per Peter Created 4 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 unified diff | Download patch
« no previous file with comments | « components/url_formatter/url_formatter_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <errno.h> 5 #include <errno.h>
6 #include <stddef.h> 6 #include <stddef.h>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "url/third_party/mozilla/url_parse.h" 10 #include "url/third_party/mozilla/url_parse.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // "punctuation and symbol" blocked in IDNA 2008. 395 // "punctuation and symbol" blocked in IDNA 2008.
396 // UTS 46 table 4, row (j) 396 // UTS 46 table 4, row (j)
397 {"\xe2\x82\xb7.com", L"\x20b7.com", "xn--wzg.com", 397 {"\xe2\x82\xb7.com", L"\x20b7.com", "xn--wzg.com",
398 Component(0, 11), CanonHostInfo::NEUTRAL, -1, ""}, 398 Component(0, 11), CanonHostInfo::NEUTRAL, -1, ""},
399 // Maps uppercase letters to lower case letters. 399 // Maps uppercase letters to lower case letters.
400 // In IDNA 2003, it's allowed without case-folding 400 // In IDNA 2003, it's allowed without case-folding
401 // ( xn--bc-7cb.com ) because it's not defined in Unicode 3.2 401 // ( xn--bc-7cb.com ) because it's not defined in Unicode 3.2
402 // (added in Unicode 4.1). UTS 46 table 4 row (k) 402 // (added in Unicode 4.1). UTS 46 table 4 row (k)
403 {"bc\xc8\xba.com", L"bc\x23a.com", "xn--bc-is1a.com", 403 {"bc\xc8\xba.com", L"bc\x23a.com", "xn--bc-is1a.com",
404 Component(0, 15), CanonHostInfo::NEUTRAL, -1, ""}, 404 Component(0, 15), CanonHostInfo::NEUTRAL, -1, ""},
405 // Maps U+FF43 (Full Width Small Letter C) to 'c'.
406 {"ab\xef\xbd\x83.xyz", L"ab\xff43.xyz", "abc.xyz",
407 Component(0, 7), CanonHostInfo::NEUTRAL, -1, ""},
408 // Maps U+1D68C (Math Monospace Small C) to 'c'.
409 // U+1D68C = \xD835\xDE8C in UTF-16
410 {"ab\xf0\x9d\x9a\x8c.xyz", L"ab\xd835\xde8c.xyz", "abc.xyz",
411 Component(0, 7), CanonHostInfo::NEUTRAL, -1, ""},
405 // BiDi check test 412 // BiDi check test
406 // "Divehi" in Divehi (Thaana script) ends with BidiClass=NSM. 413 // "Divehi" in Divehi (Thaana script) ends with BidiClass=NSM.
407 // Disallowed in IDNA 2003 but now allowed in UTS 46/IDNA 2008. 414 // Disallowed in IDNA 2003 but now allowed in UTS 46/IDNA 2008.
408 {"\xde\x8b\xde\xa8\xde\x88\xde\xac\xde\x80\xde\xa8", 415 {"\xde\x8b\xde\xa8\xde\x88\xde\xac\xde\x80\xde\xa8",
409 L"\x78b\x7a8\x788\x7ac\x780\x7a8", "xn--hqbpi0jcw", 416 L"\x78b\x7a8\x788\x7ac\x780\x7a8", "xn--hqbpi0jcw",
410 Component(0, 13), CanonHostInfo::NEUTRAL, -1, ""}, 417 Component(0, 13), CanonHostInfo::NEUTRAL, -1, ""},
411 // Disallowed in both IDNA 2003 and 2008 with BiDi check. 418 // Disallowed in both IDNA 2003 and 2008 with BiDi check.
412 // Labels starting with a RTL character cannot end with a LTR character. 419 // Labels starting with a RTL character cannot end with a LTR character.
413 {"\xd8\xac\xd8\xa7\xd8\xb1xyz", L"\x62c\x627\x631xyz", 420 {"\xd8\xac\xd8\xa7\xd8\xb1xyz", L"\x62c\x627\x631xyz",
414 "%D8%AC%D8%A7%D8%B1xyz", Component(0, 21), 421 "%D8%AC%D8%A7%D8%B1xyz", Component(0, 21),
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 repl_output.Complete(); 2166 repl_output.Complete();
2160 2167
2161 // Generate the expected string and check. 2168 // Generate the expected string and check.
2162 std::string expected("file:///foo?"); 2169 std::string expected("file:///foo?");
2163 for (size_t i = 0; i < new_query.length(); i++) 2170 for (size_t i = 0; i < new_query.length(); i++)
2164 expected.push_back('a'); 2171 expected.push_back('a');
2165 EXPECT_TRUE(expected == repl_str); 2172 EXPECT_TRUE(expected == repl_str);
2166 } 2173 }
2167 2174
2168 } // namespace url 2175 } // namespace url
OLDNEW
« no previous file with comments | « components/url_formatter/url_formatter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698