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

Side by Side Diff: net/tools/quic/end_to_end_test.cc

Issue 1335443002: Landing Recent QUIC changes until 8/26/2015 19:47 UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/quic/quic_session.cc ('k') | net/tools/quic/quic_spdy_server_stream.cc » ('j') | 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 <stddef.h> 5 #include <stddef.h>
6 #include <string> 6 #include <string>
7 #include <sys/epoll.h> 7 #include <sys/epoll.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 return QuicPacketWriterWrapper::WritePacket( 1352 return QuicPacketWriterWrapper::WritePacket(
1353 buffer, buf_len, self_address_.address(), peer_address); 1353 buffer, buf_len, self_address_.address(), peer_address);
1354 } 1354 }
1355 1355
1356 bool IsWriteBlockedDataBuffered() const override { return false; } 1356 bool IsWriteBlockedDataBuffered() const override { return false; }
1357 1357
1358 IPEndPoint self_address_; 1358 IPEndPoint self_address_;
1359 }; 1359 };
1360 1360
1361 TEST_P(EndToEndTest, ConnectionMigrationClientIPChanged) { 1361 TEST_P(EndToEndTest, ConnectionMigrationClientIPChanged) {
1362 // Allow client IP migration during an established QUIC connection.
1363 ValueRestore<bool> old_flag(&FLAGS_quic_allow_ip_migration, true);
1364
1365 ASSERT_TRUE(Initialize()); 1362 ASSERT_TRUE(Initialize());
1366 1363
1367 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1364 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1368 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1365 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1369 1366
1370 // Store the client IP address which was used to send the first request. 1367 // Store the client IP address which was used to send the first request.
1371 IPAddressNumber old_host = client_->client()->client_address().address(); 1368 IPAddressNumber old_host = client_->client()->client_address().address();
1372 1369
1373 // Migrate socket to the new IP address. 1370 // Migrate socket to the new IP address.
1374 IPAddressNumber new_host; 1371 IPAddressNumber new_host;
1375 CHECK(net::ParseIPLiteralToNumber("127.0.0.2", &new_host)); 1372 CHECK(net::ParseIPLiteralToNumber("127.0.0.2", &new_host));
1376 EXPECT_NE(old_host, new_host); 1373 EXPECT_NE(old_host, new_host);
1377 ASSERT_TRUE(client_->client()->MigrateSocket(new_host)); 1374 ASSERT_TRUE(client_->client()->MigrateSocket(new_host));
1378 1375
1379 // Send a request using the new socket. 1376 // Send a request using the new socket.
1380 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); 1377 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar"));
1381 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1378 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1382 } 1379 }
1383 1380
1384 TEST_P(EndToEndTest, ConnectionMigrationClientIPChangedUnsupported) {
1385 // Tests that the client's IP can not change during an established QUIC
1386 // connection. If it changes, the connection is closed by the server as we
1387 // do not yet support IP migration.
1388 ValueRestore<bool> old_flag(&FLAGS_quic_allow_ip_migration, false);
1389
1390 ASSERT_TRUE(Initialize());
1391
1392 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1393 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1394
1395 WrongAddressWriter* writer = new WrongAddressWriter();
1396
1397 writer->set_writer(new QuicDefaultPacketWriter(client_->client()->fd()));
1398 QuicConnectionPeer::SetWriter(client_->client()->session()->connection(),
1399 writer, /* owns_writer= */ true);
1400
1401 client_->SendSynchronousRequest("/bar");
1402
1403 EXPECT_EQ(QUIC_STREAM_CONNECTION_ERROR, client_->stream_error());
1404 EXPECT_EQ(QUIC_ERROR_MIGRATING_ADDRESS, client_->connection_error());
1405 }
1406
1407 TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) { 1381 TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) {
1408 // Tests that the client's port can change during an established QUIC 1382 // Tests that the client's port can change during an established QUIC
1409 // connection, and that doing so does not result in the connection being 1383 // connection, and that doing so does not result in the connection being
1410 // closed by the server. 1384 // closed by the server.
1411 ASSERT_TRUE(Initialize()); 1385 ASSERT_TRUE(Initialize());
1412 1386
1413 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1387 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1414 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1388 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1415 1389
1416 // Store the client address which was used to send the first request. 1390 // Store the client address which was used to send the first request.
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 1838
1865 // The connection should not be terminated. 1839 // The connection should not be terminated.
1866 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); 1840 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo"));
1867 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); 1841 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code());
1868 } 1842 }
1869 1843
1870 } // namespace 1844 } // namespace
1871 } // namespace test 1845 } // namespace test
1872 } // namespace tools 1846 } // namespace tools
1873 } // namespace net 1847 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/tools/quic/quic_spdy_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698