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_complete_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(ShutdownCompleteChunkTest,FromCapture)22TEST(ShutdownCompleteChunkTest, FromCapture) { 23 /* 24 SHUTDOWN_COMPLETE chunk 25 Chunk type: SHUTDOWN_COMPLETE (14) 26 Chunk flags: 0x00 27 Chunk length: 4 28 */ 29 30 uint8_t data[] = {0x0e, 0x00, 0x00, 0x04}; 31 32 EXPECT_TRUE(ShutdownCompleteChunk::Parse(data).has_value()); 33 } 34 TEST(ShutdownCompleteChunkTest,SerializeAndDeserialize)35TEST(ShutdownCompleteChunkTest, SerializeAndDeserialize) { 36 ShutdownCompleteChunk chunk(/*tag_reflected=*/false); 37 38 std::vector<uint8_t> serialized; 39 chunk.SerializeTo(serialized); 40 41 EXPECT_TRUE(ShutdownCompleteChunk::Parse(serialized).has_value()); 42 } 43 44 } // namespace 45 } // namespace dcsctp 46