Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: net/base/escape_unittest.cc

Issue 1614001: Pull latest googleurl to get it to stop unescaping at signs in paths.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/escape.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <string> 5 #include <string>
6 6
7 #include "net/base/escape.h" 7 #include "net/base/escape.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/i18n/icu_string_conversions.h" 10 #include "base/i18n/icu_string_conversions.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS, 231 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS,
232 L"Some random text %;OK"}, 232 L"Some random text %;OK"},
233 {L"%A0%B1%C2%D3%E4%F5", UnescapeRule::NORMAL, L"\xA0\xB1\xC2\xD3\xE4\xF5"}, 233 {L"%A0%B1%C2%D3%E4%F5", UnescapeRule::NORMAL, L"\xA0\xB1\xC2\xD3\xE4\xF5"},
234 {L"%Aa%Bb%Cc%Dd%Ee%Ff", UnescapeRule::NORMAL, L"\xAa\xBb\xCc\xDd\xEe\xFf"}, 234 {L"%Aa%Bb%Cc%Dd%Ee%Ff", UnescapeRule::NORMAL, L"\xAa\xBb\xCc\xDd\xEe\xFf"},
235 // Certain URL-sensitive characters should not be unescaped unless asked. 235 // Certain URL-sensitive characters should not be unescaped unless asked.
236 {L"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+", UnescapeRule::SPACES, 236 {L"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+", UnescapeRule::SPACES,
237 L"Hello %13%10world %23# %3F? %3D= %26& %25% %2B+"}, 237 L"Hello %13%10world %23# %3F? %3D= %26& %25% %2B+"},
238 {L"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+", 238 {L"Hello%20%13%10world %23# %3F? %3D= %26& %25% %2B+",
239 UnescapeRule::URL_SPECIAL_CHARS, 239 UnescapeRule::URL_SPECIAL_CHARS,
240 L"Hello%20%13%10world ## ?? == && %% ++"}, 240 L"Hello%20%13%10world ## ?? == && %% ++"},
241 // We can neither escape nor unescape '@' since some websites expect it to
242 // be preserved as either '@' or "%40".
243 // See http://b/996720 and http://crbug.com/23933 .
244 {L"me@my%40example", UnescapeRule::NORMAL, L"me@my%40example"},
241 // Control characters. 245 // Control characters.
242 {L"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::URL_SPECIAL_CHARS, 246 {L"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::URL_SPECIAL_CHARS,
243 L"%01%02%03%04%05%06%07%08%09 %"}, 247 L"%01%02%03%04%05%06%07%08%09 %"},
244 {L"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::CONTROL_CHARS, 248 {L"%01%02%03%04%05%06%07%08%09 %25", UnescapeRule::CONTROL_CHARS,
245 L"\x01\x02\x03\x04\x05\x06\x07\x08\x09 %25"}, 249 L"\x01\x02\x03\x04\x05\x06\x07\x08\x09 %25"},
246 {L"Hello%20%13%10%02", UnescapeRule::SPACES, L"Hello %13%10%02"}, 250 {L"Hello%20%13%10%02", UnescapeRule::SPACES, L"Hello %13%10%02"},
247 {L"Hello%20%13%10%02", UnescapeRule::CONTROL_CHARS, 251 {L"Hello%20%13%10%02", UnescapeRule::CONTROL_CHARS,
248 L"Hello%20\x13\x10\x02"}, 252 L"Hello%20\x13\x10\x02"},
249 {L"Hello\x9824\x9827", UnescapeRule::CONTROL_CHARS, 253 {L"Hello\x9824\x9827", UnescapeRule::CONTROL_CHARS,
250 L"Hello\x9824\x9827"}, 254 L"Hello\x9824\x9827"},
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 { "&#39;", "'" }, 388 { "&#39;", "'" },
385 { "&lt;", "<" }, 389 { "&lt;", "<" },
386 { "&gt;", ">" }, 390 { "&gt;", ">" },
387 { "&amp; &", "& &" }, 391 { "&amp; &", "& &" },
388 }; 392 };
389 for (size_t i = 0; i < arraysize(tests); ++i) { 393 for (size_t i = 0; i < arraysize(tests); ++i) {
390 string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input)); 394 string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input));
391 EXPECT_EQ(ASCIIToUTF16(tests[i].expected_output), result); 395 EXPECT_EQ(ASCIIToUTF16(tests[i].expected_output), result);
392 } 396 }
393 } 397 }
OLDNEW
« no previous file with comments | « net/base/escape.cc ('k') | net/base/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698