Added a bit flip fuzz test to the voice engine.
Extracted encryption classes to a new test library. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/564009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2256 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
47b4041e92
commit
1ad477de3e
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "video_engine/test/libvietest/include/bit_flip_encryption.h"
|
#include "test/libtest/include/bit_flip_encryption.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "video_engine/test/libvietest/include/random_encryption.h"
|
#include "test/libtest/include/random_encryption.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
@ -11,7 +11,7 @@
|
|||||||
#ifndef SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_
|
#ifndef SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_
|
||||||
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_
|
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_BIT_FLIP_ENCRYPTION_H_
|
||||||
|
|
||||||
#include "video_engine/include/vie_encryption.h"
|
#include "common_types.h"
|
||||||
|
|
||||||
// This encryption scheme will randomly flip bits every now and then in the
|
// This encryption scheme will randomly flip bits every now and then in the
|
||||||
// input data.
|
// input data.
|
@ -11,7 +11,7 @@
|
|||||||
#ifndef SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_
|
#ifndef SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_
|
||||||
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_
|
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_HELPERS_RANDOM_ENCRYPTION_H_
|
||||||
|
|
||||||
#include "video_engine/include/vie_encryption.h"
|
#include "common_types.h"
|
||||||
|
|
||||||
// These algorithms attempt to create an uncrackable encryption
|
// These algorithms attempt to create an uncrackable encryption
|
||||||
// scheme by completely disregarding the input data.
|
// scheme by completely disregarding the input data.
|
26
src/test/libtest/libtest.gyp
Normal file
26
src/test/libtest/libtest.gyp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
{
|
||||||
|
'includes': [
|
||||||
|
'../../build/common.gypi'
|
||||||
|
],
|
||||||
|
'targets': [
|
||||||
|
{
|
||||||
|
'target_name': 'libtest',
|
||||||
|
'type': '<(library)',
|
||||||
|
'sources': [
|
||||||
|
# Helper classes
|
||||||
|
'include/bit_flip_encryption.h',
|
||||||
|
'include/random_encryption.h',
|
||||||
|
|
||||||
|
'helpers/bit_flip_encryption.cc',
|
||||||
|
'helpers/random_encryption.cc',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
@ -12,12 +12,12 @@
|
|||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "gflags/gflags.h"
|
#include "gflags/gflags.h"
|
||||||
|
#include "test/libtest/include/bit_flip_encryption.h"
|
||||||
|
#include "test/libtest/include/random_encryption.h"
|
||||||
#include "video_engine/test/auto_test/automated/two_windows_fixture.h"
|
#include "video_engine/test/auto_test/automated/two_windows_fixture.h"
|
||||||
#include "video_engine/test/auto_test/interface/vie_window_creator.h"
|
#include "video_engine/test/auto_test/interface/vie_window_creator.h"
|
||||||
#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h"
|
#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h"
|
||||||
#include "video_engine/test/auto_test/primitives/general_primitives.h"
|
#include "video_engine/test/auto_test/primitives/general_primitives.h"
|
||||||
#include "video_engine/test/libvietest/include/bit_flip_encryption.h"
|
|
||||||
#include "video_engine/test/libvietest/include/random_encryption.h"
|
|
||||||
#include "video_engine/test/libvietest/include/tb_capture_device.h"
|
#include "video_engine/test/libvietest/include/tb_capture_device.h"
|
||||||
#include "video_engine/test/libvietest/include/tb_interfaces.h"
|
#include "video_engine/test/libvietest/include/tb_interfaces.h"
|
||||||
#include "video_engine/test/libvietest/include/tb_video_channel.h"
|
#include "video_engine/test/libvietest/include/tb_video_channel.h"
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
'<(webrtc_root)/../third_party/google-gflags/google-gflags.gyp:google-gflags',
|
'<(webrtc_root)/../third_party/google-gflags/google-gflags.gyp:google-gflags',
|
||||||
'<(webrtc_root)/../test/metrics.gyp:metrics',
|
'<(webrtc_root)/../test/metrics.gyp:metrics',
|
||||||
'<(webrtc_root)/../test/test.gyp:test_support',
|
'<(webrtc_root)/../test/test.gyp:test_support',
|
||||||
|
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
|
||||||
'video_engine_core',
|
'video_engine_core',
|
||||||
'libvietest',
|
'libvietest',
|
||||||
],
|
],
|
||||||
|
@ -27,14 +27,10 @@
|
|||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
# Helper classes
|
# Helper classes
|
||||||
'include/bit_flip_encryption.h',
|
|
||||||
'include/random_encryption.h',
|
|
||||||
'include/vie_fake_camera.h',
|
'include/vie_fake_camera.h',
|
||||||
'include/vie_file_capture_device.h',
|
'include/vie_file_capture_device.h',
|
||||||
'include/vie_to_file_renderer.h',
|
'include/vie_to_file_renderer.h',
|
||||||
|
|
||||||
'helpers/bit_flip_encryption.cc',
|
|
||||||
'helpers/random_encryption.cc',
|
|
||||||
'helpers/vie_fake_camera.cc',
|
'helpers/vie_fake_camera.cc',
|
||||||
'helpers/vie_file_capture_device.cc',
|
'helpers/vie_file_capture_device.cc',
|
||||||
'helpers/vie_to_file_renderer.cc',
|
'helpers/vie_to_file_renderer.cc',
|
||||||
|
48
src/voice_engine/main/test/auto_test/fuzz/rtp_fuzz_test.cc
Normal file
48
src/voice_engine/main/test/auto_test/fuzz/rtp_fuzz_test.cc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
#include "test/libtest/include/bit_flip_encryption.h"
|
||||||
|
#include "voice_engine/main/test/auto_test/fixtures/after_streaming_fixture.h"
|
||||||
|
|
||||||
|
class RtpFuzzTest : public AfterStreamingFixture {
|
||||||
|
protected:
|
||||||
|
void BitFlipFuzzTest(float flip_probability) {
|
||||||
|
BitFlipEncryption bit_flip_encryption(std::time(NULL), flip_probability);
|
||||||
|
|
||||||
|
TEST_LOG("Starting to flip bits in RTP/RTCP packets.\n");
|
||||||
|
voe_encrypt_->RegisterExternalEncryption(channel_, bit_flip_encryption);
|
||||||
|
|
||||||
|
Sleep(5000);
|
||||||
|
|
||||||
|
voe_encrypt_->DeRegisterExternalEncryption(channel_);
|
||||||
|
|
||||||
|
TEST_LOG("Flipped %d bits. Back to normal.\n",
|
||||||
|
static_cast<int>(bit_flip_encryption.flip_count()));
|
||||||
|
Sleep(2000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(RtpFuzzTest, VoiceEngineDealsWithASmallNumberOfTamperedRtpPackets) {
|
||||||
|
BitFlipFuzzTest(0.00005f);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpFuzzTest, VoiceEngineDealsWithAMediumNumberOfTamperedRtpPackets) {
|
||||||
|
BitFlipFuzzTest(0.0005f);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpFuzzTest, VoiceEngineDealsWithALargeNumberOfTamperedRtpPackets) {
|
||||||
|
BitFlipFuzzTest(0.05f);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(RtpFuzzTest, VoiceEngineDealsWithAHugeNumberOfTamperedRtpPackets) {
|
||||||
|
BitFlipFuzzTest(0.5f);
|
||||||
|
}
|
@ -18,6 +18,7 @@
|
|||||||
'<(webrtc_root)/../test/test.gyp:test_support',
|
'<(webrtc_root)/../test/test.gyp:test_support',
|
||||||
'<(webrtc_root)/../testing/gtest.gyp:gtest',
|
'<(webrtc_root)/../testing/gtest.gyp:gtest',
|
||||||
'<(webrtc_root)/../testing/gmock.gyp:gmock',
|
'<(webrtc_root)/../testing/gmock.gyp:gmock',
|
||||||
|
'<(webrtc_root)/test/libtest/libtest.gyp:libtest',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'auto_test',
|
'auto_test',
|
||||||
@ -38,6 +39,7 @@
|
|||||||
'auto_test/fixtures/after_streaming_fixture.h',
|
'auto_test/fixtures/after_streaming_fixture.h',
|
||||||
'auto_test/fixtures/before_initialization_fixture.cc',
|
'auto_test/fixtures/before_initialization_fixture.cc',
|
||||||
'auto_test/fixtures/before_initialization_fixture.h',
|
'auto_test/fixtures/before_initialization_fixture.h',
|
||||||
|
'auto_test/fuzz/rtp_fuzz_test.cc',
|
||||||
'auto_test/standard/audio_processing_test.cc',
|
'auto_test/standard/audio_processing_test.cc',
|
||||||
'auto_test/standard/call_report_test.cc',
|
'auto_test/standard/call_report_test.cc',
|
||||||
'auto_test/standard/codec_before_streaming_test.cc',
|
'auto_test/standard/codec_before_streaming_test.cc',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user