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

Issue 42052: Add unit tests for NTLM authentication. This requires... (Closed)

Created:
11 years, 9 months ago by wtc
Modified:
9 years, 7 months ago
Reviewers:
eroman
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Add unit tests for NTLM authentication. This requires overriding the functions that generate random bytes or get the local host name, so that the generated NTLM messages are reproducible. R=eroman BUG=6567, 6824 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=11488

Patch Set 1 #

Patch Set 2 : Made minor edits after self review #

Patch Set 3 : Add the second unit test: wrong password #

Total comments: 10

Patch Set 4 : Address review comments #

Patch Set 5 : Upload before checkin #

Patch Set 6 : Upload before checkin #

Unified diffs Side-by-side diffs Delta from patch set Stats (+295 lines, -20 lines) Patch
M net/http/http_auth_handler_ntlm.h View 1 2 3 4 5 3 chunks +14 lines, -0 lines 0 comments Download
M net/http/http_auth_handler_ntlm.cc View 1 2 3 4 5 4 chunks +33 lines, -6 lines 0 comments Download
M net/http/http_network_transaction_unittest.cc View 1 2 3 4 5 6 chunks +248 lines, -14 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
wtc
Please review Patch Set 2. Please be critical of the approach I use to mock ...
11 years, 9 months ago (2009-03-11 00:20:22 UTC) #1
wtc
I added a second unit test, which tests the scenario of entering a wrong password ...
11 years, 9 months ago (2009-03-11 01:52:26 UTC) #2
eroman
11 years, 9 months ago (2009-03-11 03:04:44 UTC) #3
lgtm

http://codereview.chromium.org/42052/diff/1008/13
File net/http/http_auth_handler_ntlm.cc (right):

http://codereview.chromium.org/42052/diff/1008/13#newcode448
Line 448: static HttpAuthHandlerNTLM::GenerateRandomProc generate_random_ =
optionally name |generate_random_proc_|.

Also, why not make this a static member of HttpAuthHandlerNTLM ? (since the
setters are).

http://codereview.chromium.org/42052/diff/1008/13#newcode450
Line 450: static HttpAuthHandlerNTLM::HostNameProc get_host_name_ = GetHostName;
ditto to above.

http://codereview.chromium.org/42052/diff/1008/13#newcode530
Line 530: host_len = strlen(host_buf);
what if GetHostName() returned a std::string instead?

http://codereview.chromium.org/42052/diff/1008/14
File net/http/http_auth_handler_ntlm.h (right):

http://codereview.chromium.org/42052/diff/1008/14#newcode21
Line 21: typedef void (*GenerateRandomProc)(void* output, size_t n);
might save some casts to define as uint8* (since each implementation ends up
doing the cast anyway).

http://codereview.chromium.org/42052/diff/1008/14#newcode23
Line 23: // A function that returns the local host name in the output buffer.
Returns
"returns" may not be the best wording here. Also worth mentioning
"null-terminated". See other comment about whether this can just return
std::string.

http://codereview.chromium.org/42052/diff/1008/14#newcode39
Line 39: static void SetGenerateRandomProc(GenerateRandomProc proc);
just thinking out loud: what if these were made into private methods? (Then you
would need a FRIEND_TEST() to set).

http://codereview.chromium.org/42052/diff/1008/12
File net/http/http_network_transaction_unittest.cc (right):

http://codereview.chromium.org/42052/diff/1008/12#newcode306
Line 306: for (size_t i = 0; i < n; i++)
nit: I think most of our other code does ++i.

http://codereview.chromium.org/42052/diff/1008/12#newcode317
Line 317: for (size_t i = 0; i < n; i++) {
same nit as above.

http://codereview.chromium.org/42052/diff/1008/12#newcode318
Line 318: buf[i] = bytes[current_byte++];
(This tripped me up when I first glanced at it; I then recognized it was postfix
form, therefore correct).

http://codereview.chromium.org/42052/diff/1008/12#newcode328
Line 328: name[0] = '\0';
(i guess no point checking if namelen == 0).

Powered by Google App Engine
This is Rietveld 408576698