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

Unified Diff: url/url_util_unittest.cc

Issue 767713002: DoResolveRelative must not parse mailto schemes as path URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Next attempt Created 6 years 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 | « url/url_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util_unittest.cc
diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc
index aba44e469157733236927072cdf2888443e5e8e7..17c1b0f6b254a1f8a55f6f29bb30b4cdbec725d4 100644
--- a/url/url_util_unittest.cc
+++ b/url/url_util_unittest.cc
@@ -295,4 +295,25 @@ TEST(URLUtilTest, TestResolveRelativeWithNonStandardBase) {
}
}
+TEST(URLUtilTest, TestNoRefComponent) {
+ // The hash-mark must be ignored when mailto: scheme is
+ // parsed, even if the url has a base and relative part.
+ const char* base = "mailto://to/";
+ const char* rel = "any#body";
+
+ Parsed base_parsed;
+ ParsePathURL(base, strlen(base), false, &base_parsed);
+
+ std::string resolved;
+ StdStringCanonOutput output(&resolved);
+ Parsed resolved_parsed;
+
+ bool valid = ResolveRelative(base, strlen(base),
+ base_parsed, rel,
+ strlen(rel), NULL, &output,
+ &resolved_parsed);
+ EXPECT_TRUE(valid);
+ EXPECT_FALSE(resolved_parsed.ref.is_valid());
+}
+
} // namespace url
« no previous file with comments | « url/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698