2011-12-08 07:42:18 +00:00
|
|
|
/*
|
2012-02-09 09:01:51 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-12-08 07:42:18 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_TEST_TESTSUPPORT_UNITTEST_UTILS_H_
|
|
|
|
|
#define WEBRTC_TEST_TESTSUPPORT_UNITTEST_UTILS_H_
|
2011-10-06 06:44:54 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
const size_t kPacketSizeInBytes = 1500;
|
|
|
|
|
const size_t kPacketDataLength = kPacketSizeInBytes * 2 + 1;
|
2011-10-06 06:44:54 +00:00
|
|
|
const int kPacketDataNumberOfPackets = 3;
|
|
|
|
|
|
|
|
|
|
// A base test fixture for packet related tests. Contains
|
|
|
|
|
// two full prepared packets with 1s, 2s in their data and a third packet with
|
|
|
|
|
// a single 3 in it (size=1).
|
|
|
|
|
// A packet data structure is also available, that contains these three packets
|
|
|
|
|
// in order.
|
|
|
|
|
class PacketRelatedTest: public testing::Test {
|
|
|
|
|
protected:
|
|
|
|
|
// Tree packet byte arrays with data used for verification:
|
2013-04-09 11:10:21 +00:00
|
|
|
uint8_t packet1_[kPacketSizeInBytes];
|
|
|
|
|
uint8_t packet2_[kPacketSizeInBytes];
|
|
|
|
|
uint8_t packet3_[1];
|
2011-10-06 06:44:54 +00:00
|
|
|
// Construct a data structure containing these packets
|
2013-04-09 11:10:21 +00:00
|
|
|
uint8_t packet_data_[kPacketDataLength];
|
|
|
|
|
uint8_t* packet_data_pointer_;
|
2011-10-06 06:44:54 +00:00
|
|
|
|
|
|
|
|
PacketRelatedTest() {
|
|
|
|
|
packet_data_pointer_ = packet_data_;
|
|
|
|
|
|
|
|
|
|
memset(packet1_, 1, kPacketSizeInBytes);
|
|
|
|
|
memset(packet2_, 2, kPacketSizeInBytes);
|
|
|
|
|
memset(packet3_, 3, 1);
|
|
|
|
|
// Fill the packet_data:
|
|
|
|
|
memcpy(packet_data_pointer_, packet1_, kPacketSizeInBytes);
|
|
|
|
|
memcpy(packet_data_pointer_ + kPacketSizeInBytes, packet2_,
|
|
|
|
|
kPacketSizeInBytes);
|
|
|
|
|
memcpy(packet_data_pointer_ + kPacketSizeInBytes * 2, packet3_, 1);
|
|
|
|
|
}
|
2011-12-08 07:42:18 +00:00
|
|
|
virtual ~PacketRelatedTest() {}
|
2012-02-09 09:01:51 +00:00
|
|
|
void SetUp() {}
|
2011-12-08 07:42:18 +00:00
|
|
|
void TearDown() {}
|
2011-10-06 06:44:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2011-12-08 07:42:18 +00:00
|
|
|
#endif // WEBRTC_TEST_TESTSUPPORT_UNITTEST_UTILS_H_
|