OLD | NEW |
1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2029 // Filesystem URL tests; filesystem URLs are only valid and relative if | 2029 // Filesystem URL tests; filesystem URLs are only valid and relative if |
2030 // they have no scheme, e.g. "./index.html". There's no valid equivalent | 2030 // they have no scheme, e.g. "./index.html". There's no valid equivalent |
2031 // to http:index.html. | 2031 // to http:index.html. |
2032 {"filesystem:http://host/t/path", true, false, "filesystem:http://host/t/pat
h2", true, false, false, NULL}, | 2032 {"filesystem:http://host/t/path", true, false, "filesystem:http://host/t/pat
h2", true, false, false, NULL}, |
2033 {"filesystem:http://host/t/path", true, false, "filesystem:https://host/t/pa
th2", true, false, false, NULL}, | 2033 {"filesystem:http://host/t/path", true, false, "filesystem:https://host/t/pa
th2", true, false, false, NULL}, |
2034 {"filesystem:http://host/t/path", true, false, "http://host/t/path2", true,
false, false, NULL}, | 2034 {"filesystem:http://host/t/path", true, false, "http://host/t/path2", true,
false, false, NULL}, |
2035 {"http://host/t/path", true, false, "filesystem:http://host/t/path2", true,
false, false, NULL}, | 2035 {"http://host/t/path", true, false, "filesystem:http://host/t/path2", true,
false, false, NULL}, |
2036 {"filesystem:http://host/t/path", true, false, "./path2", true, true, true,
"filesystem:http://host/t/path2"}, | 2036 {"filesystem:http://host/t/path", true, false, "./path2", true, true, true,
"filesystem:http://host/t/path2"}, |
2037 {"filesystem:http://host/t/path/", true, false, "path2", true, true, true, "
filesystem:http://host/t/path/path2"}, | 2037 {"filesystem:http://host/t/path/", true, false, "path2", true, true, true, "
filesystem:http://host/t/path/path2"}, |
2038 {"filesystem:http://host/t/path", true, false, "filesystem:http:path2", true
, false, false, NULL}, | 2038 {"filesystem:http://host/t/path", true, false, "filesystem:http:path2", true
, false, false, NULL}, |
| 2039 // Absolute URLs are still not relative to a non-standard base URL. |
| 2040 {"about:blank", false, false, "http://X/A", true, false, true, ""}, |
| 2041 {"about:blank", false, false, "content://content.Provider/", true, false, tr
ue, ""}, |
2039 }; | 2042 }; |
2040 | 2043 |
2041 for (size_t i = 0; i < ARRAYSIZE(rel_cases); i++) { | 2044 for (size_t i = 0; i < ARRAYSIZE(rel_cases); i++) { |
2042 const RelativeCase& cur_case = rel_cases[i]; | 2045 const RelativeCase& cur_case = rel_cases[i]; |
2043 | 2046 |
2044 url_parse::Parsed parsed; | 2047 url_parse::Parsed parsed; |
2045 int base_len = static_cast<int>(strlen(cur_case.base)); | 2048 int base_len = static_cast<int>(strlen(cur_case.base)); |
2046 if (cur_case.is_base_file) | 2049 if (cur_case.is_base_file) |
2047 url_parse::ParseFileURL(cur_case.base, base_len, &parsed); | 2050 url_parse::ParseFileURL(cur_case.base, base_len, &parsed); |
2048 else if (cur_case.is_base_hier) | 2051 else if (cur_case.is_base_hier) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 url_canon::StdStringCanonOutput repl_output(&repl_str); | 2124 url_canon::StdStringCanonOutput repl_output(&repl_str); |
2122 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; | 2125 url_canon::ReplaceFileURL(src, parsed, repl, NULL, &repl_output, &repl_parsed)
; |
2123 repl_output.Complete(); | 2126 repl_output.Complete(); |
2124 | 2127 |
2125 // Generate the expected string and check. | 2128 // Generate the expected string and check. |
2126 std::string expected("file:///foo?"); | 2129 std::string expected("file:///foo?"); |
2127 for (size_t i = 0; i < new_query.length(); i++) | 2130 for (size_t i = 0; i < new_query.length(); i++) |
2128 expected.push_back('a'); | 2131 expected.push_back('a'); |
2129 EXPECT_TRUE(expected == repl_str); | 2132 EXPECT_TRUE(expected == repl_str); |
2130 } | 2133 } |
OLD | NEW |