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

Side by Side Diff: net/quic/quic_server_test.cc

Issue 475113005: Refactoring: Create per-connection packet writers in QuicDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add new files to net/BUILD.gn Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_server_session.cc ('k') | net/quic/quic_stream_factory.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quic/quic_server.h" 5 #include "net/quic/quic_server.h"
6 6
7 #include "net/quic/crypto/quic_random.h" 7 #include "net/quic/crypto/quic_random.h"
8 #include "net/quic/quic_utils.h" 8 #include "net/quic/quic_utils.h"
9 #include "net/quic/test_tools/mock_quic_dispatcher.h" 9 #include "net/quic/test_tools/mock_quic_dispatcher.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 using ::testing::_; 13 using ::testing::_;
14 14
15 namespace net { 15 namespace net {
16 namespace test { 16 namespace test {
17 17
18 namespace { 18 namespace {
19 19
20 // TODO(dmz) Remove "Chrome" part of name once net/tools/quic is deleted. 20 // TODO(dmz) Remove "Chrome" part of name once net/tools/quic is deleted.
21 class QuicChromeServerDispatchPacketTest : public ::testing::Test { 21 class QuicChromeServerDispatchPacketTest : public ::testing::Test {
22 public: 22 public:
23 QuicChromeServerDispatchPacketTest() 23 QuicChromeServerDispatchPacketTest()
24 : crypto_config_("blah", QuicRandom::GetInstance()), 24 : crypto_config_("blah", QuicRandom::GetInstance()),
25 dispatcher_(config_, crypto_config_, &helper_) { 25 dispatcher_(config_,
26 crypto_config_,
27 new QuicDispatcher::DefaultPacketWriterFactory(),
28 &helper_) {
26 dispatcher_.Initialize(NULL); 29 dispatcher_.Initialize(NULL);
27 } 30 }
28 31
29 void DispatchPacket(const QuicEncryptedPacket& packet) { 32 void DispatchPacket(const QuicEncryptedPacket& packet) {
30 IPEndPoint client_addr, server_addr; 33 IPEndPoint client_addr, server_addr;
31 dispatcher_.ProcessPacket(server_addr, client_addr, packet); 34 dispatcher_.ProcessPacket(server_addr, client_addr, packet);
32 } 35 }
33 36
34 protected: 37 protected:
35 QuicConfig config_; 38 QuicConfig config_;
(...skipping 17 matching lines...) Expand all
53 QuicEncryptedPacket encrypted_valid_packet(QuicUtils::AsChars(valid_packet), 56 QuicEncryptedPacket encrypted_valid_packet(QuicUtils::AsChars(valid_packet),
54 arraysize(valid_packet), false); 57 arraysize(valid_packet), false);
55 58
56 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1); 59 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1);
57 DispatchPacket(encrypted_valid_packet); 60 DispatchPacket(encrypted_valid_packet);
58 } 61 }
59 62
60 } // namespace 63 } // namespace
61 } // namespace test 64 } // namespace test
62 } // namespace net 65 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_server_session.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698