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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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_server_session_test.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/tools/quic/quic_server.h"
6
7 #include "net/quic/crypto/quic_random.h"
8 #include "net/quic/quic_utils.h"
9 #include "net/tools/quic/test_tools/mock_quic_dispatcher.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 using ::testing::_;
13
14 namespace net {
15 namespace tools {
16 namespace test {
17
18 namespace {
19
20 class QuicServerDispatchPacketTest : public ::testing::Test {
21 public:
22 QuicServerDispatchPacketTest()
23 : crypto_config_("blah", QuicRandom::GetInstance()),
24 dispatcher_(config_,
25 crypto_config_,
26 new QuicDispatcher::DefaultPacketWriterFactory(),
27 &eps_) {
28 dispatcher_.Initialize(1234);
29 }
30
31 void DispatchPacket(const QuicEncryptedPacket& packet) {
32 IPEndPoint client_addr, server_addr;
33 dispatcher_.ProcessPacket(server_addr, client_addr, packet);
34 }
35
36 protected:
37 QuicConfig config_;
38 QuicCryptoServerConfig crypto_config_;
39 EpollServer eps_;
40 MockQuicDispatcher dispatcher_;
41 };
42
43 TEST_F(QuicServerDispatchPacketTest, DispatchPacket) {
44 unsigned char valid_packet[] = {
45 // public flags (8 byte connection_id)
46 0x3C,
47 // connection_id
48 0x10, 0x32, 0x54, 0x76,
49 0x98, 0xBA, 0xDC, 0xFE,
50 // packet sequence number
51 0xBC, 0x9A, 0x78, 0x56,
52 0x34, 0x12,
53 // private flags
54 0x00 };
55 QuicEncryptedPacket encrypted_valid_packet(QuicUtils::AsChars(valid_packet),
56 arraysize(valid_packet), false);
57
58 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1);
59 DispatchPacket(encrypted_valid_packet);
60 }
61
62 } // namespace
63 } // namespace test
64 } // namespace tools
65 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_session_test.cc ('k') | net/tools/quic/quic_socket_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698