• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 #include "net/dcsctp/packet/chunk/shutdown_ack_chunk.h"
11 
12 #include <stdint.h>
13 
14 #include <vector>
15 
16 #include "rtc_base/gunit.h"
17 #include "test/gmock.h"
18 
19 namespace dcsctp {
20 namespace {
21 
TEST(ShutdownAckChunkTest,FromCapture)22 TEST(ShutdownAckChunkTest, FromCapture) {
23   /*
24   SHUTDOWN_ACK chunk
25       Chunk type: SHUTDOWN_ACK (8)
26       Chunk flags: 0x00
27       Chunk length: 4
28   */
29 
30   uint8_t data[] = {0x08, 0x00, 0x00, 0x04};
31 
32   EXPECT_TRUE(ShutdownAckChunk::Parse(data).has_value());
33 }
34 
TEST(ShutdownAckChunkTest,SerializeAndDeserialize)35 TEST(ShutdownAckChunkTest, SerializeAndDeserialize) {
36   ShutdownAckChunk chunk;
37 
38   std::vector<uint8_t> serialized;
39   chunk.SerializeTo(serialized);
40 
41   EXPECT_TRUE(ShutdownAckChunk::Parse(serialized).has_value());
42 }
43 
44 }  // namespace
45 }  // namespace dcsctp
46