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

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

Issue 3360017: Fix multi-round authentication.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: SocketStream fix Created 10 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_auth_unittest.cc ('k') | net/http/mock_sspi_library_win.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <math.h> // ceil 7 #include <math.h> // ceil
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 6636 matching lines...) Expand 10 before | Expand all | Expand 10 after
6647 "Content-Length: 3\r\n\r\n" 6647 "Content-Length: 3\r\n\r\n"
6648 "Yes"); 6648 "Yes");
6649 6649
6650 MockWrite writes[] = { 6650 MockWrite writes[] = {
6651 // First round 6651 // First round
6652 kGet, 6652 kGet,
6653 // Second round 6653 // Second round
6654 kGetAuth, 6654 kGetAuth,
6655 // Third round 6655 // Third round
6656 kGetAuth, 6656 kGetAuth,
6657 // Fourth round
6658 kGetAuth
6657 }; 6659 };
6658 MockRead reads[] = { 6660 MockRead reads[] = {
6659 // First round 6661 // First round
6660 kServerChallenge, 6662 kServerChallenge,
6661 // Second round 6663 // Second round
6662 kServerChallenge, 6664 kServerChallenge,
6663 // Third round 6665 // Third round
6666 kServerChallenge,
6667 // Fourth round
6664 kSuccess, 6668 kSuccess,
6665 }; 6669 };
6666 StaticSocketDataProvider data_provider(reads, arraysize(reads), 6670 StaticSocketDataProvider data_provider(reads, arraysize(reads),
6667 writes, arraysize(writes)); 6671 writes, arraysize(writes));
6668 session_deps.socket_factory.AddSocketDataProvider(&data_provider); 6672 session_deps.socket_factory.AddSocketDataProvider(&data_provider);
6669 6673
6670 // First round 6674 // First round
6671 auth_handler->SetGenerateExpectation(false, OK); 6675 auth_handler->SetGenerateExpectation(false, OK);
6672 rv = trans->Start(&request, &callback, BoundNetLog()); 6676 rv = trans->Start(&request, &callback, BoundNetLog());
6673 if (rv == ERR_IO_PENDING) 6677 if (rv == ERR_IO_PENDING)
(...skipping 15 matching lines...) Expand all
6689 6693
6690 // Third round 6694 // Third round
6691 auth_handler->SetGenerateExpectation(false, OK); 6695 auth_handler->SetGenerateExpectation(false, OK);
6692 rv = trans->RestartWithAuth(string16(), string16(), &callback); 6696 rv = trans->RestartWithAuth(string16(), string16(), &callback);
6693 if (rv == ERR_IO_PENDING) 6697 if (rv == ERR_IO_PENDING)
6694 rv = callback.WaitForResult(); 6698 rv = callback.WaitForResult();
6695 EXPECT_EQ(OK, rv); 6699 EXPECT_EQ(OK, rv);
6696 response = trans->GetResponseInfo(); 6700 response = trans->GetResponseInfo();
6697 ASSERT_FALSE(response == NULL); 6701 ASSERT_FALSE(response == NULL);
6698 EXPECT_TRUE(response->auth_challenge.get() == NULL); 6702 EXPECT_TRUE(response->auth_challenge.get() == NULL);
6703
6704 // Fourth round
6705 auth_handler->SetGenerateExpectation(false, OK);
6706 rv = trans->RestartWithAuth(string16(), string16(), &callback);
6707 if (rv == ERR_IO_PENDING)
6708 rv = callback.WaitForResult();
6709 EXPECT_EQ(OK, rv);
6710 response = trans->GetResponseInfo();
6711 ASSERT_FALSE(response == NULL);
6712 EXPECT_TRUE(response->auth_challenge.get() == NULL);
6699 } 6713 }
6700 6714
6701 class TLSDecompressionFailureSocketDataProvider : public SocketDataProvider { 6715 class TLSDecompressionFailureSocketDataProvider : public SocketDataProvider {
6702 public: 6716 public:
6703 explicit TLSDecompressionFailureSocketDataProvider(bool fail_all) 6717 explicit TLSDecompressionFailureSocketDataProvider(bool fail_all)
6704 : fail_all_(fail_all) { 6718 : fail_all_(fail_all) {
6705 } 6719 }
6706 6720
6707 virtual MockRead GetNextRead() { 6721 virtual MockRead GetNextRead() {
6708 if (fail_all_) 6722 if (fail_all_)
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
7258 size_t pos = ExpectLogContainsSomewhere( 7272 size_t pos = ExpectLogContainsSomewhere(
7259 log.entries(), 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 7273 log.entries(), 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
7260 NetLog::PHASE_NONE); 7274 NetLog::PHASE_NONE);
7261 ExpectLogContainsSomewhere( 7275 ExpectLogContainsSomewhere(
7262 log.entries(), pos, 7276 log.entries(), pos,
7263 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 7277 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
7264 NetLog::PHASE_NONE); 7278 NetLog::PHASE_NONE);
7265 } 7279 }
7266 7280
7267 } // namespace net 7281 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_unittest.cc ('k') | net/http/mock_sspi_library_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698