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

Unified Diff: url/url_canon_unittest.cc

Issue 2378213002: Mark URLs with empty schemes as invalid. (Closed)
Patch Set: . Created 4 years, 3 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
« url/url_canon_etc.cc ('K') | « url/url_canon_etc.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_canon_unittest.cc
diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc
index f5fedfc52edac9ac2c71dfbf9b5f14dc7a3fd6e5..6698e56f96ff1f8ee05d6f4011d46d6c91586dd0 100644
--- a/url/url_canon_unittest.cc
+++ b/url/url_canon_unittest.cc
@@ -282,7 +282,7 @@ TEST(URLCanonTest, Scheme) {
out_str.clear();
StdStringCanonOutput output(&out_str);
- EXPECT_TRUE(CanonicalizeScheme("", Component(0, -1), &output, &out_comp));
+ EXPECT_FALSE(CanonicalizeScheme("", Component(0, -1), &output, &out_comp));
output.Complete();
EXPECT_EQ(std::string(":"), out_str);
@@ -1303,7 +1303,7 @@ TEST(URLCanonTest, CanonicalizeStandardURL) {
{"http://[www.google.com]/", "http://[www.google.com]/", false},
{"ht\ttp:@www.google.com:80/;p?#", "ht%09tp://www.google.com:80/;p?#", false},
{"http:////////user:@google.com:99?foo", "http://user@google.com:99/?foo", true},
- {"www.google.com", ":www.google.com/", true},
+ {"www.google.com", ":www.google.com/", false},
{"http://192.0x00A80001", "http://192.168.0.1/", true},
{"http://www/foo%2Ehtml", "http://www/foo.html", true},
{"http://user:pass@/", "http://user:pass@/", false},
@@ -1754,11 +1754,12 @@ TEST(URLCanonTest, CanonicalizePathURL) {
// Path URLs should get canonicalized schemes but nothing else.
struct PathCase {
const char* input;
+ bool expected_success;
const char* expected;
} path_cases[] = {
- {"javascript:", "javascript:"},
- {"JavaScript:Foo", "javascript:Foo"},
- {":\":This /is interesting;?#", ":\":This /is interesting;?#"},
+ {"javascript:", true, "javascript:"},
+ {"JavaScript:Foo", true, "javascript:Foo"},
+ {":\":This /is interesting;?#", false, ":\":This /is interesting;?#"},
Peter Kasting 2016/09/29 04:54:12 Should this have instead dropped the initial colon
};
for (size_t i = 0; i < arraysize(path_cases); i++) {
@@ -1773,7 +1774,7 @@ TEST(URLCanonTest, CanonicalizePathURL) {
&output, &out_parsed);
output.Complete();
- EXPECT_TRUE(success);
+ EXPECT_EQ(path_cases[i].expected_success, success);
EXPECT_EQ(path_cases[i].expected, out_str);
EXPECT_EQ(0, out_parsed.host.begin);
« url/url_canon_etc.cc ('K') | « url/url_canon_etc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698