Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: net/tools/quic/test_tools/quic_test_client.cc

Issue 1784903003: Remove FEC from send path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@114770052
Patch Set: Restore accidentally removed OnRttChanged call Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/test_tools/quic_test_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tools/quic/test_tools/quic_test_client.h" 5 #include "net/tools/quic/test_tools/quic_test_client.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "net/base/completion_callback.h" 8 #include "net/base/completion_callback.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/cert/cert_verify_result.h" 10 #include "net/cert/cert_verify_result.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 stream_->set_visitor(nullptr); 194 stream_->set_visitor(nullptr);
195 } 195 }
196 client_->Disconnect(); 196 client_->Disconnect();
197 } 197 }
198 198
199 void QuicTestClient::Initialize() { 199 void QuicTestClient::Initialize() {
200 priority_ = 3; 200 priority_ = 3;
201 connect_attempted_ = false; 201 connect_attempted_ = false;
202 auto_reconnect_ = false; 202 auto_reconnect_ = false;
203 buffer_body_ = true; 203 buffer_body_ = true;
204 fec_policy_ = FEC_PROTECT_OPTIONAL;
205 ClearPerRequestState(); 204 ClearPerRequestState();
206 // As chrome will generally do this, we want it to be the default when it's 205 // As chrome will generally do this, we want it to be the default when it's
207 // not overridden. 206 // not overridden.
208 if (!client_->config()->HasSetBytesForConnectionIdToSend()) { 207 if (!client_->config()->HasSetBytesForConnectionIdToSend()) {
209 client_->config()->SetBytesForConnectionIdToSend(0); 208 client_->config()->SetBytesForConnectionIdToSend(0);
210 } 209 }
211 } 210 }
212 211
213 void QuicTestClient::SetUserAgentID(const string& user_agent_id) { 212 void QuicTestClient::SetUserAgentID(const string& user_agent_id) {
214 client_->SetUserAgentID(user_agent_id); 213 client_->SetUserAgentID(user_agent_id);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 386 }
388 if (!stream_) { 387 if (!stream_) {
389 stream_ = client_->CreateReliableClientStream(); 388 stream_ = client_->CreateReliableClientStream();
390 if (stream_ == nullptr) { 389 if (stream_ == nullptr) {
391 return nullptr; 390 return nullptr;
392 } 391 }
393 stream_->set_visitor(this); 392 stream_->set_visitor(this);
394 QuicSpdyClientStream* cs = reinterpret_cast<QuicSpdyClientStream*>(stream_); 393 QuicSpdyClientStream* cs = reinterpret_cast<QuicSpdyClientStream*>(stream_);
395 cs->SetPriority(priority_); 394 cs->SetPriority(priority_);
396 cs->set_allow_bidirectional_data(allow_bidirectional_data_); 395 cs->set_allow_bidirectional_data(allow_bidirectional_data_);
397 // Set FEC policy on stream.
398 ReliableQuicStreamPeer::SetFecPolicy(stream_, fec_policy_);
399 } 396 }
400 397
401 return stream_; 398 return stream_;
402 } 399 }
403 400
404 QuicErrorCode QuicTestClient::connection_error() { 401 QuicErrorCode QuicTestClient::connection_error() {
405 return client()->connection_error(); 402 return client()->connection_error();
406 } 403 }
407 404
408 MockableQuicClient* QuicTestClient::client() { 405 MockableQuicClient* QuicTestClient::client() {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 LOG(DFATAL) << "Not implemented"; 641 LOG(DFATAL) << "Not implemented";
645 return 0; 642 return 0;
646 } 643 }
647 644
648 void QuicTestClient::WaitForWriteToFlush() { 645 void QuicTestClient::WaitForWriteToFlush() {
649 while (connected() && client()->session()->HasDataToWrite()) { 646 while (connected() && client()->session()->HasDataToWrite()) {
650 client_->WaitForEvents(); 647 client_->WaitForEvents();
651 } 648 }
652 } 649 }
653 650
654 void QuicTestClient::SetFecPolicy(FecPolicy fec_policy) {
655 fec_policy_ = fec_policy;
656 // Set policy for headers and crypto streams.
657 ReliableQuicStreamPeer::SetFecPolicy(
658 QuicSpdySessionPeer::GetHeadersStream(client()->session()), fec_policy);
659 ReliableQuicStreamPeer::SetFecPolicy(client()->session()->GetCryptoStream(),
660 fec_policy);
661 }
662
663 void QuicTestClient::TestClientDataToResend::Resend() { 651 void QuicTestClient::TestClientDataToResend::Resend() {
664 test_client_->GetOrCreateStreamAndSendRequest(headers_, body_, fin_, 652 test_client_->GetOrCreateStreamAndSendRequest(headers_, body_, fin_,
665 delegate_); 653 delegate_);
666 if (headers_ != nullptr) { 654 if (headers_ != nullptr) {
667 delete headers_; 655 delete headers_;
668 headers_ = nullptr; 656 headers_ = nullptr;
669 } 657 }
670 } 658 }
671 659
672 // static 660 // static
673 void QuicTestClient::FillInRequest(const string& uri, HTTPMessage* message) { 661 void QuicTestClient::FillInRequest(const string& uri, HTTPMessage* message) {
674 CHECK(message); 662 CHECK(message);
675 message->headers()->SetRequestVersion( 663 message->headers()->SetRequestVersion(
676 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); 664 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1));
677 message->headers()->SetRequestMethod( 665 message->headers()->SetRequestMethod(
678 HTTPMessage::MethodToString(HttpConstants::GET)); 666 HTTPMessage::MethodToString(HttpConstants::GET));
679 message->headers()->SetRequestUri(uri); 667 message->headers()->SetRequestUri(uri);
680 } 668 }
681 669
682 } // namespace test 670 } // namespace test
683 } // namespace net 671 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/quic_test_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698