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

Side by Side Diff: net/quic/quic_server_session_base_test.cc

Issue 2183493002: Add a merely pass-through QuicMultipathSentPacketManager. Protected behind blocked flag FLAGS_quic_… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/quic/quic_server_session_base.h" 5 #include "net/quic/quic_server_session_base.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 TEST_P(QuicServerSessionBaseTest, BandwidthEstimates) { 400 TEST_P(QuicServerSessionBaseTest, BandwidthEstimates) {
401 // Test that bandwidth estimate updates are sent to the client, only when 401 // Test that bandwidth estimate updates are sent to the client, only when
402 // bandwidth resumption is enabled, the bandwidth estimate has changed 402 // bandwidth resumption is enabled, the bandwidth estimate has changed
403 // sufficiently, enough time has passed, 403 // sufficiently, enough time has passed,
404 // and we don't have any other data to write. 404 // and we don't have any other data to write.
405 405
406 // Client has sent kBWRE connection option to trigger bandwidth resumption. 406 // Client has sent kBWRE connection option to trigger bandwidth resumption.
407 // Disable this flag because if connection uses multipath sent packet manager, 407 // Disable this flag because if connection uses multipath sent packet manager,
408 // static_cast here does not work. 408 // static_cast here does not work.
409 FLAGS_quic_enable_multipath = false;
410 QuicTagVector copt; 409 QuicTagVector copt;
411 copt.push_back(kBWRE); 410 copt.push_back(kBWRE);
412 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); 411 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
413 session_->OnConfigNegotiated(); 412 session_->OnConfigNegotiated();
414 EXPECT_TRUE( 413 EXPECT_TRUE(
415 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); 414 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
416 415
417 int32_t bandwidth_estimate_kbytes_per_second = 123; 416 int32_t bandwidth_estimate_kbytes_per_second = 123;
418 int32_t max_bandwidth_estimate_kbytes_per_second = 134; 417 int32_t max_bandwidth_estimate_kbytes_per_second = 134;
419 int32_t max_bandwidth_estimate_timestamp = 1122334455; 418 int32_t max_bandwidth_estimate_timestamp = 1122334455;
420 const string serving_region = "not a real region"; 419 const string serving_region = "not a real region";
421 session_->set_serving_region(serving_region); 420 session_->set_serving_region(serving_region);
422 421
423 MockQuicCryptoServerStream* crypto_stream = new MockQuicCryptoServerStream( 422 MockQuicCryptoServerStream* crypto_stream = new MockQuicCryptoServerStream(
424 &crypto_config_, &compressed_certs_cache_, session_.get()); 423 &crypto_config_, &compressed_certs_cache_, session_.get());
425 QuicServerSessionBasePeer::SetCryptoStream(session_.get(), crypto_stream); 424 QuicServerSessionBasePeer::SetCryptoStream(session_.get(), crypto_stream);
426 425
427 // Set some initial bandwidth values. 426 // Set some initial bandwidth values.
428 QuicSentPacketManager* sent_packet_manager = 427 QuicSentPacketManager* sent_packet_manager =
429 static_cast<QuicSentPacketManager*>( 428 QuicConnectionPeer::GetSentPacketManager(session_->connection(),
430 QuicConnectionPeer::GetSentPacketManager(session_->connection())); 429 kDefaultPathId);
431 QuicSustainedBandwidthRecorder& bandwidth_recorder = 430 QuicSustainedBandwidthRecorder& bandwidth_recorder =
432 QuicSentPacketManagerPeer::GetBandwidthRecorder(sent_packet_manager); 431 QuicSentPacketManagerPeer::GetBandwidthRecorder(sent_packet_manager);
433 // Seed an rtt measurement equal to the initial default rtt. 432 // Seed an rtt measurement equal to the initial default rtt.
434 RttStats* rtt_stats = 433 RttStats* rtt_stats =
435 const_cast<RttStats*>(sent_packet_manager->GetRttStats()); 434 const_cast<RttStats*>(sent_packet_manager->GetRttStats());
436 rtt_stats->UpdateRtt( 435 rtt_stats->UpdateRtt(
437 QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()), 436 QuicTime::Delta::FromMicroseconds(rtt_stats->initial_rtt_us()),
438 QuicTime::Delta::Zero(), QuicTime::Zero()); 437 QuicTime::Delta::Zero(), QuicTime::Zero());
439 QuicSustainedBandwidthRecorderPeer::SetBandwidthEstimate( 438 QuicSustainedBandwidthRecorderPeer::SetBandwidthEstimate(
440 &bandwidth_recorder, bandwidth_estimate_kbytes_per_second); 439 &bandwidth_recorder, bandwidth_estimate_kbytes_per_second);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 EXPECT_FALSE( 563 EXPECT_FALSE(
565 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); 564 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
566 session_->OnConfigNegotiated(); 565 session_->OnConfigNegotiated();
567 EXPECT_FALSE( 566 EXPECT_FALSE(
568 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get())); 567 QuicServerSessionBasePeer::IsBandwidthResumptionEnabled(session_.get()));
569 } 568 }
570 569
571 } // namespace 570 } // namespace
572 } // namespace test 571 } // namespace test
573 } // namespace net 572 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698