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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "crypto/ec_private_key.h" | 13 #include "crypto/ec_private_key.h" |
14 #include "crypto/ec_signature_creator.h" | 14 #include "crypto/ec_signature_creator.h" |
15 #include "crypto/signature_creator.h" | 15 #include "crypto/signature_creator.h" |
16 #include "net/base/capturing_net_log.h" | 16 #include "net/base/capturing_net_log.h" |
17 #include "net/base/load_timing_info.h" | 17 #include "net/base/load_timing_info.h" |
18 #include "net/base/load_timing_info_test_util.h" | 18 #include "net/base/load_timing_info_test_util.h" |
19 #include "net/base/upload_data_stream.h" | 19 #include "net/base/upload_data_stream.h" |
20 #include "net/base/upload_element_reader.h" | 20 #include "net/base/upload_element_reader.h" |
21 #include "net/cert/asn1_util.h" | 21 #include "net/cert/asn1_util.h" |
22 #include "net/http/http_request_info.h" | 22 #include "net/http/http_request_info.h" |
23 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
24 #include "net/http/http_response_info.h" | 24 #include "net/http/http_response_info.h" |
25 #include "net/socket/next_proto.h" | 25 #include "net/socket/next_proto.h" |
26 #include "net/socket/socket_test_util.h" | 26 #include "net/socket/socket_test_util.h" |
27 #include "net/spdy/spdy_http_utils.h" | 27 #include "net/spdy/spdy_http_utils.h" |
28 #include "net/spdy/spdy_session.h" | 28 #include "net/spdy/spdy_session.h" |
29 #include "net/spdy/spdy_test_util_common.h" | 29 #include "net/spdy/spdy_test_util_common.h" |
30 #include "net/ssl/default_server_bound_cert_store.h" | 30 #include "net/ssl/default_channel_id_store.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 // Tests the load timing of a stream that's connected and is not the first | 37 // Tests the load timing of a stream that's connected and is not the first |
38 // request sent on a connection. | 38 // request sent on a connection. |
39 void TestLoadTimingReused(const HttpStream& stream) { | 39 void TestLoadTimingReused(const HttpStream& stream) { |
40 LoadTimingInfo load_timing_info; | 40 LoadTimingInfo load_timing_info; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 MockWrite* writes, size_t writes_count, | 104 MockWrite* writes, size_t writes_count, |
105 const SpdySessionKey& key) { | 105 const SpdySessionKey& key) { |
106 data_.reset(new OrderedSocketData(reads, reads_count, | 106 data_.reset(new OrderedSocketData(reads, reads_count, |
107 writes, writes_count)); | 107 writes, writes_count)); |
108 session_deps_.socket_factory->AddSocketDataProvider(data_.get()); | 108 session_deps_.socket_factory->AddSocketDataProvider(data_.get()); |
109 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); | 109 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); |
110 session_ = CreateInsecureSpdySession(http_session_, key, BoundNetLog()); | 110 session_ = CreateInsecureSpdySession(http_session_, key, BoundNetLog()); |
111 } | 111 } |
112 | 112 |
113 void TestSendCredentials( | 113 void TestSendCredentials( |
114 ServerBoundCertService* server_bound_cert_service, | 114 ChannelIDService* channel_id_service, |
115 const std::string& cert, | 115 const std::string& cert, |
116 const std::string& proof); | 116 const std::string& proof); |
117 | 117 |
118 SpdyTestUtil spdy_util_; | 118 SpdyTestUtil spdy_util_; |
119 CapturingNetLog net_log_; | 119 CapturingNetLog net_log_; |
120 SpdySessionDependencies session_deps_; | 120 SpdySessionDependencies session_deps_; |
121 scoped_ptr<OrderedSocketData> data_; | 121 scoped_ptr<OrderedSocketData> data_; |
122 scoped_ptr<DeterministicSocketData> deterministic_data_; | 122 scoped_ptr<DeterministicSocketData> deterministic_data_; |
123 scoped_refptr<HttpNetworkSession> http_session_; | 123 scoped_refptr<HttpNetworkSession> http_session_; |
124 base::WeakPtr<SpdySession> session_; | 124 base::WeakPtr<SpdySession> session_; |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 ASSERT_TRUE(response.headers.get()); | 626 ASSERT_TRUE(response.headers.get()); |
627 ASSERT_EQ(200, response.headers->response_code()); | 627 ASSERT_EQ(200, response.headers->response_code()); |
628 EXPECT_TRUE(deterministic_data_->at_read_eof()); | 628 EXPECT_TRUE(deterministic_data_->at_read_eof()); |
629 EXPECT_TRUE(deterministic_data_->at_write_eof()); | 629 EXPECT_TRUE(deterministic_data_->at_write_eof()); |
630 } | 630 } |
631 | 631 |
632 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 632 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
633 // methods. | 633 // methods. |
634 | 634 |
635 } // namespace net | 635 } // namespace net |
OLD | NEW |