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

Unified Diff: net/base/net_util_unittest.cc

Issue 3040016: Net: Convert username and password to string16. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address comments Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/net_util.cc ('k') | net/ftp/ftp_auth_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_unittest.cc
===================================================================
--- net/base/net_util_unittest.cc (revision 53997)
+++ net/base/net_util_unittest.cc (working copy)
@@ -575,54 +575,54 @@
TEST(NetUtilTest, GetIdentityFromURL) {
struct {
const char* input_url;
- const wchar_t* expected_username;
- const wchar_t* expected_password;
+ const char* expected_username;
+ const char* expected_password;
} tests[] = {
{
"http://username:password@google.com",
- L"username",
- L"password",
+ "username",
+ "password",
},
{ // Test for http://crbug.com/19200
"http://username:p@ssword@google.com",
- L"username",
- L"p@ssword",
+ "username",
+ "p@ssword",
},
{ // Special URL characters should be unescaped.
"http://username:p%3fa%26s%2fs%23@google.com",
- L"username",
- L"p?a&s/s#",
+ "username",
+ "p?a&s/s#",
},
{ // Username contains %20.
"http://use rname:password@google.com",
- L"use rname",
- L"password",
+ "use rname",
+ "password",
},
{ // Keep %00 as is.
"http://use%00rname:password@google.com",
- L"use%00rname",
- L"password",
+ "use%00rname",
+ "password",
},
{ // Use a '+' in the username.
"http://use+rname:password@google.com",
- L"use+rname",
- L"password",
+ "use+rname",
+ "password",
},
{ // Use a '&' in the password.
"http://username:p&ssword@google.com",
- L"username",
- L"p&ssword",
+ "username",
+ "p&ssword",
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, tests[i].input_url));
GURL url(tests[i].input_url);
- std::wstring username, password;
+ string16 username, password;
net::GetIdentityFromURL(url, &username, &password);
- EXPECT_EQ(tests[i].expected_username, username);
- EXPECT_EQ(tests[i].expected_password, password);
+ EXPECT_EQ(ASCIIToUTF16(tests[i].expected_username), username);
+ EXPECT_EQ(ASCIIToUTF16(tests[i].expected_password), password);
}
}
@@ -634,12 +634,12 @@
EXPECT_EQ("%E4%BD%A0%E5%A5%BD", url.password());
// Extract the unescaped identity.
- std::wstring username, password;
+ string16 username, password;
net::GetIdentityFromURL(url, &username, &password);
// Verify that it was decoded as UTF8.
- EXPECT_EQ(L"foo", username);
- EXPECT_EQ(L"\x4f60\x597d", password);
+ EXPECT_EQ(ASCIIToUTF16("foo"), username);
+ EXPECT_EQ(WideToUTF16(L"\x4f60\x597d"), password);
}
// Just a bunch of fake headers.
« no previous file with comments | « net/base/net_util.cc ('k') | net/ftp/ftp_auth_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698