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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Initializes the session using SequencedSocketData. | 81 // Initializes the session using SequencedSocketData. |
82 void InitSession(MockRead* reads, | 82 void InitSession(MockRead* reads, |
83 size_t reads_count, | 83 size_t reads_count, |
84 MockWrite* writes, | 84 MockWrite* writes, |
85 size_t writes_count, | 85 size_t writes_count, |
86 const SpdySessionKey& key) { | 86 const SpdySessionKey& key) { |
87 sequenced_data_.reset( | 87 sequenced_data_.reset( |
88 new SequencedSocketData(reads, reads_count, writes, writes_count)); | 88 new SequencedSocketData(reads, reads_count, writes, writes_count)); |
89 session_deps_.socket_factory->AddSocketDataProvider(sequenced_data_.get()); | 89 session_deps_.socket_factory->AddSocketDataProvider(sequenced_data_.get()); |
90 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); | 90 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); |
91 session_ = CreateInsecureSpdySession(http_session_, key, BoundNetLog()); | 91 session_ = |
| 92 CreateInsecureSpdySession(http_session_.get(), key, BoundNetLog()); |
92 } | 93 } |
93 | 94 |
94 void TestSendCredentials( | 95 void TestSendCredentials( |
95 ChannelIDService* channel_id_service, | 96 ChannelIDService* channel_id_service, |
96 const std::string& cert, | 97 const std::string& cert, |
97 const std::string& proof); | 98 const std::string& proof); |
98 | 99 |
99 SpdyTestUtil spdy_util_; | 100 SpdyTestUtil spdy_util_; |
100 TestNetLog net_log_; | 101 TestNetLog net_log_; |
101 SpdySessionDependencies session_deps_; | 102 SpdySessionDependencies session_deps_; |
102 scoped_ptr<SequencedSocketData> sequenced_data_; | 103 scoped_ptr<SequencedSocketData> sequenced_data_; |
103 scoped_refptr<HttpNetworkSession> http_session_; | 104 scoped_ptr<HttpNetworkSession> http_session_; |
104 base::WeakPtr<SpdySession> session_; | 105 base::WeakPtr<SpdySession> session_; |
105 | 106 |
106 private: | 107 private: |
107 MockECSignatureCreatorFactory ec_signature_creator_factory_; | 108 MockECSignatureCreatorFactory ec_signature_creator_factory_; |
108 }; | 109 }; |
109 | 110 |
110 INSTANTIATE_TEST_CASE_P(NextProto, | 111 INSTANTIATE_TEST_CASE_P(NextProto, |
111 SpdyHttpStreamTest, | 112 SpdyHttpStreamTest, |
112 testing::Values(kProtoSPDY31, | 113 testing::Values(kProtoSPDY31, |
113 kProtoHTTP2)); | 114 kProtoHTTP2)); |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); | 762 EXPECT_EQ(kUploadData, std::string(buf1->data(), kUploadDataSize)); |
762 | 763 |
763 ASSERT_TRUE(response.headers.get()); | 764 ASSERT_TRUE(response.headers.get()); |
764 ASSERT_EQ(200, response.headers->response_code()); | 765 ASSERT_EQ(200, response.headers->response_code()); |
765 } | 766 } |
766 | 767 |
767 // TODO(willchan): Write a longer test for SpdyStream that exercises all | 768 // TODO(willchan): Write a longer test for SpdyStream that exercises all |
768 // methods. | 769 // methods. |
769 | 770 |
770 } // namespace net | 771 } // namespace net |
OLD | NEW |