OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 base::string16 formatted = FormatUrl( | 1084 base::string16 formatted = FormatUrl( |
1085 GURL(tests[i].input), tests[i].languages, tests[i].format_types, | 1085 GURL(tests[i].input), tests[i].languages, tests[i].format_types, |
1086 tests[i].escape_rules, NULL, &prefix_len, NULL); | 1086 tests[i].escape_rules, NULL, &prefix_len, NULL); |
1087 EXPECT_EQ(WideToUTF16(tests[i].output), formatted) << tests[i].description; | 1087 EXPECT_EQ(WideToUTF16(tests[i].output), formatted) << tests[i].description; |
1088 EXPECT_EQ(tests[i].prefix_len, prefix_len) << tests[i].description; | 1088 EXPECT_EQ(tests[i].prefix_len, prefix_len) << tests[i].description; |
1089 } | 1089 } |
1090 } | 1090 } |
1091 | 1091 |
1092 TEST(NetUtilTest, FormatUrlParsed) { | 1092 TEST(NetUtilTest, FormatUrlParsed) { |
1093 // No unescape case. | 1093 // No unescape case. |
1094 url_parse::Parsed parsed; | 1094 url::Parsed parsed; |
1095 base::string16 formatted = FormatUrl( | 1095 base::string16 formatted = FormatUrl( |
1096 GURL("http://\xE3\x82\xB0:\xE3\x83\xBC@xn--qcka1pmc.jp:8080/" | 1096 GURL("http://\xE3\x82\xB0:\xE3\x83\xBC@xn--qcka1pmc.jp:8080/" |
1097 "%E3%82%B0/?q=%E3%82%B0#\xE3\x82\xB0"), | 1097 "%E3%82%B0/?q=%E3%82%B0#\xE3\x82\xB0"), |
1098 "ja", kFormatUrlOmitNothing, UnescapeRule::NONE, &parsed, NULL, | 1098 "ja", kFormatUrlOmitNothing, UnescapeRule::NONE, &parsed, NULL, |
1099 NULL); | 1099 NULL); |
1100 EXPECT_EQ(WideToUTF16( | 1100 EXPECT_EQ(WideToUTF16( |
1101 L"http://%E3%82%B0:%E3%83%BC@\x30B0\x30FC\x30B0\x30EB.jp:8080" | 1101 L"http://%E3%82%B0:%E3%83%BC@\x30B0\x30FC\x30B0\x30EB.jp:8080" |
1102 L"/%E3%82%B0/?q=%E3%82%B0#\x30B0"), formatted); | 1102 L"/%E3%82%B0/?q=%E3%82%B0#\x30B0"), formatted); |
1103 EXPECT_EQ(WideToUTF16(L"%E3%82%B0"), | 1103 EXPECT_EQ(WideToUTF16(L"%E3%82%B0"), |
1104 formatted.substr(parsed.username.begin, parsed.username.len)); | 1104 formatted.substr(parsed.username.begin, parsed.username.len)); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 1886 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
1887 const NonUniqueNameTestData& test_data = GetParam(); | 1887 const NonUniqueNameTestData& test_data = GetParam(); |
1888 | 1888 |
1889 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 1889 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
1890 } | 1890 } |
1891 | 1891 |
1892 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 1892 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
1893 testing::ValuesIn(kNonUniqueNameTestData)); | 1893 testing::ValuesIn(kNonUniqueNameTestData)); |
1894 | 1894 |
1895 } // namespace net | 1895 } // namespace net |
OLD | NEW |