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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 173528: Use SSPI for NTLM authentication on Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | net/net.gyp » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <math.h> // ceil 5 #include <math.h> // ceil
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "net/base/completion_callback.h" 8 #include "net/base/completion_callback.h"
9 #include "net/base/mock_host_resolver.h" 9 #include "net/base/mock_host_resolver.h"
10 #include "net/base/ssl_config_service_defaults.h" 10 #include "net/base/ssl_config_service_defaults.h"
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 EXPECT_EQ(ERR_IO_PENDING, rv); 1494 EXPECT_EQ(ERR_IO_PENDING, rv);
1495 1495
1496 rv = callback3.WaitForResult(); 1496 rv = callback3.WaitForResult();
1497 EXPECT_EQ(OK, rv); 1497 EXPECT_EQ(OK, rv);
1498 1498
1499 response = trans->GetResponseInfo(); 1499 response = trans->GetResponseInfo();
1500 EXPECT_TRUE(response->auth_challenge.get() == NULL); 1500 EXPECT_TRUE(response->auth_challenge.get() == NULL);
1501 EXPECT_EQ(100, response->headers->GetContentLength()); 1501 EXPECT_EQ(100, response->headers->GetContentLength());
1502 } 1502 }
1503 1503
1504 // For the NTLM implementation using SSPI, we skip the NTLM tests since we
1505 // can't hook into its internals to cause it to generate predictable NTLM
1506 // authorization headers.
1507 #if defined(NTLM_PORTABLE)
1504 // The NTLM authentication unit tests were generated by capturing the HTTP 1508 // The NTLM authentication unit tests were generated by capturing the HTTP
1505 // requests and responses using Fiddler 2 and inspecting the generated random 1509 // requests and responses using Fiddler 2 and inspecting the generated random
1506 // bytes in the debugger. 1510 // bytes in the debugger.
1507 1511
1508 // Enter the correct password and authenticate successfully. 1512 // Enter the correct password and authenticate successfully.
1509 TEST_F(HttpNetworkTransactionTest, NTLMAuth1) { 1513 TEST_F(HttpNetworkTransactionTest, NTLMAuth1) {
1510 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1, 1514 HttpAuthHandlerNTLM::ScopedProcSetter proc_setter(MockGenerateRandom1,
1511 MockGetHostName); 1515 MockGetHostName);
1512 SessionDependencies session_deps; 1516 SessionDependencies session_deps;
1513 scoped_ptr<HttpTransaction> trans( 1517 scoped_ptr<HttpTransaction> trans(
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 rv = trans->RestartWithAuth(L"testing-ntlm", L"testing-ntlm", &callback5); 1826 rv = trans->RestartWithAuth(L"testing-ntlm", L"testing-ntlm", &callback5);
1823 EXPECT_EQ(ERR_IO_PENDING, rv); 1827 EXPECT_EQ(ERR_IO_PENDING, rv);
1824 1828
1825 rv = callback5.WaitForResult(); 1829 rv = callback5.WaitForResult();
1826 EXPECT_EQ(OK, rv); 1830 EXPECT_EQ(OK, rv);
1827 1831
1828 response = trans->GetResponseInfo(); 1832 response = trans->GetResponseInfo();
1829 EXPECT_TRUE(response->auth_challenge.get() == NULL); 1833 EXPECT_TRUE(response->auth_challenge.get() == NULL);
1830 EXPECT_EQ(13, response->headers->GetContentLength()); 1834 EXPECT_EQ(13, response->headers->GetContentLength());
1831 } 1835 }
1836 #endif // NTLM_PORTABLE
1832 1837
1833 // Test reading a server response which has only headers, and no body. 1838 // Test reading a server response which has only headers, and no body.
1834 // After some maximum number of bytes is consumed, the transaction should 1839 // After some maximum number of bytes is consumed, the transaction should
1835 // fail with ERR_RESPONSE_HEADERS_TOO_BIG. 1840 // fail with ERR_RESPONSE_HEADERS_TOO_BIG.
1836 TEST_F(HttpNetworkTransactionTest, LargeHeadersNoBody) { 1841 TEST_F(HttpNetworkTransactionTest, LargeHeadersNoBody) {
1837 SessionDependencies session_deps; 1842 SessionDependencies session_deps;
1838 scoped_ptr<HttpTransaction> trans( 1843 scoped_ptr<HttpTransaction> trans(
1839 new HttpNetworkTransaction( 1844 new HttpNetworkTransaction(
1840 CreateSession(&session_deps), 1845 CreateSession(&session_deps),
1841 &session_deps.socket_factory)); 1846 &session_deps.socket_factory));
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 // Extract the unescaped identity. 3622 // Extract the unescaped identity.
3618 std::wstring username, password; 3623 std::wstring username, password;
3619 HttpNetworkTransaction::GetIdentifyFromUrl(url, &username, &password); 3624 HttpNetworkTransaction::GetIdentifyFromUrl(url, &username, &password);
3620 3625
3621 // Verify that it was decoded as UTF8. 3626 // Verify that it was decoded as UTF8.
3622 EXPECT_EQ(L"foo", username); 3627 EXPECT_EQ(L"foo", username);
3623 EXPECT_EQ(L"\x4f60\x597d", password); 3628 EXPECT_EQ(L"\x4f60\x597d", password);
3624 } 3629 }
3625 3630
3626 } // namespace net 3631 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698