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

Unified Diff: net/base/net_util_icu_unittest.cc

Issue 1131813004: Revert of Create net::FormatOriginForDisplay helper function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « net/base/net_util_icu.cc ('k') | url/gurl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_icu_unittest.cc
diff --git a/net/base/net_util_icu_unittest.cc b/net/base/net_util_icu_unittest.cc
index 811a46d2dea9f9aee757733da04cda845d997ffe..1b315c297c45edcb773d884c058208d3c9991aed 100644
--- a/net/base/net_util_icu_unittest.cc
+++ b/net/base/net_util_icu_unittest.cc
@@ -362,14 +362,6 @@
UnescapeRule::Type escape_rules;
const wchar_t* output; // Use |wchar_t| to handle Unicode constants easily.
size_t prefix_len;
-};
-
-struct OriginTestData {
- const char* description;
- const char* input;
- const char* languages;
- const bool omit_scheme;
- const wchar_t* output;
};
// A helper for IDN*{Fast,Slow}.
@@ -1089,175 +1081,4 @@
UnescapeRule::NORMAL, omit_all_offsets);
}
-TEST(NetUtilTest, FormatOriginForDisplay) {
- const OriginTestData tests[] = {
- {"Empty URL", "", "", false, L""},
- {"HTTP URL, no omit scheme",
- "http://www.google.com/",
- "",
- false,
- L"http://www.google.com"},
- {"HTTP URL, omit scheme",
- "http://www.google.com/",
- "",
- true,
- L"www.google.com"},
- {"HTTPS URL, no omit scheme",
- "https://www.google.com/",
- "",
- false,
- L"https://www.google.com"},
- {"HTTPS URL, omit scheme",
- "https://www.google.com/",
- "",
- true,
- L"www.google.com"},
- {"Standard HTTP port",
- "http://www.google.com:80/",
- "",
- false,
- L"http://www.google.com"},
- {"Standard HTTPS port",
- "https://www.google.com:443/",
- "",
- false,
- L"https://www.google.com"},
- {"Non-standard HTTP port",
- "http://www.google.com:9000/",
- "",
- false,
- L"http://www.google.com:9000"},
- {"Non-standard HTTPS port",
- "https://www.google.com:9000/",
- "",
- false,
- L"https://www.google.com:9000"},
- {"File URI, omit scheme",
- "file:///usr/example/file.html",
- "",
- true,
- L"/usr/example/file.html"},
- {"File URI, no omit scheme",
- "file:///usr/example/file.html",
- "",
- false,
- L"file:///usr/example/file.html"},
- {"File URI with hostname, omit scheme",
- "file://localhost/usr/example/file.html",
- "",
- true,
- L"/usr/example/file.html"},
- {"File URI with hostname, no omit scheme",
- "file://localhost/usr/example/file.html",
- "",
- false,
- L"file:///usr/example/file.html"},
- {"HTTP URL with path",
- "http://www.google.com/test.html",
- "",
- false,
- L"http://www.google.com"},
- {"HTTPS URL with path",
- "https://www.google.com/test.html",
- "",
- false,
- L"https://www.google.com"},
- {"Unusual secure scheme (wss)",
- "wss://www.google.com/",
- "",
- false,
- L"wss://www.google.com"},
- {"Unusual non-secure scheme (gopher)",
- "gopher://www.google.com/",
- "",
- false,
- L"gopher://www.google.com"},
- {"Unlisted scheme (chrome)",
- "chrome://version",
- "",
- false,
- L"chrome://version"},
- {"HTTP IP address",
- "http://173.194.65.103",
- "",
- false,
- L"http://173.194.65.103"},
- {"HTTPS IP address",
- "https://173.194.65.103",
- "",
- false,
- L"https://173.194.65.103"},
- {"HTTPS IP address, non-default port",
- "https://173.194.65.103:8443",
- "",
- false,
- L"https://173.194.65.103:8443"},
- {"HTTPS IP address, omit scheme",
- "https://173.194.65.103",
- "",
- true,
- L"173.194.65.103"},
- {"HTTP filesystem: URL with path",
- "filesystem:http://www.google.com/temporary/test.html",
- "",
- false,
- L"filesystem:http://www.google.com"},
- {"HTTP filesystem: URL with path, omit scheme",
- "filesystem:http://www.google.com/persistent/test.html",
- "",
- true,
- L"filesystem:www.google.com"},
- {"File filesystem: URL with path",
- "filesystem:file://localhost/temporary/stuff/test.html?z=fun&goat=billy",
- "",
- false,
- L"filesystem:file:///temporary/stuff/test.html"},
- {"File filesystem: URL with path, omit scheme",
- "filesystem:file://cyber.com/persistent/stuff/test.html?y=z#abc",
- "",
- true,
- L"filesystem:/persistent/stuff/test.html"},
- {"Invalid scheme 1",
- "twelve://www.cyber.org/wow.php",
- "",
- false,
- L"twelve://www.cyber.org/wow.php"},
- {"Invalid scheme 2",
- "://www.cyber.org/wow.php",
- "",
- false,
- L"://www.cyber.org/wow.php"},
- {"Invalid host 1",
- "https://www.cyber../wow.php",
- "",
- false,
- L"https://www.cyber.."},
- {"Invalid host 2",
- "https://www...cyber/wow.php",
- "",
- false,
- L"https://www...cyber"},
- {"Invalid port 1",
- "https://173.194.65.103:000",
- "",
- false,
- L"https://173.194.65.103"},
- {"Invalid port 2",
- "https://173.194.65.103:gruffle",
- "",
- false,
- L"https://173.194.65.103:gruffle"},
- {"Invalid port 3",
- "https://173.194.65.103:/hello.aspx",
- "",
- false,
- L"https://173.194.65.103"},
- };
- for (size_t i = 0; i < arraysize(tests); ++i) {
- base::string16 formatted = FormatOriginForDisplay(
- GURL(tests[i].input), tests[i].languages, tests[i].omit_scheme);
- EXPECT_EQ(WideToUTF16(tests[i].output), formatted) << tests[i].description;
- }
-}
-
} // namespace net
« no previous file with comments | « net/base/net_util_icu.cc ('k') | url/gurl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698