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

Unified Diff: url/gurl_unittest.cc

Issue 23835019: Support URL fragment resolution againt non-hierarchical schemes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: brettw2 Created 7 years, 1 month 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/gurl.cc ('k') | url/third_party/mozilla/url_parse.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/gurl_unittest.cc
diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc
index 67da8e48259c4d61de6bde061c6beda6185e5b03..1f0568f5b06b1b5837f2b6cf37740d20823b873f 100644
--- a/url/gurl_unittest.cc
+++ b/url/gurl_unittest.cc
@@ -350,6 +350,29 @@ TEST(GURLTest, Replacements) {
}
}
+TEST(GURLTest, ClearFragmentOnDataUrl) {
+ // http://crbug.com/291747 - a data URL may legitimately have trailing
+ // whitespace in the spec after the ref is cleared. Test this does not trigger
+ // the url_parse::Parsed importing validation DCHECK in GURL.
+ GURL url(" data: one ? two # three ");
+
+ // By default the trailing whitespace will have been stripped.
+ EXPECT_EQ("data: one ? two # three", url.spec());
+ GURL::Replacements repl;
+ repl.ClearRef();
+ GURL url_no_ref = url.ReplaceComponents(repl);
+
+ EXPECT_EQ("data: one ? two ", url_no_ref.spec());
+
+ // Importing a parsed url via this constructor overload will retain trailing
+ // whitespace.
+ GURL import_url(url_no_ref.spec(),
+ url_no_ref.parsed_for_possibly_invalid_spec(),
+ url_no_ref.is_valid());
+ EXPECT_EQ(url_no_ref, import_url);
+ EXPECT_EQ(import_url.query(), " two ");
+}
+
TEST(GURLTest, PathForRequest) {
struct TestCase {
const char* input;
« no previous file with comments | « url/gurl.cc ('k') | url/third_party/mozilla/url_parse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698