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

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

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 3 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
« no previous file with comments | « net/base/cookie_monster_unittest.cc ('k') | net/base/host_cache_unittest.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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace { 16 namespace {
16 17
17 struct EscapeCase { 18 struct EscapeCase {
18 const wchar_t* input; 19 const wchar_t* input;
19 const wchar_t* output; 20 const wchar_t* output;
20 }; 21 };
21 22
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 std::string in; 89 std::string in;
89 in.push_back(i); 90 in.push_back(i);
90 std::string out = EscapeQueryParamValue(in, true); 91 std::string out = EscapeQueryParamValue(in, true);
91 if (0 == i) { 92 if (0 == i) {
92 EXPECT_EQ(out, std::string("%00")); 93 EXPECT_EQ(out, std::string("%00"));
93 } else if (32 == i) { 94 } else if (32 == i) {
94 // Spaces are plus escaped like web forms. 95 // Spaces are plus escaped like web forms.
95 EXPECT_EQ(out, std::string("+")); 96 EXPECT_EQ(out, std::string("+"));
96 } else if (no_escape.find(in) == std::string::npos) { 97 } else if (no_escape.find(in) == std::string::npos) {
97 // Check %hex escaping 98 // Check %hex escaping
98 std::string expected = StringPrintf("%%%02X", i); 99 std::string expected = base::StringPrintf("%%%02X", i);
99 EXPECT_EQ(expected, out); 100 EXPECT_EQ(expected, out);
100 } else { 101 } else {
101 // No change for things in the no_escape list. 102 // No change for things in the no_escape list.
102 EXPECT_EQ(out, in); 103 EXPECT_EQ(out, in);
103 } 104 }
104 } 105 }
105 106
106 // Check to see if EscapeQueryParamValueUTF8 is the same as 107 // Check to see if EscapeQueryParamValueUTF8 is the same as
107 // EscapeQueryParamValue(..., kCodepageUTF8,) 108 // EscapeQueryParamValue(..., kCodepageUTF8,)
108 string16 test_str; 109 string16 test_str;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 { "&#39;", "'" }, 389 { "&#39;", "'" },
389 { "&lt;", "<" }, 390 { "&lt;", "<" },
390 { "&gt;", ">" }, 391 { "&gt;", ">" },
391 { "&amp; &", "& &" }, 392 { "&amp; &", "& &" },
392 }; 393 };
393 for (size_t i = 0; i < arraysize(tests); ++i) { 394 for (size_t i = 0; i < arraysize(tests); ++i) {
394 string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input)); 395 string16 result = UnescapeForHTML(ASCIIToUTF16(tests[i].input));
395 EXPECT_EQ(ASCIIToUTF16(tests[i].expected_output), result); 396 EXPECT_EQ(ASCIIToUTF16(tests[i].expected_output), result);
396 } 397 }
397 } 398 }
OLDNEW
« no previous file with comments | « net/base/cookie_monster_unittest.cc ('k') | net/base/host_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698