OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 }; | 752 }; |
753 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 753 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
754 socket_factory_.AddSocketDataProvider(&data); | 754 socket_factory_.AddSocketDataProvider(&data); |
755 SSLSocketDataProvider ssl(ASYNC, OK); | 755 SSLSocketDataProvider ssl(ASYNC, OK); |
756 ssl.cert = X509Certificate::CreateFromBytes( | 756 ssl.cert = X509Certificate::CreateFromBytes( |
757 reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); | 757 reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); |
758 ssl.SetNextProto(kProtoSPDY2); | 758 ssl.SetNextProto(kProtoSPDY2); |
759 socket_factory_.AddSSLSocketDataProvider(&ssl); | 759 socket_factory_.AddSSLSocketDataProvider(&ssl); |
760 | 760 |
761 CreatePool(true /* tcp pool */, false, false); | 761 CreatePool(true /* tcp pool */, false, false); |
762 scoped_refptr<SpdySession> spdy_session = | 762 base::WeakPtr<SpdySession> spdy_session = |
763 CreateSecureSpdySession(session_, test_hosts[0].key, BoundNetLog()); | 763 CreateSecureSpdySession(session_, test_hosts[0].key, BoundNetLog()); |
764 | 764 |
765 EXPECT_TRUE( | 765 EXPECT_TRUE( |
766 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); | 766 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); |
767 EXPECT_FALSE( | 767 EXPECT_FALSE( |
768 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); | 768 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); |
769 EXPECT_TRUE( | 769 EXPECT_TRUE( |
770 HasSpdySession(session_->spdy_session_pool(), test_hosts[2].key)); | 770 HasSpdySession(session_->spdy_session_pool(), test_hosts[2].key)); |
771 | 771 |
772 session_->spdy_session_pool()->CloseAllSessions(); | 772 session_->spdy_session_pool()->CloseAllSessions(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 } | 805 } |
806 | 806 |
807 MockRead reads[] = { | 807 MockRead reads[] = { |
808 MockRead(ASYNC, ERR_IO_PENDING), | 808 MockRead(ASYNC, ERR_IO_PENDING), |
809 }; | 809 }; |
810 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 810 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
811 socket_factory_.AddSocketDataProvider(&data); | 811 socket_factory_.AddSocketDataProvider(&data); |
812 socket_factory_.AddSSLSocketDataProvider(ssl); | 812 socket_factory_.AddSSLSocketDataProvider(ssl); |
813 | 813 |
814 CreatePool(true /* tcp pool */, false, false); | 814 CreatePool(true /* tcp pool */, false, false); |
815 scoped_refptr<SpdySession> spdy_session = | 815 base::WeakPtr<SpdySession> spdy_session = |
816 CreateSecureSpdySession(session_, test_hosts[0].key, BoundNetLog()); | 816 CreateSecureSpdySession(session_, test_hosts[0].key, BoundNetLog()); |
817 | 817 |
818 EXPECT_TRUE( | 818 EXPECT_TRUE( |
819 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); | 819 HasSpdySession(session_->spdy_session_pool(), test_hosts[0].key)); |
820 EXPECT_FALSE( | 820 EXPECT_FALSE( |
821 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); | 821 HasSpdySession(session_->spdy_session_pool(), test_hosts[1].key)); |
822 | 822 |
823 session_->spdy_session_pool()->CloseAllSessions(); | 823 session_->spdy_session_pool()->CloseAllSessions(); |
824 } | 824 } |
825 | 825 |
(...skipping 14 matching lines...) Expand all Loading... |
840 ssl.channel_id_sent = true; | 840 ssl.channel_id_sent = true; |
841 ssl.SetNextProto(kProtoSPDY2); | 841 ssl.SetNextProto(kProtoSPDY2); |
842 TestIPPoolingDisabled(&ssl); | 842 TestIPPoolingDisabled(&ssl); |
843 } | 843 } |
844 | 844 |
845 // It would be nice to also test the timeouts in SSLClientSocketPool. | 845 // It would be nice to also test the timeouts in SSLClientSocketPool. |
846 | 846 |
847 } // namespace | 847 } // namespace |
848 | 848 |
849 } // namespace net | 849 } // namespace net |
OLD | NEW |