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

Unified Diff: url/gurl_unittest.cc

Issue 2029213002: Fix generation of inner_url in GURL::ReplacementComponents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to comments Created 4 years, 6 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 | « url/gurl.cc ('k') | no next file » | 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 abc3f10634766d9b0bdfc2810aa1a606d41be4c1..4378db94547f44e5eb40186ef3c857347a593f67 100644
--- a/url/gurl_unittest.cc
+++ b/url/gurl_unittest.cc
@@ -401,13 +401,23 @@ TEST(GURLTest, Replacements) {
const char* ref;
const char* expected;
} replace_cases[] = {
- {"http://www.google.com/foo/bar.html?foo#bar", NULL, NULL, NULL, NULL, NULL, "/", "", "", "http://www.google.com/"},
- {"http://www.google.com/foo/bar.html?foo#bar", "javascript", "", "", "", "", "window.open('foo');", "", "", "javascript:window.open('foo');"},
- {"file:///C:/foo/bar.txt", "http", NULL, NULL, "www.google.com", "99", "/foo", "search", "ref", "http://www.google.com:99/foo?search#ref"},
+ {"http://www.google.com/foo/bar.html?foo#bar", NULL, NULL, NULL, NULL,
+ NULL, "/", "", "", "http://www.google.com/"},
+ {"http://www.google.com/foo/bar.html?foo#bar", "javascript", "", "", "",
+ "", "window.open('foo');", "", "", "javascript:window.open('foo');"},
+ {"file:///C:/foo/bar.txt", "http", NULL, NULL, "www.google.com", "99",
+ "/foo", "search", "ref", "http://www.google.com:99/foo?search#ref"},
#ifdef WIN32
- {"http://www.google.com/foo/bar.html?foo#bar", "file", "", "", "", "", "c:\\", "", "", "file:///C:/"},
+ {"http://www.google.com/foo/bar.html?foo#bar", "file", "", "", "", "",
+ "c:\\", "", "", "file:///C:/"},
#endif
- {"filesystem:http://www.google.com/foo/bar.html?foo#bar", NULL, NULL, NULL, NULL, NULL, "/", "", "", "filesystem:http://www.google.com/foo/"},
+ {"filesystem:http://www.google.com/foo/bar.html?foo#bar", NULL, NULL,
+ NULL, NULL, NULL, "/", "", "", "filesystem:http://www.google.com/foo/"},
+ // Lengthen the URL instead of shortening it, to test creation of
+ // inner_url.
+ {"filesystem:http://www.google.com/foo/", NULL, NULL, NULL, NULL, NULL,
+ "bar.html", "foo", "bar",
+ "filesystem:http://www.google.com/foo/bar.html?foo#bar"},
};
for (size_t i = 0; i < arraysize(replace_cases); i++) {
@@ -425,7 +435,14 @@ TEST(GURLTest, Replacements) {
GURL output = url.ReplaceComponents(repl);
EXPECT_EQ(replace_cases[i].expected, output.spec());
+
EXPECT_EQ(output.SchemeIsFileSystem(), output.inner_url() != NULL);
+ if (output.SchemeIsFileSystem()) {
+ // TODO(mmenke): inner_url()->spec() is currently the same as the spec()
+ // for the GURL itself. This should be fixed.
+ // See https://crbug.com/619596
+ EXPECT_EQ(replace_cases[i].expected, output.inner_url()->spec());
+ }
}
}
« no previous file with comments | « url/gurl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698