| 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/spdy/spdy_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
| 6 | 6 |
| 7 #include "crypto/ec_private_key.h" | 7 #include "crypto/ec_private_key.h" |
| 8 #include "crypto/ec_signature_creator.h" | 8 #include "crypto/ec_signature_creator.h" |
| 9 #include "crypto/signature_creator.h" | 9 #include "crypto/signature_creator.h" |
| 10 #include "net/base/asn1_util.h" | 10 #include "net/base/asn1_util.h" |
| 11 #include "net/base/default_server_bound_cert_store.h" | 11 #include "net/base/default_server_bound_cert_store.h" |
| 12 #include "net/http/http_response_headers.h" | 12 #include "net/http/http_response_headers.h" |
| 13 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
| 14 #include "net/spdy/spdy_http_utils.h" | 14 #include "net/spdy/spdy_http_utils.h" |
| 15 #include "net/spdy/spdy_session.h" | 15 #include "net/spdy/spdy_session.h" |
| 16 #include "net/spdy/spdy_test_util_spdy3.h" | 16 #include "net/spdy/spdy_test_util_spdy3.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 using namespace net::test_spdy3; | 19 using namespace net::test_spdy3; |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class SpdyHttpStreamSpdy3Test : public testing::Test { | 23 class SpdyHttpStreamSpdy3Test : public testing::Test { |
| 24 public: | 24 public: |
| 25 OrderedSocketData* data() { return data_.get(); } | 25 OrderedSocketData* data() { return data_.get(); } |
| 26 protected: | 26 protected: |
| 27 SpdyHttpStreamSpdy3Test() {} | 27 SpdyHttpStreamSpdy3Test() {} |
| 28 | 28 |
| 29 virtual void SetUp() { | 29 virtual void SetUp() { |
| 30 SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY3); | 30 SpdySession::set_default_protocol(kProtoSPDY3); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual void TearDown() { | 33 virtual void TearDown() { |
| 34 crypto::ECSignatureCreator::SetFactoryForTesting(NULL); | 34 crypto::ECSignatureCreator::SetFactoryForTesting(NULL); |
| 35 MessageLoop::current()->RunAllPending(); | 35 MessageLoop::current()->RunAllPending(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 int InitSession(MockRead* reads, size_t reads_count, | 38 int InitSession(MockRead* reads, size_t reads_count, |
| 39 MockWrite* writes, size_t writes_count, | 39 MockWrite* writes, size_t writes_count, |
| 40 HostPortPair& host_port_pair) { | 40 HostPortPair& host_port_pair) { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 DeterministicMockClientSocketFactory* socket_factory = | 377 DeterministicMockClientSocketFactory* socket_factory = |
| 378 session_deps_.deterministic_socket_factory.get(); | 378 session_deps_.deterministic_socket_factory.get(); |
| 379 scoped_refptr<DeterministicSocketData> data( | 379 scoped_refptr<DeterministicSocketData> data( |
| 380 new DeterministicSocketData(reads, arraysize(reads), | 380 new DeterministicSocketData(reads, arraysize(reads), |
| 381 writes, arraysize(writes))); | 381 writes, arraysize(writes))); |
| 382 socket_factory->AddSocketDataProvider(data.get()); | 382 socket_factory->AddSocketDataProvider(data.get()); |
| 383 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 383 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
| 384 ssl.domain_bound_cert_type = type; | 384 ssl.domain_bound_cert_type = type; |
| 385 ssl.server_bound_cert_service = server_bound_cert_service; | 385 ssl.server_bound_cert_service = server_bound_cert_service; |
| 386 ssl.protocol_negotiated = SSLClientSocket::kProtoSPDY3; | 386 ssl.protocol_negotiated = kProtoSPDY3; |
| 387 socket_factory->AddSSLSocketDataProvider(&ssl); | 387 socket_factory->AddSSLSocketDataProvider(&ssl); |
| 388 http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( | 388 http_session_ = SpdySessionDependencies::SpdyCreateSessionDeterministic( |
| 389 &session_deps_); | 389 &session_deps_); |
| 390 session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog()); | 390 session_ = http_session_->spdy_session_pool()->Get(pair, BoundNetLog()); |
| 391 transport_params_ = new TransportSocketParams(host_port_pair, | 391 transport_params_ = new TransportSocketParams(host_port_pair, |
| 392 MEDIUM, false, false); | 392 MEDIUM, false, false); |
| 393 TestCompletionCallback callback; | 393 TestCompletionCallback callback; |
| 394 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 394 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 395 SSLConfig ssl_config; | 395 SSLConfig ssl_config; |
| 396 scoped_refptr<SOCKSSocketParams> socks_params; | 396 scoped_refptr<SOCKSSocketParams> socks_params; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 TestSendCredentials(server_bound_cert_service.get(), cert, proof, | 517 TestSendCredentials(server_bound_cert_service.get(), cert, proof, |
| 518 CLIENT_CERT_ECDSA_SIGN); | 518 CLIENT_CERT_ECDSA_SIGN); |
| 519 } | 519 } |
| 520 | 520 |
| 521 #endif // !defined(USE_OPENSSL) | 521 #endif // !defined(USE_OPENSSL) |
| 522 | 522 |
| 523 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 523 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
| 524 // methods. | 524 // methods. |
| 525 | 525 |
| 526 } // namespace net | 526 } // namespace net |
| OLD | NEW |