OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bidirectional_stream.h" | 5 #include "net/http/bidirectional_stream.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 true, this, std::move(timer_))); | 177 true, this, std::move(timer_))); |
178 if (run_until_completion_) | 178 if (run_until_completion_) |
179 WaitUntilCompletion(); | 179 WaitUntilCompletion(); |
180 } | 180 } |
181 | 181 |
182 void WaitUntilCompletion() { loop_->Run(); } | 182 void WaitUntilCompletion() { loop_->Run(); } |
183 | 183 |
184 void SendData(const scoped_refptr<IOBuffer>& data, | 184 void SendData(const scoped_refptr<IOBuffer>& data, |
185 int length, | 185 int length, |
186 bool end_of_stream) { | 186 bool end_of_stream) { |
187 not_expect_callback_ = true; | 187 SendvData({data}, {length}, end_of_stream); |
188 stream_->SendData(data, length, end_of_stream); | |
189 not_expect_callback_ = false; | |
190 } | 188 } |
191 | 189 |
192 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& data, | 190 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& data, |
193 const std::vector<int>& length, | 191 const std::vector<int>& length, |
194 bool end_of_stream) { | 192 bool end_of_stream) { |
195 not_expect_callback_ = true; | 193 not_expect_callback_ = true; |
196 stream_->SendvData(data, length, end_of_stream); | 194 stream_->SendvData(data, length, end_of_stream); |
197 not_expect_callback_ = false; | 195 not_expect_callback_ = false; |
198 } | 196 } |
199 | 197 |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 // Headers received should happen after HTTP_STREAM_REQUEST. | 760 // Headers received should happen after HTTP_STREAM_REQUEST. |
763 index = ExpectLogContainsSomewhere( | 761 index = ExpectLogContainsSomewhere( |
764 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_RECV_HEADERS, | 762 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_RECV_HEADERS, |
765 NetLogEventPhase::NONE); | 763 NetLogEventPhase::NONE); |
766 // Trailers received should happen after headers received. It might happen | 764 // Trailers received should happen after headers received. It might happen |
767 // before the reads complete. | 765 // before the reads complete. |
768 ExpectLogContainsSomewhere( | 766 ExpectLogContainsSomewhere( |
769 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_RECV_TRAILERS, | 767 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_RECV_TRAILERS, |
770 NetLogEventPhase::NONE); | 768 NetLogEventPhase::NONE); |
771 index = ExpectLogContainsSomewhere( | 769 index = ExpectLogContainsSomewhere( |
772 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_SEND_DATA, | 770 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_SENDV_DATA, |
773 NetLogEventPhase::NONE); | 771 NetLogEventPhase::NONE); |
774 index = ExpectLogContainsSomewhere( | 772 index = ExpectLogContainsSomewhere( |
775 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_READ_DATA, | 773 entries, index, NetLogEventType::BIDIRECTIONAL_STREAM_READ_DATA, |
776 NetLogEventPhase::NONE); | 774 NetLogEventPhase::NONE); |
777 TestNetLogEntry entry = entries[index]; | 775 TestNetLogEntry entry = entries[index]; |
778 int read_result = 0; | 776 int read_result = 0; |
779 EXPECT_TRUE(entry.params->GetInteger("rv", &read_result)); | 777 EXPECT_TRUE(entry.params->GetInteger("rv", &read_result)); |
780 EXPECT_EQ(ERR_IO_PENDING, read_result); | 778 EXPECT_EQ(ERR_IO_PENDING, read_result); |
781 | 779 |
782 // Sent bytes. Sending data is always asynchronous. | 780 // Sent bytes. Sending data is always asynchronous. |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 AlternativeServiceInfoVector alternative_service_info_vector = | 1655 AlternativeServiceInfoVector alternative_service_info_vector = |
1658 http_session_->http_server_properties()->GetAlternativeServiceInfos( | 1656 http_session_->http_server_properties()->GetAlternativeServiceInfos( |
1659 url::SchemeHostPort(default_url_)); | 1657 url::SchemeHostPort(default_url_)); |
1660 ASSERT_EQ(1u, alternative_service_info_vector.size()); | 1658 ASSERT_EQ(1u, alternative_service_info_vector.size()); |
1661 AlternativeService alternative_service(kProtoQUIC, "www.example.org", 443); | 1659 AlternativeService alternative_service(kProtoQUIC, "www.example.org", 443); |
1662 EXPECT_EQ(alternative_service, | 1660 EXPECT_EQ(alternative_service, |
1663 alternative_service_info_vector[0].alternative_service); | 1661 alternative_service_info_vector[0].alternative_service); |
1664 } | 1662 } |
1665 | 1663 |
1666 } // namespace net | 1664 } // namespace net |
OLD | NEW |