| OLD | NEW |
| 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 <sys/epoll.h> | 6 #include <sys/epoll.h> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 return QuicPacketWriterWrapper::WritePacket( | 1466 return QuicPacketWriterWrapper::WritePacket( |
| 1467 buffer, buf_len, self_address_.address().bytes(), peer_address); | 1467 buffer, buf_len, self_address_.address().bytes(), peer_address); |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 bool IsWriteBlockedDataBuffered() const override { return false; } | 1470 bool IsWriteBlockedDataBuffered() const override { return false; } |
| 1471 | 1471 |
| 1472 IPEndPoint self_address_; | 1472 IPEndPoint self_address_; |
| 1473 }; | 1473 }; |
| 1474 | 1474 |
| 1475 TEST_P(EndToEndTest, ConnectionMigrationClientIPChanged) { | 1475 TEST_P(EndToEndTest, ConnectionMigrationClientIPChanged) { |
| 1476 ValueRestore<bool> old_flag(&FLAGS_quic_disable_non_nat_address_migration, | |
| 1477 false); | |
| 1478 ASSERT_TRUE(Initialize()); | 1476 ASSERT_TRUE(Initialize()); |
| 1479 | 1477 |
| 1480 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1478 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1481 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1479 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1482 | 1480 |
| 1483 // Store the client IP address which was used to send the first request. | 1481 // Store the client IP address which was used to send the first request. |
| 1484 IPAddressNumber old_host = | 1482 IPAddressNumber old_host = |
| 1485 client_->client()->GetLatestClientAddress().address().bytes(); | 1483 client_->client()->GetLatestClientAddress().address().bytes(); |
| 1486 | 1484 |
| 1487 // Migrate socket to the new IP address. | 1485 // Migrate socket to the new IP address. |
| 1488 IPAddressNumber new_host; | 1486 IPAddressNumber new_host; |
| 1489 CHECK(net::ParseIPLiteralToNumber("127.0.0.2", &new_host)); | 1487 CHECK(net::ParseIPLiteralToNumber("127.0.0.2", &new_host)); |
| 1490 EXPECT_NE(old_host, new_host); | 1488 EXPECT_NE(old_host, new_host); |
| 1491 ASSERT_TRUE(client_->client()->MigrateSocket(new_host)); | 1489 ASSERT_TRUE(client_->client()->MigrateSocket(new_host)); |
| 1492 | 1490 |
| 1493 // Send a request using the new socket. | 1491 // Send a request using the new socket. |
| 1494 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); | 1492 EXPECT_EQ(kBarResponseBody, client_->SendSynchronousRequest("/bar")); |
| 1495 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1493 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1496 } | 1494 } |
| 1497 | 1495 |
| 1498 TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) { | 1496 TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) { |
| 1499 ValueRestore<bool> old_flag(&FLAGS_quic_disable_non_nat_address_migration, | |
| 1500 false); | |
| 1501 // Tests that the client's port can change during an established QUIC | 1497 // Tests that the client's port can change during an established QUIC |
| 1502 // connection, and that doing so does not result in the connection being | 1498 // connection, and that doing so does not result in the connection being |
| 1503 // closed by the server. | 1499 // closed by the server. |
| 1504 ASSERT_TRUE(Initialize()); | 1500 ASSERT_TRUE(Initialize()); |
| 1505 | 1501 |
| 1506 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1502 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1507 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1503 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1508 | 1504 |
| 1509 // Store the client address which was used to send the first request. | 1505 // Store the client address which was used to send the first request. |
| 1510 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); | 1506 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 "www.google.com", "/trailer_url", headers, kBody, trailers); | 2166 "www.google.com", "/trailer_url", headers, kBody, trailers); |
| 2171 | 2167 |
| 2172 EXPECT_EQ(kBody, client_->SendSynchronousRequest("/trailer_url")); | 2168 EXPECT_EQ(kBody, client_->SendSynchronousRequest("/trailer_url")); |
| 2173 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 2169 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 2174 EXPECT_EQ(trailers, client_->response_trailers()); | 2170 EXPECT_EQ(trailers, client_->response_trailers()); |
| 2175 } | 2171 } |
| 2176 | 2172 |
| 2177 } // namespace | 2173 } // namespace |
| 2178 } // namespace test | 2174 } // namespace test |
| 2179 } // namespace net | 2175 } // namespace net |
| OLD | NEW |