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

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

Issue 2848203002: Add a platform implementation of QuicTest and QuicTestWithParam (Closed)
Patch Set: net/quic/platform/impl/quic_test_impl.cc Created 3 years, 7 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/quic/quic_client_test.cc ('k') | net/tools/quic/quic_epoll_alarm_factory_test.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_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "net/quic/core/crypto/crypto_handshake.h" 12 #include "net/quic/core/crypto/crypto_handshake.h"
13 #include "net/quic/core/crypto/quic_crypto_server_config.h" 13 #include "net/quic/core/crypto/quic_crypto_server_config.h"
14 #include "net/quic/core/crypto/quic_random.h" 14 #include "net/quic/core/crypto/quic_random.h"
15 #include "net/quic/core/quic_crypto_stream.h" 15 #include "net/quic/core/quic_crypto_stream.h"
16 #include "net/quic/core/quic_utils.h" 16 #include "net/quic/core/quic_utils.h"
17 #include "net/quic/platform/api/quic_flags.h" 17 #include "net/quic/platform/api/quic_flags.h"
18 #include "net/quic/platform/api/quic_logging.h" 18 #include "net/quic/platform/api/quic_logging.h"
19 #include "net/quic/platform/api/quic_str_cat.h" 19 #include "net/quic/platform/api/quic_str_cat.h"
20 #include "net/quic/platform/api/quic_test.h"
20 #include "net/quic/test_tools/crypto_test_utils.h" 21 #include "net/quic/test_tools/crypto_test_utils.h"
21 #include "net/quic/test_tools/fake_proof_source.h" 22 #include "net/quic/test_tools/fake_proof_source.h"
22 #include "net/quic/test_tools/quic_buffered_packet_store_peer.h" 23 #include "net/quic/test_tools/quic_buffered_packet_store_peer.h"
23 #include "net/quic/test_tools/quic_crypto_server_config_peer.h" 24 #include "net/quic/test_tools/quic_crypto_server_config_peer.h"
24 #include "net/quic/test_tools/quic_test_utils.h" 25 #include "net/quic/test_tools/quic_test_utils.h"
25 #include "net/quic/test_tools/quic_time_wait_list_manager_peer.h" 26 #include "net/quic/test_tools/quic_time_wait_list_manager_peer.h"
26 #include "net/test/gtest_util.h" 27 #include "net/test/gtest_util.h"
27 #include "net/tools/epoll_server/epoll_server.h" 28 #include "net/tools/epoll_server/epoll_server.h"
28 #include "net/tools/quic/chlo_extractor.h" 29 #include "net/tools/quic/chlo_extractor.h"
29 #include "net/tools/quic/quic_epoll_alarm_factory.h" 30 #include "net/tools/quic/quic_epoll_alarm_factory.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void UnregisterOnConnectionClosed() { 160 void UnregisterOnConnectionClosed() {
160 QUIC_LOG(ERROR) << "Unregistering " << connection_id(); 161 QUIC_LOG(ERROR) << "Unregistering " << connection_id();
161 dispatcher_->OnConnectionClosed(connection_id(), QUIC_NO_ERROR, 162 dispatcher_->OnConnectionClosed(connection_id(), QUIC_NO_ERROR,
162 "Unregistering."); 163 "Unregistering.");
163 } 164 }
164 165
165 private: 166 private:
166 QuicDispatcher* dispatcher_; 167 QuicDispatcher* dispatcher_;
167 }; 168 };
168 169
169 class QuicDispatcherTest : public ::testing::Test { 170 class QuicDispatcherTest : public QuicTest {
170 public: 171 public:
171 QuicDispatcherTest() 172 QuicDispatcherTest()
172 : QuicDispatcherTest(crypto_test_utils::ProofSourceForTesting()) {} 173 : QuicDispatcherTest(crypto_test_utils::ProofSourceForTesting()) {}
173 174
174 explicit QuicDispatcherTest(std::unique_ptr<ProofSource> proof_source) 175 explicit QuicDispatcherTest(std::unique_ptr<ProofSource> proof_source)
175 : helper_(&eps_, QuicAllocator::BUFFER_POOL), 176 : helper_(&eps_, QuicAllocator::BUFFER_POOL),
176 alarm_factory_(&eps_), 177 alarm_factory_(&eps_),
177 version_manager_(AllSupportedVersions()), 178 version_manager_(AllSupportedVersions()),
178 crypto_config_(QuicCryptoServerConfig::TESTING, 179 crypto_config_(QuicCryptoServerConfig::TESTING,
179 QuicRandom::GetInstance(), 180 QuicRandom::GetInstance(),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 314 }
314 315
315 string SerializeCHLO() { 316 string SerializeCHLO() {
316 CryptoHandshakeMessage client_hello; 317 CryptoHandshakeMessage client_hello;
317 client_hello.set_tag(kCHLO); 318 client_hello.set_tag(kCHLO);
318 return client_hello.GetSerialized(Perspective::IS_CLIENT) 319 return client_hello.GetSerialized(Perspective::IS_CLIENT)
319 .AsStringPiece() 320 .AsStringPiece()
320 .as_string(); 321 .as_string();
321 } 322 }
322 323
323 QuicFlagSaver flags_; // Save/restore all QUIC flag values.
324 EpollServer eps_; 324 EpollServer eps_;
325 QuicEpollConnectionHelper helper_; 325 QuicEpollConnectionHelper helper_;
326 MockQuicConnectionHelper mock_helper_; 326 MockQuicConnectionHelper mock_helper_;
327 QuicEpollAlarmFactory alarm_factory_; 327 QuicEpollAlarmFactory alarm_factory_;
328 MockAlarmFactory mock_alarm_factory_; 328 MockAlarmFactory mock_alarm_factory_;
329 QuicConfig config_; 329 QuicConfig config_;
330 QuicVersionManager version_manager_; 330 QuicVersionManager version_manager_;
331 QuicCryptoServerConfig crypto_config_; 331 QuicCryptoServerConfig crypto_config_;
332 QuicSocketAddress server_address_; 332 QuicSocketAddress server_address_;
333 std::unique_ptr<TestDispatcher> dispatcher_; 333 std::unique_ptr<TestDispatcher> dispatcher_;
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 check.Call(2); 2037 check.Call(2);
2038 GetFakeProofSource()->InvokePendingCallback(0); 2038 GetFakeProofSource()->InvokePendingCallback(0);
2039 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); 2039 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0);
2040 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); 2040 EXPECT_FALSE(store->HasBufferedPackets(conn_id));
2041 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); 2041 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id));
2042 } 2042 }
2043 2043
2044 } // namespace 2044 } // namespace
2045 } // namespace test 2045 } // namespace test
2046 } // namespace net 2046 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_test.cc ('k') | net/tools/quic/quic_epoll_alarm_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698