Index: url/gurl.cc |
diff --git a/url/gurl.cc b/url/gurl.cc |
index 229df5dca2dbd6d1ab3de26c96d4d3afca49b60b..b8a38888075ab9704cecf0add40ea8747c7758d7 100644 |
--- a/url/gurl.cc |
+++ b/url/gurl.cc |
@@ -25,14 +25,15 @@ namespace { |
template<typename STR> |
bool InitCanonical(const STR& input_spec, |
std::string* canonical, |
- url_parse::Parsed* parsed) { |
+ url_parse::Parsed* parsed, |
+ bool trim_tail = true) { |
// Reserve enough room in the output for the input, plus some extra so that |
// we have room if we have to escape a few things without reallocating. |
canonical->reserve(input_spec.size() + 32); |
url_canon::StdStringCanonOutput output(canonical); |
bool success = url_util::Canonicalize( |
input_spec.data(), static_cast<int>(input_spec.length()), |
- NULL, &output, parsed); |
+ NULL, &output, parsed, trim_tail); |
output.Complete(); // Must be done before using string. |
return success; |
@@ -146,19 +147,22 @@ void GURL::InitializeFromCanonicalSpec() { |
// We can't do this check on the inner_url of a filesystem URL, as |
// canonical_spec actually points to the start of the outer URL, so we'd |
// end up with infinite recursion in this constructor. |
- GURL test_url(spec_); |
- |
- DCHECK(test_url.is_valid_ == is_valid_); |
- DCHECK(test_url.spec_ == spec_); |
- |
- DCHECK(test_url.parsed_.scheme == parsed_.scheme); |
- DCHECK(test_url.parsed_.username == parsed_.username); |
- DCHECK(test_url.parsed_.password == parsed_.password); |
- DCHECK(test_url.parsed_.host == parsed_.host); |
- DCHECK(test_url.parsed_.port == parsed_.port); |
- DCHECK(test_url.parsed_.path == parsed_.path); |
- DCHECK(test_url.parsed_.query == parsed_.query); |
- DCHECK(test_url.parsed_.ref == parsed_.ref); |
+ std::string test_spec; |
+ url_parse::Parsed test_parsed; |
+ bool test_is_valid = InitCanonical(spec_, &test_spec, |
+ &test_parsed, false); |
+ |
+ DCHECK_EQ(test_is_valid, is_valid_); |
+ |
+ DCHECK_EQ(test_spec, spec_); |
+ DCHECK(test_parsed.scheme == parsed_.scheme); |
+ DCHECK(test_parsed.username == parsed_.username); |
+ DCHECK(test_parsed.password == parsed_.password); |
+ DCHECK(test_parsed.host == parsed_.host); |
+ DCHECK(test_parsed.port == parsed_.port); |
+ DCHECK(test_parsed.path == parsed_.path); |
+ DCHECK(test_parsed.query == parsed_.query); |
+ DCHECK(test_parsed.ref == parsed_.ref); |
} |
} |
#endif |