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

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 43113: Merge NTLMAuthModule into HttpAuthHandlerNTLM. The... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 years, 9 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/http/http_auth_handler_ntlm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction_unittest.cc
===================================================================
--- net/http/http_network_transaction_unittest.cc (revision 12289)
+++ net/http/http_network_transaction_unittest.cc (working copy)
@@ -302,7 +302,7 @@
// Alternative functions that eliminate randomness and dependency on the local
// host name so that the generated NTLM messages are reproducible.
-void MyGenerateRandom1(uint8* output, size_t n) {
+void MockGenerateRandom1(uint8* output, size_t n) {
static const uint8 bytes[] = {
0x55, 0x29, 0x66, 0x26, 0x6b, 0x9c, 0x73, 0x54
};
@@ -313,7 +313,7 @@
}
}
-void MyGenerateRandom2(uint8* output, size_t n) {
+void MockGenerateRandom2(uint8* output, size_t n) {
static const uint8 bytes[] = {
0x96, 0x79, 0x85, 0xe7, 0x49, 0x93, 0x70, 0xa1,
0x4e, 0xe7, 0x87, 0x45, 0x31, 0x5b, 0xd3, 0x1f
@@ -325,13 +325,8 @@
}
}
-void MyGetHostName(char* name, size_t namelen) {
- static const char hostname[] = "WTC-WIN7";
- if (namelen >= arraysize(hostname)) {
- memcpy(name, hostname, arraysize(hostname));
- } else {
- name[0] = '\0';
- }
+std::string MockGetHostName() {
+ return "WTC-WIN7";
}
//-----------------------------------------------------------------------------
@@ -1580,8 +1575,8 @@
// Enter the correct password and authenticate successfully.
TEST_F(HttpNetworkTransactionTest, NTLMAuth1) {
- net::HttpAuthHandlerNTLM::SetGenerateRandomProc(MyGenerateRandom1);
- net::HttpAuthHandlerNTLM::SetHostNameProc(MyGetHostName);
+ net::HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1,
+ MockGetHostName);
scoped_ptr<net::ProxyService> proxy_service(CreateNullProxyService());
scoped_ptr<net::HttpTransaction> trans(new net::HttpNetworkTransaction(
@@ -1702,8 +1697,8 @@
// Enter a wrong password, and then the correct one.
TEST_F(HttpNetworkTransactionTest, NTLMAuth2) {
- net::HttpAuthHandlerNTLM::SetGenerateRandomProc(MyGenerateRandom2);
- net::HttpAuthHandlerNTLM::SetHostNameProc(MyGetHostName);
+ net::HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom2,
+ MockGetHostName);
scoped_ptr<net::ProxyService> proxy_service(CreateNullProxyService());
scoped_ptr<net::HttpTransaction> trans(new net::HttpNetworkTransaction(
« no previous file with comments | « net/http/http_auth_handler_ntlm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698