diff --git a/src/common_types.h b/src/common_types.h index 33fcf1a02e..9b3a0ceee4 100644 --- a/src/common_types.h +++ b/src/common_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -149,32 +149,61 @@ enum SecurityLevels kEncryptionAndAuthentication = 3 }; +// Interface for encrypting and decrypting regular data and rtp/rtcp packets. +// Implement this interface if you wish to provide an encryption scheme to +// the voice or video engines. class Encryption { public: + // Encrypt the given data. + // + // Args: + // channel: The channel to encrypt data for. + // in_data: The data to encrypt. This data is bytes_in bytes long. + // out_data: The buffer to write the encrypted data to. You may write more + // bytes of encrypted data than what you got as input, up to a maximum + // of webrtc::kViEMaxMtu if you are encrypting in the video engine, or + // webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine. + // bytes_in: The number of bytes in the input buffer. + // bytes_out: The number of bytes written in out_data. virtual void encrypt( - int channel_no, + int channel, unsigned char* in_data, unsigned char* out_data, int bytes_in, int* bytes_out) = 0; + // Decrypts the given data. This should reverse the effects of encrypt(). + // + // Args: + // channel_no: The channel to decrypt data for. + // in_data: The data to decrypt. This data is bytes_in bytes long. + // out_data: The buffer to write the decrypted data to. You may write more + // bytes of decrypted data than what you got as input, up to a maximum + // of webrtc::kViEMaxMtu if you are encrypting in the video engine, or + // webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine. + // bytes_in: The number of bytes in the input buffer. + // bytes_out: The number of bytes written in out_data. virtual void decrypt( - int channel_no, + int channel, unsigned char* in_data, unsigned char* out_data, int bytes_in, int* bytes_out) = 0; + // Encrypts a RTCP packet. Otherwise, this method has the same contract as + // encrypt(). virtual void encrypt_rtcp( - int channel_no, + int channel, unsigned char* in_data, unsigned char* out_data, int bytes_in, int* bytes_out) = 0; + // Decrypts a RTCP packet. Otherwise, this method has the same contract as + // decrypt(). virtual void decrypt_rtcp( - int channel_no, + int channel, unsigned char* in_data, unsigned char* out_data, int bytes_in, @@ -507,10 +536,9 @@ union VideoCodecUnion VideoCodecGeneric Generic; }; -/* -* Simulcast is when the same stream is encoded multiple times with different -* settings such as resolution. -*/ + +// Simulcast is when the same stream is encoded multiple times with different +// settings such as resolution. struct SimulcastStream { unsigned short width; diff --git a/src/video_engine/test/auto_test/automated/legacy_fixture.cc b/src/video_engine/test/auto_test/automated/legacy_fixture.cc new file mode 100644 index 0000000000..591a567199 --- /dev/null +++ b/src/video_engine/test/auto_test/automated/legacy_fixture.cc @@ -0,0 +1,28 @@ +/* + * 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 "video_engine/test/auto_test/automated/legacy_fixture.h" + +#include "video_engine/test/auto_test/interface/vie_autotest.h" + +void LegacyFixture::SetUpTestCase() { + TwoWindowsFixture::SetUpTestCase(); + + // Create the test cases + tests_ = new ViEAutoTest(window_1_, window_2_); +} + +void LegacyFixture::TearDownTestCase() { + delete tests_; + + TwoWindowsFixture::TearDownTestCase(); +} + +ViEAutoTest* LegacyFixture::tests_ = NULL; diff --git a/src/video_engine/test/auto_test/automated/legacy_fixture.h b/src/video_engine/test/auto_test/automated/legacy_fixture.h new file mode 100644 index 0000000000..b4527669fd --- /dev/null +++ b/src/video_engine/test/auto_test/automated/legacy_fixture.h @@ -0,0 +1,29 @@ +/* + * 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. + */ + +#ifndef SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ +#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ + +#include "video_engine/test/auto_test/automated/two_windows_fixture.h" + +// Inherited by old-style standard integration tests based on ViEAutoTest. +class LegacyFixture : public TwoWindowsFixture { + public: + // Initializes ViEAutoTest in addition to the work done by ViEIntegrationTest. + static void SetUpTestCase(); + + // Releases anything allocated by SetupTestCase. + static void TearDownTestCase(); + + protected: + static ViEAutoTest* tests_; +}; + +#endif // SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_ diff --git a/src/video_engine/test/auto_test/automated/two_windows_fixture.cc b/src/video_engine/test/auto_test/automated/two_windows_fixture.cc new file mode 100644 index 0000000000..d181aa517c --- /dev/null +++ b/src/video_engine/test/auto_test/automated/two_windows_fixture.cc @@ -0,0 +1,33 @@ +/* + * 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 "video_engine/test/auto_test/automated/two_windows_fixture.h" + +#include "video_engine/test/auto_test/helpers/vie_window_creator.h" +#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h" + +void TwoWindowsFixture::SetUpTestCase() { + window_creator_ = new ViEWindowCreator(); + + ViEAutoTestWindowManagerInterface* window_manager = + window_creator_->CreateTwoWindows(); + + window_1_ = window_manager->GetWindow1(); + window_2_ = window_manager->GetWindow2(); +} + +void TwoWindowsFixture::TearDownTestCase() { + window_creator_->TerminateWindows(); + delete window_creator_; +} + +ViEWindowCreator* TwoWindowsFixture::window_creator_ = NULL; +void* TwoWindowsFixture::window_1_ = NULL; +void* TwoWindowsFixture::window_2_ = NULL; diff --git a/src/video_engine/test/auto_test/automated/vie_integration_test_base.h b/src/video_engine/test/auto_test/automated/two_windows_fixture.h similarity index 50% rename from src/video_engine/test/auto_test/automated/vie_integration_test_base.h rename to src/video_engine/test/auto_test/automated/two_windows_fixture.h index 8b9612071d..175a42d247 100644 --- a/src/video_engine/test/auto_test/automated/vie_integration_test_base.h +++ b/src/video_engine/test/auto_test/automated/two_windows_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -8,28 +8,28 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_ -#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_ +#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_TWO_WINDOWS_FIXTURE_H_ +#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_TWO_WINDOWS_FIXTURE_H_ #include "gtest/gtest.h" class ViEWindowCreator; class ViEAutoTest; -// Meant to be interited by standard integration tests based on -// ViEAutoTest. -class ViEIntegrationTest: public testing::Test { +// Meant to be inherited by all standard test who require two windows. +class TwoWindowsFixture : public testing::Test { public: - // Intitializes a suitable webcam on the system and launches - // two windows in a platform-dependent manner. + // Launches two windows in a platform-dependent manner and stores the handles + // in the window_1_ and window_2_ fields. static void SetUpTestCase(); // Releases anything allocated by SetupTestCase. static void TearDownTestCase(); protected: + static void* window_1_; + static void* window_2_; static ViEWindowCreator* window_creator_; - static ViEAutoTest* tests_; }; -#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_ +#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_TWO_WINDOWS_FIXTURE_H_ diff --git a/src/video_engine/test/auto_test/automated/vie_api_integration_test.cc b/src/video_engine/test/auto_test/automated/vie_api_integration_test.cc index 1a4a768201..a2c65a23ba 100644 --- a/src/video_engine/test/auto_test/automated/vie_api_integration_test.cc +++ b/src/video_engine/test/auto_test/automated/vie_api_integration_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -13,12 +13,12 @@ */ #include "gtest/gtest.h" -#include "vie_integration_test_base.h" +#include "legacy_fixture.h" #include "vie_autotest.h" namespace { -class ViEApiIntegrationTest: public ViEIntegrationTest { +class ViEApiIntegrationTest : public LegacyFixture { }; TEST_F(ViEApiIntegrationTest, RunsBaseTestWithoutErrors) { diff --git a/src/video_engine/test/auto_test/automated/vie_extended_integration_test.cc b/src/video_engine/test/auto_test/automated/vie_extended_integration_test.cc index 1b830157f4..facb659484 100644 --- a/src/video_engine/test/auto_test/automated/vie_extended_integration_test.cc +++ b/src/video_engine/test/auto_test/automated/vie_extended_integration_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -13,12 +13,12 @@ */ #include "gtest/gtest.h" -#include "vie_integration_test_base.h" +#include "legacy_fixture.h" #include "vie_autotest.h" namespace { -class ViEExtendedIntegrationTest: public ViEIntegrationTest { +class ViEExtendedIntegrationTest : public LegacyFixture { }; TEST_F(ViEExtendedIntegrationTest, RunsBaseTestWithoutErrors) { diff --git a/src/video_engine/test/auto_test/automated/vie_integration_test_base.cc b/src/video_engine/test/auto_test/automated/vie_integration_test_base.cc deleted file mode 100644 index 5de60776eb..0000000000 --- a/src/video_engine/test/auto_test/automated/vie_integration_test_base.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2011 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 "vie_integration_test_base.h" - -#include "vie_autotest.h" -#include "vie_autotest_window_manager_interface.h" -#include "vie_window_creator.h" - -void ViEIntegrationTest::SetUpTestCase() { - window_creator_ = new ViEWindowCreator(); - - ViEAutoTestWindowManagerInterface* window_manager = - window_creator_->CreateTwoWindows(); - - // Create the test cases - tests_ = new ViEAutoTest(window_manager->GetWindow1(), - window_manager->GetWindow2()); -} - -void ViEIntegrationTest::TearDownTestCase() { - window_creator_->TerminateWindows(); - - delete tests_; - delete window_creator_; -} - -ViEWindowCreator* ViEIntegrationTest::window_creator_ = NULL; -ViEAutoTest* ViEIntegrationTest::tests_ = NULL; diff --git a/src/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc b/src/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc new file mode 100644 index 0000000000..5bab4562ab --- /dev/null +++ b/src/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc @@ -0,0 +1,138 @@ +/* + * 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 +#include +#include + +#include "gtest/gtest.h" +#include "gflags/gflags.h" +#include "video_engine/include/vie_encryption.h" +#include "video_engine/test/auto_test/automated/two_windows_fixture.h" +#include "video_engine/test/auto_test/helpers/vie_window_creator.h" +#include "video_engine/test/auto_test/interface/tb_capture_device.h" +#include "video_engine/test/auto_test/interface/tb_interfaces.h" +#include "video_engine/test/auto_test/interface/tb_video_channel.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/vie_defines.h" + +namespace { + +DEFINE_int32(rtp_fuzz_test_rand_seed, 0, "The rand seed to use for " + "the RTP fuzz test. Defaults to time(). 0 cannot be specified."); + +class ViERtpFuzzTest : public TwoWindowsFixture { + protected: + unsigned int FetchRandSeed() { + if (FLAGS_rtp_fuzz_test_rand_seed != 0) { + return FLAGS_rtp_fuzz_test_rand_seed; + } + return std::time(NULL); + } +}; + +static int Saturate(int value, int min, int max) { + return std::min(std::max(value, min), max); +} + +// These algorithms attempt to create an uncrackable encryption +// scheme by completely disregarding the input data. +class RandomEncryption : public webrtc::Encryption { + public: + RandomEncryption(unsigned int rand_seed) { + srand(rand_seed); + } + + virtual void encrypt(int channel_no, unsigned char* in_data, + unsigned char* out_data, int bytes_in, int* bytes_out) { + GenerateRandomData(out_data, bytes_in, bytes_out); + } + + virtual void decrypt(int channel_no, unsigned char* in_data, + unsigned char* out_data, int bytes_in, int* bytes_out) { + GenerateRandomData(out_data, bytes_in, bytes_out); + } + + virtual void encrypt_rtcp(int channel_no, unsigned char* in_data, + unsigned char* out_data, int bytes_in, + int* bytes_out) { + GenerateRandomData(out_data, bytes_in, bytes_out); + } + + virtual void decrypt_rtcp(int channel_no, unsigned char* in_data, + unsigned char* out_data, int bytes_in, + int* bytes_out) { + GenerateRandomData(out_data, bytes_in, bytes_out); + } + + private: + // Generates some completely random data with roughly the right length. + void GenerateRandomData(unsigned char* out_data, int bytes_in, + int* bytes_out) { + int out_length = MakeUpSimilarLength(bytes_in); + for (int i = 0; i < out_length; i++) { + // The modulo will skew the random distribution a bit, but I think it + // will be random enough. + out_data[i] = static_cast(rand() % 256); + } + *bytes_out = out_length; + } + + // Makes up a length within +- 50 of the original length, without + // overstepping the contract for encrypt / decrypt. + int MakeUpSimilarLength(int original_length) { + int sign = rand() - RAND_MAX / 2; + int length = original_length + sign * rand() % 50; + + return Saturate(length, 0, static_cast(webrtc::kViEMaxMtu)); + } +}; + +TEST_F(ViERtpFuzzTest, VideoEngineRecoversAfterSomeCompletelyRandomPackets) { + unsigned int rand_seed = FetchRandSeed(); + ViETest::Log("Running test with rand seed %d.", rand_seed); + + TbInterfaces video_engine("ViERtpTryInjectingRandomPacketsIntoRtpStream"); + TbVideoChannel video_channel(video_engine, webrtc::kVideoCodecVP8); + TbCaptureDevice capture_device(video_engine); + + capture_device.ConnectTo(video_channel.videoChannel); + + // Enable PLI RTCP, which will allow the video engine to recover better. + video_engine.rtp_rtcp->SetKeyFrameRequestMethod( + video_channel.videoChannel, webrtc::kViEKeyFrameRequestPliRtcp); + + video_channel.StartReceive(); + video_channel.StartSend(); + + RenderInWindow( + video_engine.render, capture_device.captureId, window_1_, 0); + RenderInWindow( + video_engine.render, video_channel.videoChannel, window_2_, 1); + + ViETest::Log("Running as usual. You should see video output."); + AutoTestSleep(2000); + + ViETest::Log("Injecting completely random packets..."); + RandomEncryption random_encryption(rand_seed); + video_engine.encryption->RegisterExternalEncryption( + video_channel.videoChannel, random_encryption); + + AutoTestSleep(5000); + + ViETest::Log("Back to normal."); + video_engine.encryption->DeregisterExternalEncryption( + video_channel.videoChannel); + + AutoTestSleep(5000); +} + +} diff --git a/src/video_engine/test/auto_test/automated/vie_standard_integration_test.cc b/src/video_engine/test/auto_test/automated/vie_standard_integration_test.cc index d3290982a7..e85b6e4cb6 100644 --- a/src/video_engine/test/auto_test/automated/vie_standard_integration_test.cc +++ b/src/video_engine/test/auto_test/automated/vie_standard_integration_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -19,17 +19,17 @@ #include "gflags/gflags.h" #include "gtest/gtest.h" +#include "legacy_fixture.h" #include "testsupport/metrics/video_metrics.h" #include "vie_autotest.h" #include "vie_autotest_window_manager_interface.h" -#include "vie_integration_test_base.h" #include "vie_to_file_renderer.h" #include "vie_window_creator.h" #include "testsupport/metrics/video_metrics.h" namespace { -class ViEStandardIntegrationTest: public ViEIntegrationTest { +class ViEStandardIntegrationTest : public LegacyFixture { }; TEST_F(ViEStandardIntegrationTest, RunsBaseTestWithoutErrors) { diff --git a/src/video_engine/test/auto_test/automated/vie_video_verification_test.cc b/src/video_engine/test/auto_test/automated/vie_video_verification_test.cc index 4b031a4b80..1ed1272255 100644 --- a/src/video_engine/test/auto_test/automated/vie_video_verification_test.cc +++ b/src/video_engine/test/auto_test/automated/vie_video_verification_test.cc @@ -14,7 +14,6 @@ #include "gtest/gtest.h" #include "testsupport/fileutils.h" #include "testsupport/metrics/video_metrics.h" -#include "video_engine/test/auto_test/automated/vie_integration_test_base.h" #include "video_engine/test/auto_test/helpers/vie_to_file_renderer.h" #include "video_engine/test/auto_test/interface/vie_autotest.h" #include "video_engine/test/auto_test/interface/vie_file_based_comparison_tests.h" diff --git a/src/video_engine/test/auto_test/interface/vie_autotest.h b/src/video_engine/test/auto_test/interface/vie_autotest.h index 20faee76e2..a508cd4465 100644 --- a/src/video_engine/test/auto_test/interface/vie_autotest.h +++ b/src/video_engine/test/auto_test/interface/vie_autotest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -39,7 +39,9 @@ #include #endif +class TbCaptureDevice; class TbInterfaces; +class TbVideoChannel; class ViEToFileRenderer; // This class provides a bunch of methods, implemented across several .cc @@ -58,7 +60,8 @@ public: int ViESimulcastCall(); int ViECustomCall(); - // All following functions are meant to run in a googletest harness. + // All functions except the three above are meant to run in a + // googletest harness. void ViEStandardTest(); void ViEExtendedTest(); void ViEAPITest(); @@ -110,10 +113,19 @@ public: void ViERtpRtcpExtendedTest(); void ViERtpRtcpAPITest(); + // vie_autotest_rtp_fuzz.cc + void ViERtpTryInjectingRandomPacketsIntoRtpStream(long rand_seed); + private: void PrintAudioCodec(const webrtc::CodecInst audioCodec); void PrintVideoCodec(const webrtc::VideoCodec videoCodec); + // Sets up rendering so the capture device output goes to window 1 and + // the video engine output goes to window 2. + void RenderCaptureDeviceAndOutputStream(TbInterfaces* video_engine, + TbVideoChannel* video_channel, + TbCaptureDevice* capture_device); + void* _window1; void* _window2; diff --git a/src/video_engine/test/auto_test/source/vie_autotest.cc b/src/video_engine/test/auto_test/source/vie_autotest.cc index 183ea469b3..8281ea2aa5 100644 --- a/src/video_engine/test/auto_test/source/vie_autotest.cc +++ b/src/video_engine/test/auto_test/source/vie_autotest.cc @@ -17,6 +17,10 @@ #include #include "engine_configurations.h" +#include "general_primitives.h" +#include "tb_interfaces.h" +#include "tb_video_channel.h" +#include "tb_capture_device.h" #include "testsupport/fileutils.h" #include "video_render.h" #include "vie_autotest_defines.h" @@ -143,3 +147,13 @@ void ViEAutoTest::PrintAudioCodec(const webrtc::CodecInst audioCodec) ViETest::Log("\t: %u", audioCodec.rate); ViETest::Log(""); } + +void ViEAutoTest::RenderCaptureDeviceAndOutputStream( + TbInterfaces* video_engine, + TbVideoChannel* video_channel, + TbCaptureDevice* capture_device) { + RenderInWindow( + video_engine->render, capture_device->captureId, _window1, 0); + RenderInWindow( + video_engine->render, video_channel->videoChannel, _window1, 1); +} diff --git a/src/video_engine/test/auto_test/source/vie_autotest_encryption.cc b/src/video_engine/test/auto_test/source/vie_autotest_encryption.cc index 420d46512f..0c06f327d9 100644 --- a/src/video_engine/test/auto_test/source/vie_autotest_encryption.cc +++ b/src/video_engine/test/auto_test/source/vie_autotest_encryption.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -93,12 +93,7 @@ void ViEAutoTest::ViEEncryptionStandardTest() tbChannel.StartSend(); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId)); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel)); + RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture); #ifdef WEBRTC_SRTP //*************************************************************** @@ -190,12 +185,7 @@ void ViEAutoTest::ViEEncryptionExtendedTest() tbChannel.StartReceive(); tbChannel.StartSend(); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId)); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel)); + RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture); //*************************************************************** // Engine ready. Begin testing class diff --git a/src/video_engine/test/auto_test/source/vie_autotest_image_process.cc b/src/video_engine/test/auto_test/source/vie_autotest_image_process.cc index 36b38b01d0..887fe6ea99 100644 --- a/src/video_engine/test/auto_test/source/vie_autotest_image_process.cc +++ b/src/video_engine/test/auto_test/source/vie_autotest_image_process.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -57,12 +57,7 @@ void ViEAutoTest::ViEImageProcessStandardTest() MyEffectFilter effectFilter; - EXPECT_EQ(0, ViE.render->AddRenderer( - tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId)); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel)); + RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture); ViETest::Log("Capture device is renderered in Window 1"); ViETest::Log("Remote stream is renderered in Window 2"); diff --git a/src/video_engine/test/auto_test/source/vie_autotest_network.cc b/src/video_engine/test/auto_test/source/vie_autotest_network.cc index e5582234c5..2a84644db8 100644 --- a/src/video_engine/test/auto_test/source/vie_autotest_network.cc +++ b/src/video_engine/test/auto_test/source/vie_autotest_network.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * 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 @@ -49,18 +49,12 @@ void ViEAutoTest::ViENetworkStandardTest() { TbInterfaces ViE("ViENetworkStandardTest"); // Create VIE TbCaptureDevice tbCapture(ViE); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId)); - { // Create a video channel TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8); tbCapture.ConnectTo(tbChannel.videoChannel); - EXPECT_EQ(0, ViE.render->AddRenderer( - tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0)); - EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel)); + RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture); // *************************************************************** // Engine ready. Begin testing class diff --git a/src/video_engine/test/auto_test/vie_auto_test.gypi b/src/video_engine/test/auto_test/vie_auto_test.gypi index 67f27c7e57..ea05d91bb4 100644 --- a/src/video_engine/test/auto_test/vie_auto_test.gypi +++ b/src/video_engine/test/auto_test/vie_auto_test.gypi @@ -59,10 +59,12 @@ 'helpers/vie_window_creator.h', # New, fully automated tests + 'automated/legacy_fixture.cc', + 'automated/two_windows_fixture.cc', 'automated/vie_api_integration_test.cc', 'automated/vie_extended_integration_test.cc', - 'automated/vie_integration_test_base.cc', 'automated/vie_integration_test_base.h', + 'automated/vie_rtp_fuzz_test.cc', 'automated/vie_standard_integration_test.cc', 'automated/vie_video_verification_test.cc',