We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / net / tools / quic / quic_simple_server_test.cc
blobddb6318a223d9fe420adfc61f8a56cb23ea4e1bb
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
3 // found in the LICENSE file.
5 #include "net/tools/quic/quic_simple_server.h"
7 #include "net/quic/crypto/quic_random.h"
8 #include "net/quic/quic_utils.h"
9 #include "net/quic/test_tools/mock_quic_dispatcher.h"
10 #include "net/quic/test_tools/quic_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using ::testing::_;
15 namespace net {
16 namespace tools {
17 namespace test {
19 // TODO(dmz) Remove "Chrome" part of name once net/tools/quic is deleted.
20 class QuicChromeServerDispatchPacketTest : public ::testing::Test {
21 public:
22 QuicChromeServerDispatchPacketTest()
23 : crypto_config_("blah", QuicRandom::GetInstance()),
24 dispatcher_(config_,
25 &crypto_config_,
26 new tools::QuicDispatcher::DefaultPacketWriterFactory(),
27 new net::test::MockHelper) {
28 dispatcher_.InitializeWithWriter(nullptr);
31 void DispatchPacket(const QuicEncryptedPacket& packet) {
32 IPEndPoint client_addr, server_addr;
33 dispatcher_.ProcessPacket(server_addr, client_addr, packet);
36 protected:
37 QuicConfig config_;
38 QuicCryptoServerConfig crypto_config_;
39 net::test::MockQuicDispatcher dispatcher_;
42 TEST_F(QuicChromeServerDispatchPacketTest, DispatchPacket) {
43 unsigned char valid_packet[] = {
44 // public flags (8 byte connection_id)
45 0x3C,
46 // connection_id
47 0x10, 0x32, 0x54, 0x76,
48 0x98, 0xBA, 0xDC, 0xFE,
49 // packet sequence number
50 0xBC, 0x9A, 0x78, 0x56,
51 0x34, 0x12,
52 // private flags
53 0x00 };
54 QuicEncryptedPacket encrypted_valid_packet(QuicUtils::AsChars(valid_packet),
55 arraysize(valid_packet), false);
57 EXPECT_CALL(dispatcher_, ProcessPacket(_, _, _)).Times(1);
58 DispatchPacket(encrypted_valid_packet);
61 } // namespace tools
62 } // namespace test
63 } // namespace net