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

Side by Side Diff: net/spdy/spdy_test_util_common.cc

Issue 208663003: Revert of Fix SPDY error-handling if the connection gets closed just after use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/spdy/spdy_test_util_common.h" 5 #include "net/spdy/spdy_test_util_common.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 http_session->GetTransportSocketPool( 533 http_session->GetTransportSocketPool(
534 HttpNetworkSession::NORMAL_SOCKET_POOL), 534 HttpNetworkSession::NORMAL_SOCKET_POOL),
535 net_log); 535 net_log);
536 } 536 }
537 537
538 if (rv == ERR_IO_PENDING) 538 if (rv == ERR_IO_PENDING)
539 rv = callback.WaitForResult(); 539 rv = callback.WaitForResult();
540 540
541 EXPECT_EQ(OK, rv); 541 EXPECT_EQ(OK, rv);
542 542
543 base::WeakPtr<SpdySession> spdy_session = 543 base::WeakPtr<SpdySession> spdy_session;
544 EXPECT_EQ(
545 expected_status,
544 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket( 546 http_session->spdy_session_pool()->CreateAvailableSessionFromSocket(
545 key, connection.Pass(), net_log, OK, is_secure); 547 key, connection.Pass(), net_log, OK, &spdy_session,
546 // Failure is reported asynchronously. 548 is_secure));
547 EXPECT_TRUE(spdy_session != NULL); 549 EXPECT_EQ(expected_status == OK, spdy_session != NULL);
548 EXPECT_TRUE(HasSpdySession(http_session->spdy_session_pool(), key)); 550 EXPECT_EQ(expected_status == OK,
551 HasSpdySession(http_session->spdy_session_pool(), key));
549 return spdy_session; 552 return spdy_session;
550 } 553 }
551 554
552 } // namespace 555 } // namespace
553 556
554 base::WeakPtr<SpdySession> CreateInsecureSpdySession( 557 base::WeakPtr<SpdySession> CreateInsecureSpdySession(
555 const scoped_refptr<HttpNetworkSession>& http_session, 558 const scoped_refptr<HttpNetworkSession>& http_session,
556 const SpdySessionKey& key, 559 const SpdySessionKey& key,
557 const BoundNetLog& net_log) { 560 const BoundNetLog& net_log) {
558 return CreateSpdySessionHelper(http_session, key, net_log, 561 return CreateSpdySessionHelper(http_session, key, net_log,
559 OK, false /* is_secure */); 562 OK, false /* is_secure */);
560 } 563 }
561 564
562 base::WeakPtr<SpdySession> TryCreateInsecureSpdySessionExpectingFailure( 565 void TryCreateInsecureSpdySessionExpectingFailure(
563 const scoped_refptr<HttpNetworkSession>& http_session, 566 const scoped_refptr<HttpNetworkSession>& http_session,
564 const SpdySessionKey& key, 567 const SpdySessionKey& key,
565 Error expected_error, 568 Error expected_error,
566 const BoundNetLog& net_log) { 569 const BoundNetLog& net_log) {
567 DCHECK_LT(expected_error, ERR_IO_PENDING); 570 DCHECK_LT(expected_error, ERR_IO_PENDING);
568 return CreateSpdySessionHelper(http_session, key, net_log, 571 CreateSpdySessionHelper(http_session, key, net_log,
569 expected_error, false /* is_secure */); 572 expected_error, false /* is_secure */);
570 } 573 }
571 574
572 base::WeakPtr<SpdySession> CreateSecureSpdySession( 575 base::WeakPtr<SpdySession> CreateSecureSpdySession(
573 const scoped_refptr<HttpNetworkSession>& http_session, 576 const scoped_refptr<HttpNetworkSession>& http_session,
574 const SpdySessionKey& key, 577 const SpdySessionKey& key,
575 const BoundNetLog& net_log) { 578 const BoundNetLog& net_log) {
576 return CreateSpdySessionHelper(http_session, key, net_log, 579 return CreateSpdySessionHelper(http_session, key, net_log,
577 OK, true /* is_secure */); 580 OK, true /* is_secure */);
578 } 581 }
579 582
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 private: 636 private:
634 int read_result_; 637 int read_result_;
635 }; 638 };
636 639
637 base::WeakPtr<SpdySession> CreateFakeSpdySessionHelper( 640 base::WeakPtr<SpdySession> CreateFakeSpdySessionHelper(
638 SpdySessionPool* pool, 641 SpdySessionPool* pool,
639 const SpdySessionKey& key, 642 const SpdySessionKey& key,
640 Error expected_status) { 643 Error expected_status) {
641 EXPECT_NE(expected_status, ERR_IO_PENDING); 644 EXPECT_NE(expected_status, ERR_IO_PENDING);
642 EXPECT_FALSE(HasSpdySession(pool, key)); 645 EXPECT_FALSE(HasSpdySession(pool, key));
646 base::WeakPtr<SpdySession> spdy_session;
643 scoped_ptr<ClientSocketHandle> handle(new ClientSocketHandle()); 647 scoped_ptr<ClientSocketHandle> handle(new ClientSocketHandle());
644 handle->SetSocket(scoped_ptr<StreamSocket>(new FakeSpdySessionClientSocket( 648 handle->SetSocket(scoped_ptr<StreamSocket>(new FakeSpdySessionClientSocket(
645 expected_status == OK ? ERR_IO_PENDING : expected_status))); 649 expected_status == OK ? ERR_IO_PENDING : expected_status)));
646 base::WeakPtr<SpdySession> spdy_session = 650 EXPECT_EQ(
651 expected_status,
647 pool->CreateAvailableSessionFromSocket( 652 pool->CreateAvailableSessionFromSocket(
648 key, handle.Pass(), BoundNetLog(), OK, true /* is_secure */); 653 key, handle.Pass(), BoundNetLog(), OK, &spdy_session,
649 // Failure is reported asynchronously. 654 true /* is_secure */));
650 EXPECT_TRUE(spdy_session != NULL); 655 EXPECT_EQ(expected_status == OK, spdy_session != NULL);
651 EXPECT_TRUE(HasSpdySession(pool, key)); 656 EXPECT_EQ(expected_status == OK, HasSpdySession(pool, key));
652 return spdy_session; 657 return spdy_session;
653 } 658 }
654 659
655 } // namespace 660 } // namespace
656 661
657 base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool, 662 base::WeakPtr<SpdySession> CreateFakeSpdySession(SpdySessionPool* pool,
658 const SpdySessionKey& key) { 663 const SpdySessionKey& key) {
659 return CreateFakeSpdySessionHelper(pool, key, OK); 664 return CreateFakeSpdySessionHelper(pool, key, OK);
660 } 665 }
661 666
662 base::WeakPtr<SpdySession> TryCreateFakeSpdySessionExpectingFailure( 667 void TryCreateFakeSpdySessionExpectingFailure(SpdySessionPool* pool,
663 SpdySessionPool* pool, 668 const SpdySessionKey& key,
664 const SpdySessionKey& key, 669 Error expected_error) {
665 Error expected_error) {
666 DCHECK_LT(expected_error, ERR_IO_PENDING); 670 DCHECK_LT(expected_error, ERR_IO_PENDING);
667 return CreateFakeSpdySessionHelper(pool, key, expected_error); 671 CreateFakeSpdySessionHelper(pool, key, expected_error);
668 } 672 }
669 673
670 SpdySessionPoolPeer::SpdySessionPoolPeer(SpdySessionPool* pool) : pool_(pool) { 674 SpdySessionPoolPeer::SpdySessionPoolPeer(SpdySessionPool* pool) : pool_(pool) {
671 } 675 }
672 676
673 void SpdySessionPoolPeer::RemoveAliases(const SpdySessionKey& key) { 677 void SpdySessionPoolPeer::RemoveAliases(const SpdySessionKey& key) {
674 pool_->RemoveAliases(key); 678 pool_->RemoveAliases(key);
675 } 679 }
676 680
677 void SpdySessionPoolPeer::DisableDomainAuthenticationVerification() { 681 void SpdySessionPoolPeer::DisableDomainAuthenticationVerification() {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 (*headers)[GetSchemeKey()] = scheme.c_str(); 1237 (*headers)[GetSchemeKey()] = scheme.c_str();
1234 (*headers)[GetVersionKey()] = "HTTP/1.1"; 1238 (*headers)[GetVersionKey()] = "HTTP/1.1";
1235 if (content_length) { 1239 if (content_length) {
1236 std::string length_str = base::Int64ToString(*content_length); 1240 std::string length_str = base::Int64ToString(*content_length);
1237 (*headers)["content-length"] = length_str; 1241 (*headers)["content-length"] = length_str;
1238 } 1242 }
1239 return headers.Pass(); 1243 return headers.Pass();
1240 } 1244 }
1241 1245
1242 } // namespace net 1246 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698