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

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

Issue 341083007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix 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/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/end_to_end_test.cc
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc
index 2ad7a3911014811af57c5a17849b83795ff8f254..a21dc4082a346f0ed5cbc3a4207f9a2b9f74d250 100644
--- a/net/tools/quic/end_to_end_test.cc
+++ b/net/tools/quic/end_to_end_test.cc
@@ -182,9 +182,17 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
// Use different flow control windows for client/server.
client_config_.SetInitialFlowControlWindowToSend(
- 2 * kInitialFlowControlWindowForTest);
+ 2 * kInitialSessionFlowControlWindowForTest);
+ client_config_.SetInitialStreamFlowControlWindowToSend(
+ 2 * kInitialStreamFlowControlWindowForTest);
+ client_config_.SetInitialSessionFlowControlWindowToSend(
+ 2 * kInitialSessionFlowControlWindowForTest);
server_config_.SetInitialFlowControlWindowToSend(
- 3 * kInitialFlowControlWindowForTest);
+ 3 * kInitialSessionFlowControlWindowForTest);
+ server_config_.SetInitialStreamFlowControlWindowToSend(
+ 3 * kInitialStreamFlowControlWindowForTest);
+ server_config_.SetInitialSessionFlowControlWindowToSend(
+ 3 * kInitialSessionFlowControlWindowForTest);
QuicInMemoryCachePeer::ResetForTests();
AddToCache("GET", "https://www.google.com/foo",
@@ -217,12 +225,40 @@ class EndToEndTest : public ::testing::TestWithParam<TestParams> {
client_config_.SetInitialFlowControlWindowToSend(window);
}
+ void set_client_initial_stream_flow_control_receive_window(uint32 window) {
+ CHECK(client_.get() == NULL);
+ DLOG(INFO) << "Setting client initial stream flow control window: "
+ << window;
+ client_config_.SetInitialStreamFlowControlWindowToSend(window);
+ }
+
+ void set_client_initial_session_flow_control_receive_window(uint32 window) {
+ CHECK(client_.get() == NULL);
+ DLOG(INFO) << "Setting client initial session flow control window: "
+ << window;
+ client_config_.SetInitialSessionFlowControlWindowToSend(window);
+ }
+
void set_server_initial_flow_control_receive_window(uint32 window) {
CHECK(server_thread_.get() == NULL);
DVLOG(1) << "Setting server initial flow control window: " << window;
server_config_.SetInitialFlowControlWindowToSend(window);
}
+ void set_server_initial_stream_flow_control_receive_window(uint32 window) {
+ CHECK(server_thread_.get() == NULL);
+ DLOG(INFO) << "Setting server initial stream flow control window: "
+ << window;
+ server_config_.SetInitialStreamFlowControlWindowToSend(window);
+ }
+
+ void set_server_initial_session_flow_control_receive_window(uint32 window) {
+ CHECK(server_thread_.get() == NULL);
+ DLOG(INFO) << "Setting server initial session flow control window: "
+ << window;
+ server_config_.SetInitialSessionFlowControlWindowToSend(window);
+ }
+
bool Initialize() {
// Start the server first, because CreateQuicClient() attempts
// to connect to the server.
@@ -1065,7 +1101,7 @@ TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) {
IPEndPoint old_address = client_->client()->client_address();
// Stop listening on the old FD.
- EpollServer* eps = client_->client()->epoll_server();
+ EpollServer* eps = client_->epoll_server();
int old_fd = client_->client()->fd();
eps->UnregisterFD(old_fd);
// Create a new socket before closing the old one, which will result in a new
@@ -1103,7 +1139,9 @@ TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) {
EXPECT_NE(old_address.port(), new_address.port());
}
-TEST_P(EndToEndTest, DifferentFlowControlWindows) {
+
+TEST_P(EndToEndTest, DifferentFlowControlWindowsQ019) {
+ // TODO(rjshade): Remove this test when removing QUIC_VERSION_19.
// Client and server can set different initial flow control receive windows.
// These are sent in CHLO/SHLO. Tests that these values are exchanged properly
// in the crypto handshake.
@@ -1115,6 +1153,9 @@ TEST_P(EndToEndTest, DifferentFlowControlWindows) {
set_server_initial_flow_control_receive_window(kServerIFCW);
ASSERT_TRUE(Initialize());
+ if (negotiated_version_ > QUIC_VERSION_19) {
+ return;
+ }
// Values are exchanged during crypto handshake, so wait for that to finish.
client_->client()->WaitForCryptoHandshakeConfirmed();
@@ -1136,6 +1177,66 @@ TEST_P(EndToEndTest, DifferentFlowControlWindows) {
server_thread_->Resume();
}
+TEST_P(EndToEndTest, DifferentFlowControlWindowsQ020) {
+ // TODO(rjshade): Rename to DifferentFlowControlWindows when removing
+ // QUIC_VERSION_19.
+ // Client and server can set different initial flow control receive windows.
+ // These are sent in CHLO/SHLO. Tests that these values are exchanged properly
+ // in the crypto handshake.
+ const uint32 kClientStreamIFCW = 123456;
+ const uint32 kClientSessionIFCW = 234567;
+ set_client_initial_stream_flow_control_receive_window(kClientStreamIFCW);
+ set_client_initial_session_flow_control_receive_window(kClientSessionIFCW);
+
+ const uint32 kServerStreamIFCW = 654321;
+ const uint32 kServerSessionIFCW = 765432;
+ set_server_initial_stream_flow_control_receive_window(kServerStreamIFCW);
+ set_server_initial_session_flow_control_receive_window(kServerSessionIFCW);
+
+ ASSERT_TRUE(Initialize());
+ if (negotiated_version_ <= QUIC_VERSION_19) {
+ return;
+ }
+
+ // Values are exchanged during crypto handshake, so wait for that to finish.
+ client_->client()->WaitForCryptoHandshakeConfirmed();
+ server_thread_->WaitForCryptoHandshakeConfirmed();
+
+ // Open a data stream to make sure the stream level flow control is updated.
+ QuicSpdyClientStream* stream = client_->GetOrCreateStream();
+ stream->SendBody("hello", false);
+
+ // Client should have the right values for server's receive window.
+ EXPECT_EQ(kServerStreamIFCW,
+ client_->client()
+ ->session()
+ ->config()
+ ->ReceivedInitialStreamFlowControlWindowBytes());
+ EXPECT_EQ(kServerSessionIFCW,
+ client_->client()
+ ->session()
+ ->config()
+ ->ReceivedInitialSessionFlowControlWindowBytes());
+ EXPECT_EQ(kServerStreamIFCW, QuicFlowControllerPeer::SendWindowOffset(
+ stream->flow_controller()));
+ EXPECT_EQ(kServerSessionIFCW,
+ QuicFlowControllerPeer::SendWindowOffset(
+ client_->client()->session()->flow_controller()));
+
+ // Server should have the right values for client's receive window.
+ server_thread_->Pause();
+ QuicDispatcher* dispatcher =
+ QuicServerPeer::GetDispatcher(server_thread_->server());
+ QuicSession* session = dispatcher->session_map().begin()->second;
+ EXPECT_EQ(kClientStreamIFCW,
+ session->config()->ReceivedInitialStreamFlowControlWindowBytes());
+ EXPECT_EQ(kClientSessionIFCW,
+ session->config()->ReceivedInitialSessionFlowControlWindowBytes());
+ EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset(
+ session->flow_controller()));
+ server_thread_->Resume();
+}
+
} // namespace
} // namespace test
} // namespace tools
« no previous file with comments | « net/quic/test_tools/quic_test_utils.cc ('k') | net/tools/quic/quic_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698