diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 00:11:08 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 00:11:08 +0000 |
commit | b85a4f13c2e85c102ee668441dfa1dc54155b972 (patch) | |
tree | 1397b005bbbf6572bce6b385c104a47045be2776 /net | |
parent | 614a6526d042804714041fe5eba36053ec9fb354 (diff) | |
download | chromium_src-b85a4f13c2e85c102ee668441dfa1dc54155b972.zip chromium_src-b85a4f13c2e85c102ee668441dfa1dc54155b972.tar.gz chromium_src-b85a4f13c2e85c102ee668441dfa1dc54155b972.tar.bz2 |
Add some extra unit-tests to make sure we cover all permutations of {basic_auth, digest_auth} x {empty_username, empty_password}.
Review URL: http://codereview.chromium.org/8863
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_auth_handler_basic_unittest.cc | 2 | ||||
-rw-r--r-- | net/http/http_auth_handler_digest_unittest.cc | 42 |
2 files changed, 44 insertions, 0 deletions
diff --git a/net/http/http_auth_handler_basic_unittest.cc b/net/http/http_auth_handler_basic_unittest.cc index bdf52bf..d78dd3d 100644 --- a/net/http/http_auth_handler_basic_unittest.cc +++ b/net/http/http_auth_handler_basic_unittest.cc @@ -20,6 +20,8 @@ TEST(HttpAuthHandlerBasicTest, GenerateCredentials) { { L"", L"foobar", "Basic OmZvb2Jhcg==" }, // Empty password { L"anon", L"", "Basic YW5vbjo=" }, + // Empty username and empty password. + { L"", L"", "Basic Og==" }, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { std::string challenge = "Basic realm=\"Atlantis\""; diff --git a/net/http/http_auth_handler_digest_unittest.cc b/net/http/http_auth_handler_digest_unittest.cc index cb08a4e..f15ecd0 100644 --- a/net/http/http_auth_handler_digest_unittest.cc +++ b/net/http/http_auth_handler_digest_unittest.cc @@ -157,6 +157,48 @@ TEST(HttpAuthHandlerDigestTest, AssembleCredentials) { "qop=auth, nc=00000001, cnonce=\"082c875dcb2ca740\"" }, + { // MD5 with no username. + "GET", + "/test/drealm1/", + + // Challenge + "Digest realm=\"DRealm1\", " + "nonce=\"7thGplhaBAA=41fb92453c49799cf353c8cd0aabee02d61a98a8\", " + "algorithm=MD5, qop=\"auth\"", + + "", "pass", // Username/password + "6509bc74daed8263", // cnonce + 1, // nc + + // Authorization + "Digest username=\"\", realm=\"DRealm1\", " + "nonce=\"7thGplhaBAA=41fb92453c49799cf353c8cd0aabee02d61a98a8\", " + "uri=\"/test/drealm1/\", algorithm=MD5, " + "response=\"bc597110f41a62d07f8b70b6977fcb61\", " + "qop=auth, nc=00000001, cnonce=\"6509bc74daed8263\"" + }, + + { // MD5 with no username and no password. + "GET", + "/test/drealm1/", + + // Challenge + "Digest realm=\"DRealm1\", " + "nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\", " + "algorithm=MD5, qop=\"auth\"", + + "", "", // Username/password + "1522e61005789929", // cnonce + 1, // nc + + // Authorization + "Digest username=\"\", realm=\"DRealm1\", " + "nonce=\"s3MzvFhaBAA=4c520af5acd9d8d7ae26947529d18c8eae1e98f4\", " + "uri=\"/test/drealm1/\", algorithm=MD5, " + "response=\"22cfa2b30cb500a9591c6d55ec5590a8\", " + "qop=auth, nc=00000001, cnonce=\"1522e61005789929\"" + }, + { // No algorithm, and no qop. "GET", "/", |