OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "url/third_party/mozilla/url_parse.h" | 9 #include "url/third_party/mozilla/url_parse.h" |
10 #include "url/url_canon.h" | 10 #include "url/url_canon.h" |
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 {"http://host/a#b", true, false, "#", true, true, true, "http://host/a#"}, | 1983 {"http://host/a#b", true, false, "#", true, true, true, "http://host/a#"}, |
1984 {"http://host/a?foo=bar#hello", true, false, "#bye", true, true, true, "http
://host/a?foo=bar#bye"}, | 1984 {"http://host/a?foo=bar#hello", true, false, "#bye", true, true, true, "http
://host/a?foo=bar#bye"}, |
1985 // Non-hierarchical base: no relative handling. Relative input should | 1985 // Non-hierarchical base: no relative handling. Relative input should |
1986 // error, and if a scheme is present, it should be treated as absolute. | 1986 // error, and if a scheme is present, it should be treated as absolute. |
1987 {"data:foobar", false, false, "baz.html", false, false, false, NULL}, | 1987 {"data:foobar", false, false, "baz.html", false, false, false, NULL}, |
1988 {"data:foobar", false, false, "data:baz", true, false, false, NULL}, | 1988 {"data:foobar", false, false, "data:baz", true, false, false, NULL}, |
1989 {"data:foobar", false, false, "data:/base", true, false, false, NULL}, | 1989 {"data:foobar", false, false, "data:/base", true, false, false, NULL}, |
1990 // Non-hierarchical base: absolute input should succeed. | 1990 // Non-hierarchical base: absolute input should succeed. |
1991 {"data:foobar", false, false, "http://host/", true, false, false, NULL}, | 1991 {"data:foobar", false, false, "http://host/", true, false, false, NULL}, |
1992 {"data:foobar", false, false, "http:host", true, false, false, NULL}, | 1992 {"data:foobar", false, false, "http:host", true, false, false, NULL}, |
| 1993 // Non-hierarchical base: empty URL should give error. |
| 1994 {"data:foobar", false, false, "", false, false, false, NULL}, |
1993 // Invalid schemes should be treated as relative. | 1995 // Invalid schemes should be treated as relative. |
1994 {"http://foo/bar", true, false, "./asd:fgh", true, true, true, "http://foo/a
sd:fgh"}, | 1996 {"http://foo/bar", true, false, "./asd:fgh", true, true, true, "http://foo/a
sd:fgh"}, |
1995 {"http://foo/bar", true, false, ":foo", true, true, true, "http://foo/:foo"}
, | 1997 {"http://foo/bar", true, false, ":foo", true, true, true, "http://foo/:foo"}
, |
1996 {"http://foo/bar", true, false, " hello world", true, true, true, "http://fo
o/hello%20world"}, | 1998 {"http://foo/bar", true, false, " hello world", true, true, true, "http://fo
o/hello%20world"}, |
1997 {"data:asdf", false, false, ":foo", false, false, false, NULL}, | 1999 {"data:asdf", false, false, ":foo", false, false, false, NULL}, |
1998 {"data:asdf", false, false, "bad(':foo')", false, false, false, NULL}, | 2000 {"data:asdf", false, false, "bad(':foo')", false, false, false, NULL}, |
1999 // We should treat semicolons like any other character in URL resolving | 2001 // We should treat semicolons like any other character in URL resolving |
2000 {"http://host/a", true, false, ";foo", true, true, true, "http://host/;foo"}
, | 2002 {"http://host/a", true, false, ";foo", true, true, true, "http://host/;foo"}
, |
2001 {"http://host/a;", true, false, ";foo", true, true, true, "http://host/;foo"
}, | 2003 {"http://host/a;", true, false, ";foo", true, true, true, "http://host/;foo"
}, |
2002 {"http://host/a", true, false, ";/../bar", true, true, true, "http://host/ba
r"}, | 2004 {"http://host/a", true, false, ";/../bar", true, true, true, "http://host/ba
r"}, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 repl_output.Complete(); | 2158 repl_output.Complete(); |
2157 | 2159 |
2158 // Generate the expected string and check. | 2160 // Generate the expected string and check. |
2159 std::string expected("file:///foo?"); | 2161 std::string expected("file:///foo?"); |
2160 for (size_t i = 0; i < new_query.length(); i++) | 2162 for (size_t i = 0; i < new_query.length(); i++) |
2161 expected.push_back('a'); | 2163 expected.push_back('a'); |
2162 EXPECT_TRUE(expected == repl_str); | 2164 EXPECT_TRUE(expected == repl_str); |
2163 } | 2165 } |
2164 | 2166 |
2165 } // namespace url | 2167 } // namespace url |
OLD | NEW |