| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "url/url_canon.h" | 7 #include "url/url_canon.h" |
| 8 #include "url/url_canon_stdstring.h" | 8 #include "url/url_canon_stdstring.h" |
| 9 #include "url/url_parse.h" | 9 #include "url/url_parse.h" |
| 10 #include "url/url_test_utils.h" | 10 #include "url/url_test_utils.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 const char* rel; | 227 const char* rel; |
| 228 bool is_valid; | 228 bool is_valid; |
| 229 const char* out; | 229 const char* out; |
| 230 } resolve_non_standard_cases[] = { | 230 } resolve_non_standard_cases[] = { |
| 231 // Resolving a relative path against a non-hierarchical URL should fail. | 231 // Resolving a relative path against a non-hierarchical URL should fail. |
| 232 {"scheme:opaque_data", "/path", false, ""}, | 232 {"scheme:opaque_data", "/path", false, ""}, |
| 233 // Resolving a relative path against a non-standard authority-based base | 233 // Resolving a relative path against a non-standard authority-based base |
| 234 // URL doesn't alter the authority section. | 234 // URL doesn't alter the authority section. |
| 235 {"scheme://Authority/", "../path", true, "scheme://Authority/path"}, | 235 {"scheme://Authority/", "../path", true, "scheme://Authority/path"}, |
| 236 // A non-standard hierarchical base is resolved with path URL | 236 // A non-standard hierarchical base is resolved with path URL |
| 237 // canoncialization rules. | 237 // canonicalization rules. |
| 238 {"data:/Blah:Blah/", "file.html", true, "data:/Blah:Blah/file.html"}, | 238 {"data:/Blah:Blah/", "file.html", true, "data:/Blah:Blah/file.html"}, |
| 239 {"data:/Path/../part/part2", "file.html", true, | 239 {"data:/Path/../part/part2", "file.html", true, |
| 240 "data:/Path/../part/file.html"}, | 240 "data:/Path/../part/file.html"}, |
| 241 // Path URL canonicalization rules also apply to non-standard authority- | 241 // Path URL canonicalization rules also apply to non-standard authority- |
| 242 // based URLs. | 242 // based URLs. |
| 243 {"custom://Authority/", "file.html", true, | 243 {"custom://Authority/", "file.html", true, |
| 244 "custom://Authority/file.html"}, | 244 "custom://Authority/file.html"}, |
| 245 {"custom://Authority/", "other://Auth/", true, "other://Auth/"}, | 245 {"custom://Authority/", "other://Auth/", true, "other://Auth/"}, |
| 246 {"custom://Authority/", "../../file.html", true, | 246 {"custom://Authority/", "../../file.html", true, |
| 247 "custom://Authority/file.html"}, | 247 "custom://Authority/file.html"}, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 &resolved_parsed); | 289 &resolved_parsed); |
| 290 output.Complete(); | 290 output.Complete(); |
| 291 | 291 |
| 292 EXPECT_EQ(test_data.is_valid, valid) << i; | 292 EXPECT_EQ(test_data.is_valid, valid) << i; |
| 293 if (test_data.is_valid && valid) | 293 if (test_data.is_valid && valid) |
| 294 EXPECT_EQ(test_data.out, resolved) << i; | 294 EXPECT_EQ(test_data.out, resolved) << i; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace url | 298 } // namespace url |
| OLD | NEW |