diff --git a/src/video_engine/main/test/AutoTest/automated/vie_standard_integration_test.cc b/src/video_engine/main/test/AutoTest/automated/vie_standard_integration_test.cc new file mode 100644 index 0000000000..b9d2fb09a3 --- /dev/null +++ b/src/video_engine/main/test/AutoTest/automated/vie_standard_integration_test.cc @@ -0,0 +1,89 @@ +/* + * 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. + */ + +/* + * This file contains the "standard" suite of integration tests, implemented + * as a GUnit test. This file is a part of the effort to try to automate all + * tests in this section of the code. Currently, this code makes no attempt + * to verify any video output - it only checks for direct errors. + */ + +#include "gtest/gtest.h" +#include "vie_autotest.h" +#include "vie_autotest_window_manager_interface.h" +#include "vie_window_creator.h" + +namespace { + +class ViEStandardIntegrationTest: public testing::Test { + public: + static void SetUpTestCase() { + window_creator_ = new ViEWindowCreator(); + + ViEAutoTestWindowManagerInterface* window_manager = + window_creator_->CreateTwoWindows(); + + // Create the test cases + tests_ = new ViEAutoTest(window_manager->GetWindow1(), + window_manager->GetWindow2()); + } + + static void TearDownTestCase() { + window_creator_->TerminateWindows(); + + delete tests_; + delete window_creator_; + } + + protected: + static ViEWindowCreator* window_creator_; + static ViEAutoTest* tests_; +}; + +TEST_F(ViEStandardIntegrationTest, RunsBaseStandardTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViEBaseStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsCaptureTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViECaptureStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsCodecTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViECodecStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsEncryptionTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViEEncryptionStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsFileTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViEFileStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsImageProcessTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViEImageProcessStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsNetworkTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViENetworkStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsRenderTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViERenderStandardTest()); +} + +TEST_F(ViEStandardIntegrationTest, RunsRtpRctpTestWithoutErrors) { + ASSERT_EQ(0, tests_->ViERtpRtcpStandardTest()); +} + +ViEAutoTest* ViEStandardIntegrationTest::tests_ = NULL; +ViEWindowCreator* ViEStandardIntegrationTest::window_creator_ = NULL; + +} diff --git a/src/video_engine/main/test/AutoTest/helpers/vie_window_creator.cc b/src/video_engine/main/test/AutoTest/helpers/vie_window_creator.cc new file mode 100644 index 0000000000..e121067d8b --- /dev/null +++ b/src/video_engine/main/test/AutoTest/helpers/vie_window_creator.cc @@ -0,0 +1,63 @@ +/* + * 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_window_creator.h" + +#include "vie_autotest_main.h" +#include "vie_codec.h" +#include "voe_codec.h" +#include "engine_configurations.h" + +#if defined(WIN32) +#include "vie_autotest_windows.h" +#include +#include //ShellExecute +#elif defined(WEBRTC_MAC_INTEL) +#if defined(COCOA_RENDERING) +#include "vie_autotest_mac_cocoa.h" +#elif defined(CARBON_RENDERING) +#include "vie_autotest_mac_carbon.h" +#endif +#elif defined(WEBRTC_LINUX) +#include "vie_autotest_linux.h" +#endif + +ViEWindowCreator::ViEWindowCreator() { + // Create platform dependent render windows. + window_manager_ = new ViEAutoTestWindowManager(); +} + +ViEWindowCreator::~ViEWindowCreator() { + delete window_manager_; +} + +ViEAutoTestWindowManagerInterface* + ViEWindowCreator::CreateTwoWindows() { +#if (defined(_WIN32)) + TCHAR window1Title[1024] = _T("ViE Autotest Window 1"); + TCHAR window2Title[1024] = _T("ViE Autotest Window 2"); +#else + char window1Title[1024] = "ViE Autotest Window 1"; + char window2Title[1024] = "ViE Autotest Window 2"; +#endif + + AutoTestRect window1Size(352, 288, 600, 100); + AutoTestRect window2Size(352, 288, 1000, 100); + window_manager_->CreateWindows(window1Size, window2Size, window1Title, + window2Title); + window_manager_->SetTopmostWindow(); + + return window_manager_; +} + +void ViEWindowCreator::TerminateWindows() { + window_manager_->TerminateWindows(); +} + diff --git a/src/video_engine/main/test/AutoTest/helpers/vie_window_creator.h b/src/video_engine/main/test/AutoTest/helpers/vie_window_creator.h new file mode 100644 index 0000000000..25c23a3f39 --- /dev/null +++ b/src/video_engine/main/test/AutoTest/helpers/vie_window_creator.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_HELPERS_VIE_WINDOW_CREATOR_H_ +#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_HELPERS_VIE_WINDOW_CREATOR_H_ + +class ViEAutoTestWindowManagerInterface; + +class ViEWindowCreator { + public: + ViEWindowCreator(); + virtual ~ViEWindowCreator(); + + // The pointer returned here will still be owned by this object. + // Only use it to retrieve the created windows. + ViEAutoTestWindowManagerInterface* CreateTwoWindows(); + + // Terminates windows opened by CreateTwoWindows, which must + // have been called before this method. + void TerminateWindows(); + private: + ViEAutoTestWindowManagerInterface* window_manager_; +}; + +#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_HELPERS_VIE_WINDOW_CREATOR_H_ diff --git a/src/video_engine/main/test/AutoTest/source/vie_autotest_linux.cc b/src/video_engine/main/test/AutoTest/source/vie_autotest_linux.cc index a17d399716..ec6f9c6421 100644 --- a/src/video_engine/main/test/AutoTest/source/vie_autotest_linux.cc +++ b/src/video_engine/main/test/AutoTest/source/vie_autotest_linux.cc @@ -12,6 +12,9 @@ // vie_autotest_linux.cc // +#include "gtest/gtest.h" +#include + #include "vie_autotest_linux.h" #include "vie_autotest_defines.h" @@ -144,10 +147,18 @@ bool ViEAutoTestWindowManager::SetTopmostWindow() return 0; } -int main() +int main(int argc, char** argv) { + // This command-line flag is a transitory solution until we + // managed to rewrite all tests to GUnit tests. This flag is + // currently only supported in Linux. + if (argc == 2 && std::string(argv[1]) == "--automated") { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); + } + + // Default: run in classic interactive mode. ViEAutoTestMain autoTest; autoTest.UseAnswerFile("answers.txt"); return autoTest.BeginOSIndependentTesting(); - } diff --git a/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc b/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc index 47360d5450..fdaef8f3ba 100644 --- a/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc +++ b/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc @@ -13,25 +13,11 @@ * */ -#include "vie_autotest.h" -#include "vie_autotest_defines.h" -#include "vie_autotest_main.h" -#include "vie_codec.h" -#include "voe_codec.h" +#include "vie_window_creator.h" +#include "vie_autotest_window_manager_interface.h" -#if defined(WIN32) - #include "vie_autotest_windows.h" - #include - #include //ShellExecute -#elif defined(WEBRTC_MAC_INTEL) - #if defined(COCOA_RENDERING) - #include "vie_autotest_mac_cocoa.h" -#elif defined(CARBON_RENDERING) - #include "vie_autotest_mac_carbon.h" -#endif -#elif defined(WEBRTC_LINUX) - #include "vie_autotest_linux.h" -#endif +#include "vie_autotest.h" +#include "vie_autotest_main.h" ViEAutoTestMain::ViEAutoTestMain() : _answers(), @@ -42,23 +28,10 @@ ViEAutoTestMain::ViEAutoTestMain() : bool ViEAutoTestMain::BeginOSIndependentTesting() { - // Create platform dependent render windows + // Create the windows + ViEWindowCreator windowCreator; ViEAutoTestWindowManagerInterface* windowManager = - new ViEAutoTestWindowManager(); - -#if (defined(_WIN32)) - TCHAR window1Title[1024] = _T("ViE Autotest Window 1"); - TCHAR window2Title[1024] = _T("ViE Autotest Window 2"); -#else - char window1Title[1024] = "ViE Autotest Window 1"; - char window2Title[1024] = "ViE Autotest Window 2"; -#endif - - AutoTestRect window1Size(352, 288, 600, 100); - AutoTestRect window2Size(352, 288, 1000, 100); - windowManager->CreateWindows(window1Size, window2Size, window1Title, - window2Title); - windowManager->SetTopmostWindow(); + windowCreator.CreateTwoWindows(); // Create the test cases ViEAutoTest vieAutoTest(windowManager->GetWindow1(), @@ -289,7 +262,7 @@ bool ViEAutoTestMain::BeginOSIndependentTesting() } } while (testType != 0); - windowManager->TerminateWindows(); + windowCreator.TerminateWindows(); if (testErrors) { @@ -306,8 +279,6 @@ bool ViEAutoTestMain::BeginOSIndependentTesting() while ((c = getchar()) != '\n' && c != EOF) /* discard */; - delete windowManager; - return true; } diff --git a/src/video_engine/main/test/AutoTest/source/vie_autotest_windows.cc b/src/video_engine/main/test/AutoTest/source/vie_autotest_windows.cc index 1d264d11ff..4bf14cdb37 100644 --- a/src/video_engine/main/test/AutoTest/source/vie_autotest_windows.cc +++ b/src/video_engine/main/test/AutoTest/source/vie_autotest_windows.cc @@ -230,15 +230,12 @@ int ViEAutoTestWindowManager::ViEDestroyWindow(HWND& hwnd) bool ViEAutoTestWindowManager::SetTopmostWindow() { - - // meant to put terminal window on top - + // Meant to put terminal window on top return true; } int main(int argc, char* argv[]) { - ViEAutoTestMain autoTest; if (argc > 1) { diff --git a/src/video_engine/main/test/AutoTest/vie_auto_test.gypi b/src/video_engine/main/test/AutoTest/vie_auto_test.gypi index cd87d02eb8..699264593d 100644 --- a/src/video_engine/main/test/AutoTest/vie_auto_test.gypi +++ b/src/video_engine/main/test/AutoTest/vie_auto_test.gypi @@ -16,10 +16,12 @@ '<(webrtc_root)/modules/modules.gyp:video_render_module', '<(webrtc_root)/modules/modules.gyp:video_capture_module', '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine_core', + '<(webrtc_root)/../testing/gtest.gyp:gtest', 'video_engine_core', ], 'include_dirs': [ 'interface/', + 'helpers/', '../../interface', '../../source', '../../../../modules/video_capture/main/source/', @@ -41,6 +43,12 @@ 'interface/vie_autotest_window_manager_interface.h', 'interface/vie_autotest_windows.h', + # Helper classes + 'helpers/vie_window_creator.cc', + + # New, fully automated tests + 'automated/vie_standard_integration_test.cc', + # Platform independent 'source/tb_capture_device.cc', 'source/tb_external_transport.cc',