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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 class QuicDispatcherTest : public ::testing::Test { | 103 class QuicDispatcherTest : public ::testing::Test { |
104 public: | 104 public: |
105 QuicDispatcherTest() | 105 QuicDispatcherTest() |
106 : crypto_config_(QuicCryptoServerConfig::TESTING), | 106 : crypto_config_(QuicCryptoServerConfig::TESTING), |
107 dispatcher_(config_, crypto_config_, &eps_), | 107 dispatcher_(config_, crypto_config_, &eps_), |
108 session1_(NULL), | 108 session1_(NULL), |
109 session2_(NULL) { | 109 session2_(NULL) { |
110 } | 110 } |
111 | 111 |
112 ~QuicDispatcherTest() { | 112 virtual ~QuicDispatcherTest() {} |
113 } | |
114 | 113 |
115 MockConnection* connection1() { | 114 MockConnection* connection1() { |
116 return reinterpret_cast<MockConnection*>(session1_->connection()); | 115 return reinterpret_cast<MockConnection*>(session1_->connection()); |
117 } | 116 } |
118 | 117 |
119 MockConnection* connection2() { | 118 MockConnection* connection2() { |
120 return reinterpret_cast<MockConnection*>(session2_->connection()); | 119 return reinterpret_cast<MockConnection*>(session2_->connection()); |
121 } | 120 } |
122 | 121 |
123 void ProcessPacket(IPEndPoint addr, | 122 void ProcessPacket(IPEndPoint addr, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 EXPECT_TRUE(time_wait_list_manager->IsGuidInTimeWait(guid)); | 230 EXPECT_TRUE(time_wait_list_manager->IsGuidInTimeWait(guid)); |
232 | 231 |
233 // Dispatcher forwards subsequent packets for this guid to the time wait list | 232 // Dispatcher forwards subsequent packets for this guid to the time wait list |
234 // manager. | 233 // manager. |
235 EXPECT_CALL(*time_wait_list_manager, ProcessPacket(_, _, guid, _)).Times(1); | 234 EXPECT_CALL(*time_wait_list_manager, ProcessPacket(_, _, guid, _)).Times(1); |
236 ProcessPacket(addr, guid, "foo"); | 235 ProcessPacket(addr, guid, "foo"); |
237 } | 236 } |
238 | 237 |
239 class WriteBlockedListTest : public QuicDispatcherTest { | 238 class WriteBlockedListTest : public QuicDispatcherTest { |
240 public: | 239 public: |
241 void SetUp() { | 240 virtual void SetUp() { |
242 IPEndPoint addr(Loopback4(), 1); | 241 IPEndPoint addr(Loopback4(), 1); |
243 | 242 |
244 EXPECT_CALL(dispatcher_, CreateQuicSession(_, addr, _, &eps_)) | 243 EXPECT_CALL(dispatcher_, CreateQuicSession(_, addr, _, &eps_)) |
245 .WillOnce(testing::Return(CreateSession( | 244 .WillOnce(testing::Return(CreateSession( |
246 &dispatcher_, 1, addr, &session1_, &eps_))); | 245 &dispatcher_, 1, addr, &session1_, &eps_))); |
247 ProcessPacket(addr, 1, "foo"); | 246 ProcessPacket(addr, 1, "foo"); |
248 | 247 |
249 EXPECT_CALL(dispatcher_, CreateQuicSession(_, addr, _, &eps_)) | 248 EXPECT_CALL(dispatcher_, CreateQuicSession(_, addr, _, &eps_)) |
250 .WillOnce(testing::Return(CreateSession( | 249 .WillOnce(testing::Return(CreateSession( |
251 &dispatcher_, 2, addr, &session2_, &eps_))); | 250 &dispatcher_, 2, addr, &session2_, &eps_))); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // And we'll resume where we left off when we get another call. | 379 // And we'll resume where we left off when we get another call. |
381 EXPECT_CALL(*connection2(), OnCanWrite()); | 380 EXPECT_CALL(*connection2(), OnCanWrite()); |
382 dispatcher_.OnCanWrite(); | 381 dispatcher_.OnCanWrite(); |
383 } | 382 } |
384 | 383 |
385 | 384 |
386 } // namespace | 385 } // namespace |
387 } // namespace test | 386 } // namespace test |
388 } // namespace tools | 387 } // namespace tools |
389 } // namespace net | 388 } // namespace net |
OLD | NEW |