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

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: adjust two IDN test entries 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
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+1D68C(Math Monospace Small C) to 'c'.
Peter Kasting 2016/03/12 01:25:08 Nit: Space before '('
jungshik at Google 2016/03/16 08:34:54 Done.
406 {"ab\xf0\x9d\x9a\x8c.xyz", L"ab\U0001d68c.xyz", "abc.xyz",
407 Component(0, 7), CanonHostInfo::NEUTRAL, -1, ""},
405 // BiDi check test 408 // BiDi check test
406 // "Divehi" in Divehi (Thaana script) ends with BidiClass=NSM. 409 // "Divehi" in Divehi (Thaana script) ends with BidiClass=NSM.
407 // Disallowed in IDNA 2003 but now allowed in UTS 46/IDNA 2008. 410 // 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", 411 {"\xde\x8b\xde\xa8\xde\x88\xde\xac\xde\x80\xde\xa8",
409 L"\x78b\x7a8\x788\x7ac\x780\x7a8", "xn--hqbpi0jcw", 412 L"\x78b\x7a8\x788\x7ac\x780\x7a8", "xn--hqbpi0jcw",
410 Component(0, 13), CanonHostInfo::NEUTRAL, -1, ""}, 413 Component(0, 13), CanonHostInfo::NEUTRAL, -1, ""},
411 // Disallowed in both IDNA 2003 and 2008 with BiDi check. 414 // Disallowed in both IDNA 2003 and 2008 with BiDi check.
412 // Labels starting with a RTL character cannot end with a LTR character. 415 // Labels starting with a RTL character cannot end with a LTR character.
413 {"\xd8\xac\xd8\xa7\xd8\xb1xyz", L"\x62c\x627\x631xyz", 416 {"\xd8\xac\xd8\xa7\xd8\xb1xyz", L"\x62c\x627\x631xyz",
414 "%D8%AC%D8%A7%D8%B1xyz", Component(0, 21), 417 "%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(); 2162 repl_output.Complete();
2160 2163
2161 // Generate the expected string and check. 2164 // Generate the expected string and check.
2162 std::string expected("file:///foo?"); 2165 std::string expected("file:///foo?");
2163 for (size_t i = 0; i < new_query.length(); i++) 2166 for (size_t i = 0; i < new_query.length(); i++)
2164 expected.push_back('a'); 2167 expected.push_back('a');
2165 EXPECT_TRUE(expected == repl_str); 2168 EXPECT_TRUE(expected == repl_str);
2166 } 2169 }
2167 2170
2168 } // namespace url 2171 } // namespace url
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698