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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 strlen(test_data.rel), NULL, &output, | 288 strlen(test_data.rel), NULL, &output, |
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 TEST(URLUtilTest, TestNoRefComponent) { | |
299 // The following address has base_parsed_authority.host, but | |
brettw
2014/12/01 20:15:09
base_parsed_authority has no meaning in this conte
| |
300 // it is still a mailto: scheme, and cannot be parsed as a path. | |
301 const char* base = "mailto://to/"; | |
302 const char* rel = "any#body"; | |
303 | |
304 Parsed base_parsed; | |
305 ParsePathURL(base, strlen(base), false, &base_parsed); | |
306 | |
307 std::string resolved; | |
308 StdStringCanonOutput output(&resolved); | |
309 Parsed resolved_parsed; | |
310 | |
311 bool valid = ResolveRelative(base, strlen(base), | |
312 base_parsed, rel, | |
313 strlen(rel), NULL, &output, | |
314 &resolved_parsed); | |
315 EXPECT_TRUE(valid); | |
316 EXPECT_FALSE(resolved_parsed.ref.is_valid()); | |
317 } | |
318 | |
298 } // namespace url | 319 } // namespace url |
OLD | NEW |