blob: 30464dead7777910b5b72995a9c6338d46927420 [file] [log] [blame]
kjellander@webrtc.org5b97b122011-12-08 07:42:18 +00001/*
kjellander@webrtc.orgcf6a2952012-02-09 09:01:51 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
kjellander@webrtc.org5b97b122011-12-08 07:42:18 +00003 *
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 */
kjellander@webrtc.org35a17562011-10-06 06:44:54 +000010
kjellander@webrtc.org5b97b122011-12-08 07:42:18 +000011#ifndef WEBRTC_TEST_TESTSUPPORT_UNITTEST_UTILS_H_
12#define WEBRTC_TEST_TESTSUPPORT_UNITTEST_UTILS_H_
kjellander@webrtc.org35a17562011-10-06 06:44:54 +000013
14namespace webrtc {
15namespace test {
16
17const int kPacketSizeInBytes = 1500;
18const int kPacketDataLength = kPacketSizeInBytes * 2 + 1;
19const int kPacketDataNumberOfPackets = 3;
20
21// A base test fixture for packet related tests. Contains
22// two full prepared packets with 1s, 2s in their data and a third packet with
23// a single 3 in it (size=1).
24// A packet data structure is also available, that contains these three packets
25// in order.
26class PacketRelatedTest: public testing::Test {
27 protected:
28 // Tree packet byte arrays with data used for verification:
29 WebRtc_UWord8 packet1_[kPacketSizeInBytes];
30 WebRtc_UWord8 packet2_[kPacketSizeInBytes];
31 WebRtc_UWord8 packet3_[1];
32 // Construct a data structure containing these packets
33 WebRtc_UWord8 packet_data_[kPacketDataLength];
34 WebRtc_UWord8* packet_data_pointer_;
35
36 PacketRelatedTest() {
37 packet_data_pointer_ = packet_data_;
38
39 memset(packet1_, 1, kPacketSizeInBytes);
40 memset(packet2_, 2, kPacketSizeInBytes);
41 memset(packet3_, 3, 1);
42 // Fill the packet_data:
43 memcpy(packet_data_pointer_, packet1_, kPacketSizeInBytes);
44 memcpy(packet_data_pointer_ + kPacketSizeInBytes, packet2_,
45 kPacketSizeInBytes);
46 memcpy(packet_data_pointer_ + kPacketSizeInBytes * 2, packet3_, 1);
47 }
kjellander@webrtc.org5b97b122011-12-08 07:42:18 +000048 virtual ~PacketRelatedTest() {}
kjellander@webrtc.orgcf6a2952012-02-09 09:01:51 +000049 void SetUp() {}
kjellander@webrtc.org5b97b122011-12-08 07:42:18 +000050 void TearDown() {}
kjellander@webrtc.org35a17562011-10-06 06:44:54 +000051};
52
53} // namespace test
54} // namespace webrtc
55
kjellander@webrtc.org5b97b122011-12-08 07:42:18 +000056#endif // WEBRTC_TEST_TESTSUPPORT_UNITTEST_UTILS_H_