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

Unified Diff: net/tools/quic/quic_server_session_test.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_spdy_server_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_server_session_test.cc
diff --git a/net/tools/quic/quic_server_session_test.cc b/net/tools/quic/quic_server_session_test.cc
index 6a17f5391aa7652647cbe7c6ccfc3b3bab328bbe..b0ed5d1ec1d9090e20ea684aa737c5cecd1a4763 100644
--- a/net/tools/quic/quic_server_session_test.cc
+++ b/net/tools/quic/quic_server_session_test.cc
@@ -292,7 +292,7 @@ class MockQuicCryptoServerStream : public QuicCryptoServerStream {
explicit MockQuicCryptoServerStream(
const QuicCryptoServerConfig& crypto_config, QuicSession* session)
: QuicCryptoServerStream(crypto_config, session) {}
- virtual ~MockQuicCryptoServerStream() {}
+ ~MockQuicCryptoServerStream() override {}
MOCK_METHOD1(SendServerConfigUpdate,
void(const CachedNetworkParameters* cached_network_parameters));
@@ -383,6 +383,46 @@ TEST_P(QuicServerSessionTest, BandwidthEstimates) {
session_->OnCongestionWindowChange(now);
}
+TEST_P(QuicServerSessionTest, BandwidthResumptionExperiment) {
+ ValueRestore<bool> old_flag(
+ &FLAGS_quic_enable_bandwidth_resumption_experiment, true);
+
+ // Test that if a client provides a CachedNetworkParameters with the same
+ // serving region as the current server, that this data is passed down to the
+ // send algorithm.
+
+ // Client has sent kBWRE connection option to trigger bandwidth resumption.
+ QuicTagVector copt;
+ copt.push_back(kBWRE);
+ QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
+
+ const string kTestServingRegion = "a serving region";
+ session_->set_serving_region(kTestServingRegion);
+
+ QuicCryptoServerStream* crypto_stream =
+ static_cast<QuicCryptoServerStream*>(
+ QuicSessionPeer::GetCryptoStream(session_.get()));
+
+ // No effect if no CachedNetworkParameters provided.
+ EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(0);
+ session_->OnConfigNegotiated();
+
+ // No effect if CachedNetworkParameters provided, but different serving
+ // regions.
+ CachedNetworkParameters cached_network_params;
+ cached_network_params.set_bandwidth_estimate_bytes_per_second(1);
+ cached_network_params.set_serving_region("different serving region");
+ crypto_stream->set_previous_cached_network_params(cached_network_params);
+ EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(0);
+ session_->OnConfigNegotiated();
+
+ // Same serving region results in CachedNetworkParameters being stored.
+ cached_network_params.set_serving_region(kTestServingRegion);
+ crypto_stream->set_previous_cached_network_params(cached_network_params);
+ EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1);
+ session_->OnConfigNegotiated();
+}
+
} // namespace
} // namespace test
} // namespace tools
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_spdy_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698