| 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 "net/base/url_util.h" | 5 #include "net/base/url_util.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 EXPECT_TRUE(it.IsAtEnd()); | 153 EXPECT_TRUE(it.IsAtEnd()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 TEST(UrlUtilTest, ParseQueryInvalidURL) { | 156 TEST(UrlUtilTest, ParseQueryInvalidURL) { |
| 157 const GURL url("http://%01/?test"); | 157 const GURL url("http://%01/?test"); |
| 158 QueryIterator it(url); | 158 QueryIterator it(url); |
| 159 EXPECT_TRUE(it.IsAtEnd()); | 159 EXPECT_TRUE(it.IsAtEnd()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 TEST(UrlUtilTest, EscapeQueryPart) { |
| 163 EXPECT_EQ("http://example.com/test?q=a%7Cb%7Cc", |
| 164 EscapeQueryParameters(GURL("http://example.com/test?q=a%7Cb%7Cc")) |
| 165 .spec()); |
| 166 |
| 167 EXPECT_EQ( |
| 168 "http://example.com/test?q=a%7Cb%7Cc", |
| 169 EscapeQueryParameters(GURL("http://example.com/test?q=a|b|c")).spec()); |
| 170 |
| 171 EXPECT_EQ("http://example.com/test?q=a%7Cb%7Cc&q=1%7C2%7C3", |
| 172 EscapeQueryParameters( |
| 173 GURL("http://example.com/test?q=a|b|c&q=1|2|3")).spec()); |
| 174 |
| 175 EXPECT_EQ("http://example.com/test?q=a%7Cb%7Cc&q2=1%7C2%7C3", |
| 176 EscapeQueryParameters( |
| 177 GURL("http://example.com/test?q=a|b|c&q2=1|2|3")).spec()); |
| 178 |
| 179 EXPECT_EQ("http://example.com/", |
| 180 EscapeQueryParameters(GURL("http://example.com/")).spec()); |
| 181 } |
| 182 |
| 162 } // namespace | 183 } // namespace |
| 163 } // namespace net | 184 } // namespace net |
| OLD | NEW |