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

Unified Diff: net/quic/quic_config_test.cc

Issue 330333006: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linus_tsan error - reverted the change to ConnectionMigrationClientPortChanged unitttest Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_config_test.cc
diff --git a/net/quic/quic_config_test.cc b/net/quic/quic_config_test.cc
index 63299e5b0f7f28eb3e1a474df00181dc362b61aa..f77c3825c31ea421ce5075588100dbd2eac946d4 100644
--- a/net/quic/quic_config_test.cc
+++ b/net/quic/quic_config_test.cc
@@ -12,6 +12,7 @@
#include "net/quic/quic_time.h"
#include "net/quic/quic_utils.h"
#include "net/quic/test_tools/quic_test_utils.h"
+#include "net/test/gtest_util.h"
#include "testing/gtest/include/gtest/gtest.h"
using std::string;
@@ -32,6 +33,7 @@ class QuicConfigTest : public ::testing::Test {
TEST_F(QuicConfigTest, ToHandshakeMessage) {
ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, false);
config_.SetDefaults();
+ config_.SetInitialFlowControlWindowToSend(kInitialFlowControlWindowForTest);
config_.set_idle_connection_state_lifetime(QuicTime::Delta::FromSeconds(5),
QuicTime::Delta::FromSeconds(2));
config_.set_max_streams_per_connection(4, 2);
@@ -47,6 +49,10 @@ TEST_F(QuicConfigTest, ToHandshakeMessage) {
EXPECT_EQ(QUIC_NO_ERROR, error);
EXPECT_EQ(4u, value);
+ error = msg.GetUint32(kIFCW, &value);
+ EXPECT_EQ(QUIC_NO_ERROR, error);
+ EXPECT_EQ(kInitialFlowControlWindowForTest, value);
+
const QuicTag* out;
size_t out_len;
error = msg.GetTaglist(kCGST, &out, &out_len);
@@ -82,6 +88,8 @@ TEST_F(QuicConfigTest, ProcessClientHello) {
2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection);
client_config.SetInitialRoundTripTimeUsToSend(
10 * base::Time::kMicrosecondsPerMillisecond);
+ client_config.SetInitialFlowControlWindowToSend(
+ 2 * kInitialFlowControlWindowForTest);
QuicTagVector copt;
copt.push_back(kTBBR);
client_config.SetCongestionOptionsToSend(copt);
@@ -104,6 +112,8 @@ TEST_F(QuicConfigTest, ProcessClientHello) {
EXPECT_TRUE(config_.HasReceivedCongestionOptions());
EXPECT_EQ(1u, config_.ReceivedCongestionOptions().size());
EXPECT_EQ(config_.ReceivedCongestionOptions()[0], kTBBR);
+ EXPECT_EQ(config_.ReceivedInitialFlowControlWindowBytes(),
+ 2 * kInitialFlowControlWindowForTest);
}
TEST_F(QuicConfigTest, ProcessServerHello) {
@@ -120,6 +130,8 @@ TEST_F(QuicConfigTest, ProcessServerHello) {
server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2);
server_config.SetInitialRoundTripTimeUsToSend(
10 * base::Time::kMicrosecondsPerMillisecond);
+ server_config.SetInitialFlowControlWindowToSend(
+ 2 * kInitialFlowControlWindowForTest);
CryptoHandshakeMessage msg;
server_config.ToHandshakeMessage(&msg);
string error_details;
@@ -138,6 +150,8 @@ TEST_F(QuicConfigTest, ProcessServerHello) {
EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond,
config_.ReceivedInitialRoundTripTimeUs());
EXPECT_FALSE(config_.HasReceivedLossDetection());
+ EXPECT_EQ(config_.ReceivedInitialFlowControlWindowBytes(),
+ 2 * kInitialFlowControlWindowForTest);
}
TEST_F(QuicConfigTest, MissingOptionalValuesInCHLO) {
@@ -243,6 +257,18 @@ TEST_F(QuicConfigTest, NoOverLapInCGST) {
EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error);
}
+TEST_F(QuicConfigTest, InvalidFlowControlWindow) {
+ // QuicConfig should not accept an invalid flow control window to send to the
+ // peer: the receive window must be at least the default of 16 Kb.
+ QuicConfig config;
+ const uint64 kInvalidWindow = kDefaultFlowControlSendWindow - 1;
+ EXPECT_DFATAL(config.SetInitialFlowControlWindowToSend(kInvalidWindow),
+ "Initial flow control receive window");
+
+ EXPECT_EQ(kDefaultFlowControlSendWindow,
+ config.GetInitialFlowControlWindowToSend());
+}
+
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_crypto_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698