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 "net/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return reinterpret_cast<MockConnection*>(session2_->connection()); | 117 return reinterpret_cast<MockConnection*>(session2_->connection()); |
118 } | 118 } |
119 | 119 |
120 void ProcessPacket(IPEndPoint client_address, | 120 void ProcessPacket(IPEndPoint client_address, |
121 QuicConnectionId connection_id, | 121 QuicConnectionId connection_id, |
122 bool has_version_flag, | 122 bool has_version_flag, |
123 const string& data) { | 123 const string& data) { |
124 scoped_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( | 124 scoped_ptr<QuicEncryptedPacket> packet(ConstructEncryptedPacket( |
125 connection_id, has_version_flag, false, 1, data)); | 125 connection_id, has_version_flag, false, 1, data)); |
126 data_ = string(packet->data(), packet->length()); | 126 data_ = string(packet->data(), packet->length()); |
127 dispatcher_.ProcessPacket(server_address_, client_address, *packet.get()); | 127 dispatcher_.ProcessPacket(server_address_, client_address, *packet); |
128 } | 128 } |
129 | 129 |
130 void ValidatePacket(const QuicEncryptedPacket& packet) { | 130 void ValidatePacket(const QuicEncryptedPacket& packet) { |
131 EXPECT_EQ(data_.length(), packet.AsStringPiece().length()); | 131 EXPECT_EQ(data_.length(), packet.AsStringPiece().length()); |
132 EXPECT_EQ(data_, packet.AsStringPiece()); | 132 EXPECT_EQ(data_, packet.AsStringPiece()); |
133 } | 133 } |
134 | 134 |
135 EpollServer eps_; | 135 EpollServer eps_; |
136 QuicConfig config_; | 136 QuicConfig config_; |
137 QuicCryptoServerConfig crypto_config_; | 137 QuicCryptoServerConfig crypto_config_; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // And we'll resume where we left off when we get another call. | 494 // And we'll resume where we left off when we get another call. |
495 EXPECT_CALL(*connection2(), OnCanWrite()); | 495 EXPECT_CALL(*connection2(), OnCanWrite()); |
496 dispatcher_.OnCanWrite(); | 496 dispatcher_.OnCanWrite(); |
497 EXPECT_FALSE(dispatcher_.HasPendingWrites()); | 497 EXPECT_FALSE(dispatcher_.HasPendingWrites()); |
498 } | 498 } |
499 | 499 |
500 } // namespace | 500 } // namespace |
501 } // namespace test | 501 } // namespace test |
502 } // namespace tools | 502 } // namespace tools |
503 } // namespace net | 503 } // namespace net |
OLD | NEW |