| 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 <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 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 } | 1793 } |
| 1794 | 1794 |
| 1795 // Send a version negotiation packet from the server for a different | 1795 // Send a version negotiation packet from the server for a different |
| 1796 // connection ID. It should be ignored. | 1796 // connection ID. It should be ignored. |
| 1797 TEST_P(EndToEndTest, ServerSendVersionNegotiationWithDifferentConnectionId) { | 1797 TEST_P(EndToEndTest, ServerSendVersionNegotiationWithDifferentConnectionId) { |
| 1798 ASSERT_TRUE(Initialize()); | 1798 ASSERT_TRUE(Initialize()); |
| 1799 | 1799 |
| 1800 // Send the version negotiation packet. | 1800 // Send the version negotiation packet. |
| 1801 QuicConnectionId incorrect_connection_id = | 1801 QuicConnectionId incorrect_connection_id = |
| 1802 client_->client()->session()->connection()->connection_id() + 1; | 1802 client_->client()->session()->connection()->connection_id() + 1; |
| 1803 QuicVersionNegotiationPacket header; | |
| 1804 header.connection_id = incorrect_connection_id; | |
| 1805 header.reset_flag = true; | |
| 1806 header.version_flag = true; | |
| 1807 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), | |
| 1808 Perspective::IS_SERVER); | |
| 1809 scoped_ptr<QuicEncryptedPacket> packet( | 1803 scoped_ptr<QuicEncryptedPacket> packet( |
| 1810 framer.BuildVersionNegotiationPacket(header, server_supported_versions_)); | 1804 QuicFramer::BuildVersionNegotiationPacket(incorrect_connection_id, |
| 1805 server_supported_versions_)); |
| 1811 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; | 1806 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; |
| 1812 client_->client()->session()->connection()->set_debug_visitor(&visitor); | 1807 client_->client()->session()->connection()->set_debug_visitor(&visitor); |
| 1813 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) | 1808 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) |
| 1814 .Times(1); | 1809 .Times(1); |
| 1815 // We must pause the server's thread in order to call WritePacket without | 1810 // We must pause the server's thread in order to call WritePacket without |
| 1816 // race conditions. | 1811 // race conditions. |
| 1817 server_thread_->Pause(); | 1812 server_thread_->Pause(); |
| 1818 server_writer_->WritePacket(packet->data(), packet->length(), | 1813 server_writer_->WritePacket(packet->data(), packet->length(), |
| 1819 server_address_.address(), | 1814 server_address_.address(), |
| 1820 client_->client()->client_address()); | 1815 client_->client()->client_address()); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2115 client_->WaitForResponseForMs(100); | 2110 client_->WaitForResponseForMs(100); |
| 2116 ReliableQuicStream* stream = client_->client()->session()->GetStream(5); | 2111 ReliableQuicStream* stream = client_->client()->session()->GetStream(5); |
| 2117 EXPECT_TRUE(stream == nullptr); | 2112 EXPECT_TRUE(stream == nullptr); |
| 2118 } | 2113 } |
| 2119 } | 2114 } |
| 2120 | 2115 |
| 2121 } // namespace | 2116 } // namespace |
| 2122 } // namespace test | 2117 } // namespace test |
| 2123 } // namespace tools | 2118 } // namespace tools |
| 2124 } // namespace net | 2119 } // namespace net |
| OLD | NEW |