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

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

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implicitcast: numericstest 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/tools/flip_server/url_utilities_unittest.cc ('k') | ui/base/page_transition_types.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 "net/tools/quic/quic_client_session.h" 5 #include "net/tools/quic/quic_client_session.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "net/base/ip_endpoint.h" 9 #include "net/base/ip_endpoint.h"
10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 static bool CheckForDecryptionError(QuicFramer* framer) { 123 static bool CheckForDecryptionError(QuicFramer* framer) {
124 return framer->error() == QUIC_DECRYPTION_FAILURE; 124 return framer->error() == QUIC_DECRYPTION_FAILURE;
125 } 125 }
126 126
127 // Regression test for b/17206611. 127 // Regression test for b/17206611.
128 TEST_P(ToolsQuicClientSessionTest, InvalidPacketReceived) { 128 TEST_P(ToolsQuicClientSessionTest, InvalidPacketReceived) {
129 IPEndPoint server_address(TestPeerIPAddress(), kTestPort); 129 IPEndPoint server_address(TestPeerIPAddress(), kTestPort);
130 IPEndPoint client_address(TestPeerIPAddress(), kTestPort); 130 IPEndPoint client_address(TestPeerIPAddress(), kTestPort);
131 131
132 EXPECT_CALL(*connection_, ProcessUdpPacket(server_address, client_address, _)) 132 EXPECT_CALL(*connection_, ProcessUdpPacket(server_address, client_address, _))
133 .WillRepeatedly(Invoke(implicit_cast<MockConnection*>(connection_), 133 .WillRepeatedly(Invoke(static_cast<MockConnection*>(connection_),
134 &MockConnection::ReallyProcessUdpPacket)); 134 &MockConnection::ReallyProcessUdpPacket));
135 EXPECT_CALL(*connection_, OnCanWrite()).Times(AnyNumber()); 135 EXPECT_CALL(*connection_, OnCanWrite()).Times(AnyNumber());
136 EXPECT_CALL(*connection_, OnError(_)).Times(1); 136 EXPECT_CALL(*connection_, OnError(_)).Times(1);
137 137
138 // Verify that empty packets don't close the connection. 138 // Verify that empty packets don't close the connection.
139 QuicEncryptedPacket zero_length_packet(nullptr, 0, false); 139 QuicEncryptedPacket zero_length_packet(nullptr, 0, false);
140 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(0); 140 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(0);
141 session_->connection()->ProcessUdpPacket(client_address, server_address, 141 session_->connection()->ProcessUdpPacket(client_address, server_address,
142 zero_length_packet); 142 zero_length_packet);
143 143
(...skipping 16 matching lines...) Expand all
160 session_->connection()->ProcessUdpPacket(client_address, server_address, 160 session_->connection()->ProcessUdpPacket(client_address, server_address,
161 *packet); 161 *packet);
162 } 162 }
163 163
164 // A packet with invalid framing should cause a connection to be closed. 164 // A packet with invalid framing should cause a connection to be closed.
165 TEST_P(ToolsQuicClientSessionTest, InvalidFramedPacketReceived) { 165 TEST_P(ToolsQuicClientSessionTest, InvalidFramedPacketReceived) {
166 IPEndPoint server_address(TestPeerIPAddress(), kTestPort); 166 IPEndPoint server_address(TestPeerIPAddress(), kTestPort);
167 IPEndPoint client_address(TestPeerIPAddress(), kTestPort); 167 IPEndPoint client_address(TestPeerIPAddress(), kTestPort);
168 168
169 EXPECT_CALL(*connection_, ProcessUdpPacket(server_address, client_address, _)) 169 EXPECT_CALL(*connection_, ProcessUdpPacket(server_address, client_address, _))
170 .WillRepeatedly(Invoke(implicit_cast<MockConnection*>(connection_), 170 .WillRepeatedly(Invoke(static_cast<MockConnection*>(connection_),
171 &MockConnection::ReallyProcessUdpPacket)); 171 &MockConnection::ReallyProcessUdpPacket));
172 EXPECT_CALL(*connection_, OnError(_)).Times(1); 172 EXPECT_CALL(*connection_, OnError(_)).Times(1);
173 173
174 // Verify that a decryptable packet with bad frames does close the connection. 174 // Verify that a decryptable packet with bad frames does close the connection.
175 QuicConnectionId connection_id = session_->connection()->connection_id(); 175 QuicConnectionId connection_id = session_->connection()->connection_id();
176 scoped_ptr<QuicEncryptedPacket> packet(ConstructMisFramedEncryptedPacket( 176 scoped_ptr<QuicEncryptedPacket> packet(ConstructMisFramedEncryptedPacket(
177 connection_id, false, false, 100, "data", PACKET_8BYTE_CONNECTION_ID, 177 connection_id, false, false, 100, "data", PACKET_8BYTE_CONNECTION_ID,
178 PACKET_6BYTE_PACKET_NUMBER, nullptr)); 178 PACKET_6BYTE_PACKET_NUMBER, nullptr));
179 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); 179 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1);
180 session_->connection()->ProcessUdpPacket(client_address, server_address, 180 session_->connection()->ProcessUdpPacket(client_address, server_address,
181 *packet); 181 *packet);
182 } 182 }
183 183
184 } // namespace 184 } // namespace
185 } // namespace test 185 } // namespace test
186 } // namespace tools 186 } // namespace tools
187 } // namespace net 187 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/flip_server/url_utilities_unittest.cc ('k') | ui/base/page_transition_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698