Added more tests, fixed a bug and refactored.

Fixed merge error.

Fixed cpplint.py warnings.

Fixed presubmit warning.

Whitespace fixes after review.

Rebase from svn.

Extracted a method for finding a capture device on the system. This removes a fair bit of logic from the huge test method (mostly straight statements remain there now).

The ViETest::TestError static method will now assert using GTest asserts if we are running in GTest mode. This gets rid of the hard asserts that get run otherwise. The hard asserts are still in when using "classic" mode. TestError will use neither GUnit nor hard asserts if VIE_ASSERT_ERROR is not defined. - Formatted vie_autotest_defines.h according to Google style rules.

Added extended and API tests. - Abstracted out an integration test base class since all integration tests set up the exact same way.

Fixed a bug which caused test error messages to not get shown.

Added comments to the new test.

Added a new mode to the vie_auto_test binary. It is now possible to pass --automated to it to make it run noninteractively. - To be precise, it will run everything that has been rewritten as GUnit tests, which currently is one "test suite" in the binary.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/188002

git-svn-id: http://webrtc.googlecode.com/svn/trunk@747 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2011-10-14 13:00:20 +00:00
parent 2111d3b0b0
commit 26c041673f
13 changed files with 575 additions and 448 deletions

View File

@ -0,0 +1,60 @@
/*
* 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.
*/
/**
* Runs "extended" integration tests.
*/
#include "gtest/gtest.h"
#include "vie_integration_test_base.h"
#include "vie_autotest.h"
namespace {
class ViEApiIntegrationTest: public ViEIntegrationTest {
};
TEST_F(ViEApiIntegrationTest, RunsBaseTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEBaseAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsCaptureTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViECaptureAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsCodecTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViECodecAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsEncryptionTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEEncryptionAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsFileTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEFileAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsImageProcessTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEImageProcessAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsNetworkTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViENetworkAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsRenderTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViERenderAPITest());
}
TEST_F(ViEApiIntegrationTest, RunsRtpRtcpTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViERtpRtcpAPITest());
}
}

View File

@ -0,0 +1,60 @@
/*
* 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.
*/
/**
* Runs "extended" integration tests.
*/
#include "gtest/gtest.h"
#include "vie_integration_test_base.h"
#include "vie_autotest.h"
namespace {
class ViEExtendedIntegrationTest: public ViEIntegrationTest {
};
TEST_F(ViEExtendedIntegrationTest, RunsBaseTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEBaseExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsCaptureTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViECaptureExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsCodecTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViECodecExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsEncryptionTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEEncryptionExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsFileTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEFileExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsImageProcessTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEImageProcessExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsNetworkTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViENetworkExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsRenderTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViERenderExtendedTest());
}
TEST_F(ViEExtendedIntegrationTest, RunsRtpRtcpTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViERtpRtcpExtendedTest());
}
}

View File

@ -0,0 +1,37 @@
/*
* 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(),
ViETest::kUseGTestExpectsForTestErrors);
}
void ViEIntegrationTest::TearDownTestCase() {
window_creator_->TerminateWindows();
delete tests_;
delete window_creator_;
}
ViEWindowCreator* ViEIntegrationTest::window_creator_ = NULL;
ViEAutoTest* ViEIntegrationTest::tests_ = NULL;

View File

@ -0,0 +1,35 @@
/*
* 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_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_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 {
public:
// Intitializes a suitable webcam on the system and launches
// two windows in a platform-dependent manner.
static void SetUpTestCase();
// Releases anything allocated by SetupTestCase.
static void TearDownTestCase();
protected:
static ViEWindowCreator* window_creator_;
static ViEAutoTest* tests_;
};
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_

View File

@ -16,38 +16,19 @@
*/
#include "gtest/gtest.h"
#include "vie_autotest.h"
#include "vie_autotest_window_manager_interface.h"
#include "vie_integration_test_base.h"
#include "vie_window_creator.h"
namespace {
class ViEStandardIntegrationTest: public testing::Test {
class ViEStandardIntegrationTest: public ViEIntegrationTest {
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) {
TEST_F(ViEStandardIntegrationTest, RunsBaseTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEBaseStandardTest());
}
@ -82,8 +63,4 @@ TEST_F(ViEStandardIntegrationTest, RunsRenderTestWithoutErrors) {
TEST_F(ViEStandardIntegrationTest, RunsRtpRctpTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViERtpRtcpStandardTest());
}
ViEAutoTest* ViEStandardIntegrationTest::tests_ = NULL;
ViEWindowCreator* ViEStandardIntegrationTest::window_creator_ = NULL;
}

View File

@ -33,6 +33,8 @@
#include "vie_errors.h"
#include "video_render_defines.h"
#include "vie_autotest_defines.h"
#ifndef WEBRTC_ANDROID
#include <string>
#endif
@ -40,7 +42,8 @@
class ViEAutoTest
{
public:
ViEAutoTest(void* window1, void* window2);
ViEAutoTest(void* window1, void* window2,
ViETest::TestErrorMode testErrorMode);
~ViEAutoTest();
int ViEStandardTest();
@ -139,6 +142,17 @@ public:
int ViERtpRtcpAPITest();
private:
// Finds a suitable capture device (e.g. camera) on the current system.
// Details about the found device are filled into the out parameters.
// If this operation fails, device_id is assigned a negative value
// and number_of_errors is incremented.
void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
WebRtc_UWord8* device_name,
const unsigned int kDeviceNameLength,
int* device_id,
int* number_of_errors,
webrtc::VideoCaptureModule** device_video);
void PrintAudioCodec(const webrtc::CodecInst audioCodec);
void PrintVideoCodec(const webrtc::VideoCodec videoCodec);

View File

@ -21,6 +21,7 @@
#include <stdio.h>
#include "engine_configurations.h"
#include "gtest/gtest.h"
#if defined(_WIN32)
#include <windows.h>
@ -58,162 +59,163 @@
#define DEFAULT_INCOMING_FILE_NAME "IncomingFile.avi"
#define DEFAULT_OUTGOING_FILE_NAME "OutgoingFile.avi"
enum
{
KAutoTestSleepTimeMs = 5000
enum {
KAutoTestSleepTimeMs = 5000
};
struct AutoTestSize
{
unsigned int width;
unsigned int height;
AutoTestSize() :
width(0),
height(0)
{}
AutoTestSize(unsigned int iWidth, unsigned int iHeight) :
width(iWidth),
height(iHeight)
{}
struct AutoTestSize {
unsigned int width;
unsigned int height;
AutoTestSize() :
width(0), height(0) {
}
AutoTestSize(unsigned int iWidth, unsigned int iHeight) :
width(iWidth), height(iHeight) {
}
};
struct AutoTestOrigin
{
unsigned int x;
unsigned int y;
AutoTestOrigin() :
x(0),
y(0)
{}
AutoTestOrigin(unsigned int iX, unsigned int iY) :
x(iX),
y(iY)
{}
struct AutoTestOrigin {
unsigned int x;
unsigned int y;
AutoTestOrigin() :
x(0), y(0) {
}
AutoTestOrigin(unsigned int iX, unsigned int iY) :
x(iX), y(iY) {
}
};
struct AutoTestRect
{
AutoTestSize size;
AutoTestOrigin origin;
AutoTestRect() :
size(),
origin()
{}
struct AutoTestRect {
AutoTestSize size;
AutoTestOrigin origin;
AutoTestRect() :
size(), origin() {
}
AutoTestRect(unsigned int iX, unsigned int iY, unsigned int iWidth,
unsigned int iHeight) :
size(iX, iY),
origin(iWidth, iHeight)
{}
AutoTestRect(unsigned int iX, unsigned int iY, unsigned int iWidth, unsigned int iHeight) :
size(iX, iY), origin(iWidth, iHeight) {
}
void Copy(AutoTestRect iRect)
{
origin.x = iRect.origin.x;
origin.y = iRect.origin.y;
size.width = iRect.size.width;
size.height = iRect.size.height;
}
void Copy(AutoTestRect iRect) {
origin.x = iRect.origin.x;
origin.y = iRect.origin.y;
size.width = iRect.size.width;
size.height = iRect.size.height;
}
};
// ============================================
class ViETest
{
protected:
static FILE* _logFile;
enum
{
KMaxLogSize = 512
};
static char* _logStr;
class ViETest {
public:
enum TestErrorMode {
kUseGTestExpectsForTestErrors, kUseAssertsForTestErrors
};
static int Init()
{
// The test error mode tells how we should assert when an error
// occurs, provided that VIE_ASSERT_ERROR is defined.
static int Init(TestErrorMode test_error_mode) {
#ifdef VIE_LOG_TO_FILE
_logFile = fopen(VIE_LOG_FILE_NAME, "w+t");
log_file_ = fopen(VIE_LOG_FILE_NAME, "w+t");
#else
_logFile = NULL;
log_file_ = NULL;
#endif
_logStr = new char[KMaxLogSize];
memset(_logStr, 0, KMaxLogSize);
return 0;
log_str_ = new char[kMaxLogSize];
memset(log_str_, 0, kMaxLogSize);
test_error_mode_ = test_error_mode;
return 0;
}
static int Terminate() {
if (log_file_) {
fclose(log_file_);
log_file_ = NULL;
}
static int Terminate()
{
if (_logFile)
{
fclose(_logFile);
_logFile = NULL;
}
if (_logStr)
{
delete[] _logStr;
_logStr = NULL;
}
return 0;
if (log_str_) {
delete[] log_str_;
log_str_ = NULL;
}
return 0;
}
static void Log(const char* fmt, ...)
{
va_list va;
va_start(va, fmt);
memset(_logStr, 0, KMaxLogSize);
vsprintf(_logStr, fmt, va);
va_end(va);
static void Log(const char* fmt, ...) {
va_list va;
va_start(va, fmt);
memset(log_str_, 0, kMaxLogSize);
vsprintf(log_str_, fmt, va);
va_end(va);
WriteToSuitableOutput(log_str_);
}
// Writes to a suitable output, depending on platform and log mode.
static void WriteToSuitableOutput(const char* message) {
#ifdef VIE_LOG_TO_FILE
if (_logFile)
{
fwrite(_logStr, 1, strlen(_logStr), _logFile);
fwrite("\n", 1, 1, _logFile);
fflush(_logFile);
}
if (log_file_)
{
fwrite(log_str_, 1, strlen(log_str_), log_file_);
fwrite("\n", 1, 1, log_file_);
fflush(log_file_);
}
#endif
#ifdef VIE_LOG_TO_STDOUT
#if WEBRTC_ANDROID
__android_log_write(ANDROID_LOG_DEBUG, "*WebRTCN*", _logStr);
__android_log_write(ANDROID_LOG_DEBUG, "*WebRTCN*", log_str_);
#else
printf("%s\n",_logStr);
printf("%s\n", log_str_);
#endif
#endif
}
static int TestError(bool expr) {
if (!expr) {
AssertError("");
return 1;
}
return 0;
}
static int TestError(bool expr)
{
if (!expr)
{
#ifdef VIE_ASSERT_ERROR
assert(expr);
#endif
return 1;
}
return 0;
}
static int TestError(bool expr, const char* fmt, ...)
{
if (!expr)
{
va_list va;
va_start(va, fmt);
memset(_logStr, 0, KMaxLogSize);
vsprintf(_logStr, fmt, va);
static int TestError(bool expr, const char* fmt, ...) {
if (!expr) {
va_list va;
va_start(va, fmt);
memset(log_str_, 0, kMaxLogSize);
vsprintf(log_str_, fmt, va);
#ifdef WEBRTC_ANDROID
__android_log_write(ANDROID_LOG_ERROR, "*WebRTCN*", _logStr);
__android_log_write(ANDROID_LOG_ERROR, "*WebRTCN*", log_str_);
#endif
Log(_logStr);
va_end(va);
WriteToSuitableOutput(log_str_);
va_end(va);
#ifdef VIE_ASSERT_ERROR
assert(false);
#endif
return 1;
}
return 0;
AssertError(log_str_);
return 1;
}
return 0;
}
private:
static void AssertError(const char* message) {
#ifdef VIE_ASSERT_ERROR
if (test_error_mode_ == kUseAssertsForTestErrors) {
assert(false);
} else if (test_error_mode_ == kUseGTestExpectsForTestErrors) {
// Note that the failure gets added here, but information about where
// the real error occurred is usually in the message.
ADD_FAILURE() << message ;
} else {
assert(false && "Internal test framework logical error: unknown mode");
}
#endif
}
static FILE* log_file_;
enum {
kMaxLogSize = 512
};
static char* log_str_;
static TestErrorMode test_error_mode_;
};
// milliseconds
@ -223,24 +225,24 @@ public:
#define AutoTestSleep(x) usleep(x * 1000)
#elif defined(WEBRTC_LINUX)
namespace {
void Sleep(unsigned long x) {
timespec t;
t.tv_sec = x/1000;
t.tv_nsec = (x-(x/1000)*1000)*1000000;
nanosleep(&t,NULL);
}
void Sleep(unsigned long x) {
timespec t;
t.tv_sec = x/1000;
t.tv_nsec = (x-(x/1000)*1000)*1000000;
nanosleep(&t,NULL);
}
}
#define AutoTestSleep ::Sleep
#endif
#ifdef WEBRTC_ANDROID
namespace {
void Sleep(unsigned long x) {
timespec t;
t.tv_sec = x/1000;
t.tv_nsec = (x-(x/1000)*1000)*1000000;
nanosleep(&t,NULL);
}
void Sleep(unsigned long x) {
timespec t;
t.tv_sec = x/1000;
t.tv_nsec = (x-(x/1000)*1000)*1000000;
nanosleep(&t,NULL);
}
}
#define AutoTestSleep ::Sleep
@ -249,13 +251,11 @@ void Sleep(unsigned long x) {
#define VIE_TEST_FILES_ROOT "/tmp/"
#endif
namespace
{
FILE* OpenTestFile(const char* fileName)
{
char filePath[256];
sprintf(filePath,"%s%s",VIE_TEST_FILES_ROOT,fileName);
return fopen(filePath,"rb");
namespace {
FILE* OpenTestFile(const char* fileName) {
char filePath[256];
sprintf(filePath, "%s%s", VIE_TEST_FILES_ROOT, fileName);
return fopen(filePath, "rb");
}
}
#endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_VIE_AUTOTEST_DEFINES_H_

View File

@ -18,7 +18,7 @@ class ViEAutoTestMain
public:
ViEAutoTestMain();
bool BeginOSIndependentTesting();
bool GetAnswer(int index, std::string& answer);
bool GetAnswer(int index, std::string* answer);
int GetClassTestSelection();
bool GetNextAnswer(std::string& answer);
bool IsUsingAnswerFile();

View File

@ -19,10 +19,12 @@
#include <stdio.h>
#include "video_render.h"
FILE* ViETest::_logFile = NULL;
char* ViETest::_logStr = NULL;
FILE* ViETest::log_file_ = NULL;
char* ViETest::log_str_ = NULL;
ViETest::TestErrorMode ViETest::test_error_mode_;
ViEAutoTest::ViEAutoTest(void* window1, void* window2) :
ViEAutoTest::ViEAutoTest(void* window1, void* window2,
ViETest::TestErrorMode testErrorMode) :
_window1(window1),
_window2(window2),
_renderType(webrtc::kRenderDefault),
@ -34,7 +36,7 @@ ViEAutoTest::ViEAutoTest(void* window1, void* window2) :
assert(_vrm1);
assert(_vrm2);
ViETest::Init();
ViETest::Init(testErrorMode);
}
ViEAutoTest::~ViEAutoTest()

View File

@ -12,20 +12,20 @@
// vie_autotest_base.cc
//
#include "vie_autotest_defines.h"
#include "vie_autotest.h"
#include "vie_autotest_defines.h"
#include "engine_configurations.h"
#include "video_capture_factory.h"
int ViEAutoTest::ViEBaseStandardTest()
{
int ViEAutoTest::ViEBaseStandardTest() {
ViETest::Log(" ");
ViETest::Log("========================================");
ViETest::Log(" ViEBase Standard Test");
//***************************************************************
// Begin create/initialize WebRTC Video Engine for testing
//***************************************************************
// ***************************************************************
// Begin create/initialize WebRTC Video Engine for testing
// ***************************************************************
int error = 0;
int numberOfErrors = 0;
@ -37,6 +37,7 @@ int ViEAutoTest::ViEBaseStandardTest()
numberOfErrors += ViETest::TestError(ptrViE != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
#ifdef WEBRTC_ANDROID
error = ptrViE->SetTraceFile("/sdcard/ViEBaseStandardTest_trace.txt");
numberOfErrors += ViETest::TestError(error == 0,
@ -47,159 +48,102 @@ int ViEAutoTest::ViEBaseStandardTest()
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#endif
webrtc::ViEBase* ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
webrtc::ViEBase *ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEBase != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ptrViEBase->Init();
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
//***************************************************************
// Engine ready. Begin testing class
//***************************************************************
// ***************************************************************
// Engine ready. Begin testing class
// ***************************************************************
int videoChannel = -1;
error = ptrViEBase->CreateChannel(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViECapture* ptrViECapture = webrtc::ViECapture::GetInterface(ptrViE);
webrtc::ViECapture *ptrViECapture =
webrtc::ViECapture::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECapture != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
webrtc::VideoCaptureModule* vcpm(NULL);
const unsigned int KMaxDeviceNameLength = 128;
const unsigned int KMaxUniqueIdLength = 256;
WebRtc_UWord8 deviceName[KMaxDeviceNameLength];
memset(deviceName, 0, KMaxDeviceNameLength);
WebRtc_UWord8 uniqueId[KMaxUniqueIdLength];
memset(uniqueId, 0, KMaxUniqueIdLength);
bool captureDeviceSet = false;
int captureId = 0;
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
int captureId;
for (unsigned int captureIdx = 0;
captureIdx < devInfo->NumberOfDevices();
captureIdx++)
{
error = devInfo->GetDeviceName(captureIdx, deviceName,
KMaxDeviceNameLength, uniqueId,
KMaxUniqueIdLength);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
vcpm = webrtc::VideoCaptureFactory::Create(
4571, uniqueId);
vcpm->AddRef();
numberOfErrors += ViETest::TestError(vcpm != NULL,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViECapture->AllocateCaptureDevice(*vcpm, captureId);
if (error == 0)
{
ViETest::Log("Using capture device: %s, captureId: %d.",
deviceName, captureId);
captureDeviceSet = true;
break;
}
else
{
vcpm->Release();
vcpm = NULL;
}
}
delete devInfo;
numberOfErrors+= ViETest::TestError(
captureDeviceSet,
"ERROR: %s at line %d - Could not set capture device",
__FUNCTION__, __LINE__);
FindCaptureDeviceOnSystem(ptrViECapture,
deviceName,
KMaxDeviceNameLength,
&captureId,
&numberOfErrors,
&vcpm);
error = ptrViECapture->ConnectCaptureDevice(captureId, videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViECapture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViERTP_RTCP* ptrViERtpRtcp =
webrtc::ViERTP_RTCP *ptrViERtpRtcp =
webrtc::ViERTP_RTCP::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViE != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ptrViERtpRtcp->SetRTCPStatus(videoChannel,
webrtc::kRtcpCompound_RFC4585);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERtpRtcp->SetKeyFrameRequestMethod(
videoChannel, webrtc::kViEKeyFrameRequestPliRtcp);
error = ptrViERtpRtcp->
SetKeyFrameRequestMethod(videoChannel,
webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERtpRtcp->SetTMMBRStatus(videoChannel, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViERender* ptrViERender = webrtc::ViERender::GetInterface(ptrViE);
webrtc::ViERender *ptrViERender = webrtc::ViERender::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViERender != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ptrViERender->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->AddRenderer(captureId, _window1, 0, 0.0, 0.0, 1.0,
1.0);
error = ptrViERender->AddRenderer(captureId, _window1, 0, 0.0,
0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->StartRender(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->RegisterVideoRenderModule(*_vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->AddRenderer(videoChannel, _window2, 1, 0.0, 0.0, 1.0,
1.0);
error = ptrViERender->AddRenderer(videoChannel, _window2, 1, 0.0, 0.0,
1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->StartRender(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViECodec* ptrViECodec = webrtc::ViECodec::GetInterface(ptrViE);
webrtc::ViECodec *ptrViECodec = webrtc::ViECodec::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECodec != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
for (int idx = 0; idx < ptrViECodec->NumberOfCodecs(); idx++)
{
for (int idx = 0; idx < ptrViECodec->NumberOfCodecs(); idx++) {
error = ptrViECodec->GetCodec(idx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// try to keep the test frame size small when I420
if (videoCodec.codecType == webrtc::kVideoCodecI420)
{
if (videoCodec.codecType == webrtc::kVideoCodecI420) {
videoCodec.width = 176;
videoCodec.height = 144;
error = ptrViECodec->SetSendCodec(videoChannel, videoCodec);
@ -213,65 +157,52 @@ int ViEAutoTest::ViEBaseStandardTest()
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
webrtc::ViENetwork* ptrViENetwork =
webrtc::ViENetwork *ptrViENetwork =
webrtc::ViENetwork::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViENetwork != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
char version[1024] = "";
error = ptrViEBase->GetVersion(version);
ViETest::Log("\nUsing WebRTC Video Engine version: %s", version);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
const char* ipAddress = "127.0.0.1";
const char *ipAddress = "127.0.0.1";
unsigned short rtpPortListen = 6000;
unsigned short rtpPortSend = 6000;
rtpPortListen = 6100;
rtpPortSend = 6100;
error = ptrViENetwork->SetLocalReceiver(videoChannel, rtpPortListen);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViEBase->StartReceive(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViENetwork->SetSendDestination(videoChannel, ipAddress,
rtpPortSend);
error = ptrViENetwork->SetSendDestination(videoChannel,
ipAddress, rtpPortSend);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViEBase->StartSend(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->MirrorRenderStream(captureId, true, false, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Call started
ViETest::Log("Call started");
ViETest::Log("You should see a mirrored local preview from camera %s in "
"window 1 and the remote video in window 2.",
deviceName);
ViETest::Log(
"You should see a mirrored local preview from camera %s"
" in window 1 and the remote video in window 2.", deviceName);
//***************************************************************
// Finished initializing engine. Begin testing
//***************************************************************
// ***************************************************************
// Finished initializing engine. Begin testing
// ***************************************************************
AutoTestSleep(KAutoTestSleepTimeMs);
//***************************************************************
// Testing finished. Tear down Video Engine
//***************************************************************
// ***************************************************************
// Testing finished. Tear down Video Engine
// ***************************************************************
// Shut down
error = ptrViEBase->StopReceive(videoChannel);
@ -358,8 +289,7 @@ int ViEAutoTest::ViEBaseStandardTest()
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
if (numberOfErrors > 0)
{
if (numberOfErrors > 0) {
// Test failed
ViETest::Log(" ");
ViETest::Log(" ERROR ViEBase Standard Test FAILED!");
@ -376,8 +306,7 @@ int ViEAutoTest::ViEBaseStandardTest()
return 0;
}
int ViEAutoTest::ViEBaseExtendedTest()
{
int ViEAutoTest::ViEBaseExtendedTest() {
// Start with standard test
ViEBaseAPITest();
ViEBaseStandardTest();
@ -394,16 +323,14 @@ int ViEAutoTest::ViEBaseExtendedTest()
return 0;
}
int ViEAutoTest::ViEBaseAPITest()
{
int ViEAutoTest::ViEBaseAPITest() {
ViETest::Log(" ");
ViETest::Log("========================================");
ViETest::Log(" ViEBase API Test");
//***************************************************************
// Begin create/initialize WebRTC Video Engine for testing
//***************************************************************
// ***************************************************************
// Begin create/initialize WebRTC Video Engine for testing
// ***************************************************************
int error = 0;
int numberOfErrors = 0;
@ -429,9 +356,9 @@ int ViEAutoTest::ViEBaseAPITest()
ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEBase != NULL);
//***************************************************************
// Engine ready. Begin testing class
//***************************************************************
// ***************************************************************
// Engine ready. Begin testing class
// ***************************************************************
char version[1024] = "";
error = ptrViEBase->GetVersion(version);
@ -515,9 +442,9 @@ int ViEAutoTest::ViEBaseAPITest()
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
//***************************************************************
// Testing finished. Tear down Video Engine
//***************************************************************
// ***************************************************************
// Testing finished. Tear down Video Engine
// ***************************************************************
error = ptrViEBase->DisconnectAudioChannel(videoChannel + 5);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
@ -556,8 +483,7 @@ int ViEAutoTest::ViEBaseAPITest()
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
if (numberOfErrors > 0)
{
if (numberOfErrors > 0) {
ViETest::Log(" ");
ViETest::Log(" ERROR ViEBase API Test FAILED! ");
ViETest::Log(" Number of errors: %d", numberOfErrors);
@ -574,3 +500,48 @@ int ViEAutoTest::ViEBaseAPITest()
return 0;
}
void ViEAutoTest::FindCaptureDeviceOnSystem(
webrtc::ViECapture* capture,
WebRtc_UWord8* device_name,
unsigned int device_name_length,
int* device_id,
int* number_of_errors,
webrtc::VideoCaptureModule** device_video) {
bool capture_device_set = false;
webrtc::VideoCaptureModule::DeviceInfo *dev_info =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
const unsigned int kMaxUniqueIdLength = 256;
WebRtc_UWord8 unique_id[kMaxUniqueIdLength];
memset(unique_id, 0, kMaxUniqueIdLength);
for (unsigned int i = 0; i < dev_info->NumberOfDevices(); i++) {
int error = dev_info->GetDeviceName(i, device_name, device_name_length,
unique_id, kMaxUniqueIdLength);
*number_of_errors += ViETest::TestError(
error == 0, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
*device_video =
webrtc::VideoCaptureFactory::Create(4571, unique_id);
*number_of_errors += ViETest::TestError(
*device_video != NULL, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
(*device_video)->AddRef();
error = capture->AllocateCaptureDevice(**device_video, *device_id);
if (error == 0) {
ViETest::Log("Using capture device: %s, captureId: %d.",
device_name, *device_id);
capture_device_set = true;
break;
} else {
(*device_video)->Release();
(*device_video) = NULL;
}
}
delete dev_info;
*number_of_errors += ViETest::TestError(
capture_device_set, "ERROR: %s at line %d - Could not set capture device",
__FUNCTION__, __LINE__);
}

View File

@ -24,36 +24,29 @@
#include "critical_section_wrapper.h"
#include "thread_wrapper.h"
ViEAutoTestWindowManager::ViEAutoTestWindowManager() :
_hdsp1(NULL),
_hdsp2(NULL)
{
ViEAutoTestWindowManager::ViEAutoTestWindowManager()
: _hdsp1(NULL),
_hdsp2(NULL) {
}
ViEAutoTestWindowManager::~ViEAutoTestWindowManager()
{
ViEAutoTestWindowManager::~ViEAutoTestWindowManager() {
TerminateWindows();
}
void* ViEAutoTestWindowManager::GetWindow1()
{
return (void*) _hwnd1;
void* ViEAutoTestWindowManager::GetWindow1() {
return reinterpret_cast<void*>(_hwnd1);
}
void* ViEAutoTestWindowManager::GetWindow2()
{
return (void*) _hwnd2;
void* ViEAutoTestWindowManager::GetWindow2() {
return reinterpret_cast<void*>(_hwnd2);
}
int ViEAutoTestWindowManager::TerminateWindows()
{
if (_hdsp1)
{
int ViEAutoTestWindowManager::TerminateWindows() {
if (_hdsp1) {
ViEDestroyWindow(&_hwnd1, _hdsp1);
_hdsp1 = NULL;
}
if (_hdsp2)
{
if (_hdsp2) {
ViEDestroyWindow(&_hwnd2, _hdsp2);
_hdsp2 = NULL;
}
@ -63,14 +56,15 @@ int ViEAutoTestWindowManager::TerminateWindows()
int ViEAutoTestWindowManager::CreateWindows(AutoTestRect window1Size,
AutoTestRect window2Size,
void* window1Title,
void* window2Title)
{
void* window2Title) {
ViECreateWindow(&_hwnd1, &_hdsp1, window1Size.origin.x,
window1Size.origin.y, window1Size.size.width,
window1Size.size.height, (char*) window1Title);
window1Size.size.height,
reinterpret_cast<char*>(window1Title));
ViECreateWindow(&_hwnd2, &_hdsp2, window2Size.origin.x,
window2Size.origin.y, window2Size.size.width,
window2Size.size.height, (char*) window2Title);
window2Size.size.height,
reinterpret_cast<char*>(window2Title));
return 0;
}
@ -78,13 +72,12 @@ int ViEAutoTestWindowManager::CreateWindows(AutoTestRect window1Size,
int ViEAutoTestWindowManager::ViECreateWindow(Window *outWindow,
Display **outDisplay, int xpos,
int ypos, int width, int height,
char* title)
{
char* title) {
int screen;
XEvent evnt;
XSetWindowAttributes xswa; // window attribute struct
XVisualInfo vinfo; // screen visual info struct
unsigned long mask; // attribute mask
XSetWindowAttributes xswa; // window attribute struct
XVisualInfo vinfo; // screen visual info struct
unsigned long mask; // attribute mask
// get connection handle to xserver
Display* _display = XOpenDisplay(NULL);
@ -93,10 +86,9 @@ int ViEAutoTestWindowManager::ViECreateWindow(Window *outWindow,
screen = DefaultScreen(_display);
// put desired visual info for the screen in vinfo
// TODO: more display settings should be allowed
if (XMatchVisualInfo(_display, screen, 24, TrueColor, &vinfo) != 0)
{
//printf( "Screen visual info match!\n" );
// TODO(unknown): more display settings should be allowed
if (XMatchVisualInfo(_display, screen, 24, TrueColor, &vinfo) != 0) {
// printf( "Screen visual info match!\n" );
}
// set window attributes
xswa.colormap = XCreateColormap(_display, DefaultRootWindow(_display),
@ -123,10 +115,8 @@ int ViEAutoTestWindowManager::ViECreateWindow(Window *outWindow,
XMapWindow(_display, _window);
// wait for map event
do
{
do {
XNextEvent(_display, &evnt);
} while (evnt.type != MapNotify || evnt.xmap.event != _window);
*outWindow = _window;
@ -134,21 +124,19 @@ int ViEAutoTestWindowManager::ViECreateWindow(Window *outWindow,
return 0;
}
int ViEAutoTestWindowManager::ViEDestroyWindow(Window *window, Display *display)
{
int ViEAutoTestWindowManager::ViEDestroyWindow(Window *window,
Display *display) {
XUnmapWindow(display, *window);
XDestroyWindow(display, *window);
XSync(display, false);
return 0;
}
bool ViEAutoTestWindowManager::SetTopmostWindow()
{
bool ViEAutoTestWindowManager::SetTopmostWindow() {
return 0;
}
int main(int argc, char** argv)
{
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.

View File

@ -13,29 +13,29 @@
*
*/
#include "vie_window_creator.h"
#include "vie_autotest_window_manager_interface.h"
#include "vie_autotest.h"
#include "vie_autotest_main.h"
ViEAutoTestMain::ViEAutoTestMain() :
_answers(),
_answersCount(0),
_useAnswerFile()
{
#include "vie_autotest_window_manager_interface.h"
#include "vie_window_creator.h"
#include "vie_autotest.h"
ViEAutoTestMain::ViEAutoTestMain()
: _answers(),
_answersCount(0),
_useAnswerFile() {
}
bool ViEAutoTestMain::BeginOSIndependentTesting()
{
bool ViEAutoTestMain::BeginOSIndependentTesting() {
// Create the windows
ViEWindowCreator windowCreator;
ViEAutoTestWindowManagerInterface* windowManager =
windowCreator.CreateTwoWindows();
// Create the test cases
ViEAutoTest vieAutoTest(windowManager->GetWindow1(),
windowManager->GetWindow2());
ViEAutoTest
vieAutoTest(windowManager->GetWindow1(),
windowManager->GetWindow2(),
ViETest::kUseAssertsForTestErrors);
ViETest::Log(" ============================== ");
ViETest::Log(" WebRTC ViE 3.x Autotest ");
@ -43,8 +43,7 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
int testType = 0;
int testErrors = 0;
do
{
do {
ViETest::Log("Test types: ");
ViETest::Log("\t 0. Quit");
ViETest::Log("\t 1. All standard tests (delivery test)");
@ -58,14 +57,10 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
ViETest::Log("\t 9. Simulcast in loopback");
ViETest::Log("Select type of test: ");
if (_useAnswerFile)
{
//GetNextAnswer(str);
}
else
{
if (scanf("%d", &testType) <= 0)
{
if (_useAnswerFile) {
// GetNextAnswer(str);
} else {
if (scanf("%d", &testType) <= 0) {
ViETest::Log("ERROR: unable to read selection. Try again\n");
testType = -1;
getchar();
@ -74,8 +69,13 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
getchar();
}
ViETest::Log("");
switch (testType)
{
if (testType < 0 || testType > 8) {
ViETest::Log("ERROR: Invalid selection. Try again\n");
continue;
}
switch (testType) {
case 0:
break;
@ -83,13 +83,10 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
{
int deliveryErrors = testErrors;
testErrors += vieAutoTest.ViEStandardTest();
if (testErrors == deliveryErrors)
{
if (testErrors == deliveryErrors) {
// No errors found in delivery test, create delivery
ViETest::Log("Standard/delivery passed.");
}
else
{
} else {
// Didn't pass, don't create delivery files
ViETest::Log("\nStandard/delivery test failed!\n");
}
@ -103,44 +100,43 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
testErrors += vieAutoTest.ViEExtendedTest();
break;
case 4: // specific Standard
case 4: // Specific Standard
testType = GetClassTestSelection();
switch (testType)
{
case 1: // base
switch (testType) {
case 1: // base
testErrors += vieAutoTest.ViEBaseStandardTest();
break;
case 2: // capture
case 2: // capture
testErrors += vieAutoTest.ViECaptureStandardTest();
break;
case 3: // codec
case 3: // codec
testErrors += vieAutoTest.ViECodecStandardTest();
break;
case 5: //encryption
case 5: // encryption
testErrors += vieAutoTest.ViEEncryptionStandardTest();
break;
case 6: // file
case 6: // file
testErrors += vieAutoTest.ViEFileStandardTest();
break;
case 7: // image process
case 7: // image process
testErrors += vieAutoTest.ViEImageProcessStandardTest();
break;
case 8: // network
case 8: // network
testErrors += vieAutoTest.ViENetworkStandardTest();
break;
case 9: // Render
case 9: // Render
testErrors += vieAutoTest.ViERenderStandardTest();
break;
case 10: // RTP/RTCP
case 10: // RTP/RTCP
testErrors += vieAutoTest.ViERtpRtcpStandardTest();
break;
case 11:
@ -151,91 +147,88 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
}
break;
case 5: // specific API
case 5: // specific API
testType = GetClassTestSelection();
switch (testType)
{
case 1: // base
switch (testType) {
case 1: // base
testErrors += vieAutoTest.ViEBaseAPITest();
break;
case 2: // capture
case 2: // capture
testErrors += vieAutoTest.ViECaptureAPITest();
break;
case 3: // codec
case 3: // codec
testErrors += vieAutoTest.ViECodecAPITest();
break;
case 5: //encryption
case 5: // encryption
testErrors += vieAutoTest.ViEEncryptionAPITest();
break;
case 6: // file
case 6: // file
testErrors += vieAutoTest.ViEFileAPITest();
break;
case 7: // image process
case 7: // image process
testErrors += vieAutoTest.ViEImageProcessAPITest();
break;
case 8: // network
case 8: // network
testErrors += vieAutoTest.ViENetworkAPITest();
break;
case 9: // Render
case 9: // Render
testErrors += vieAutoTest.ViERenderAPITest();
break;
case 10: // RTP/RTCP
case 10: // RTP/RTCP
testErrors += vieAutoTest.ViERtpRtcpAPITest();
break;
case 11:
break;
default:
break;
}
break;
case 6: // specific extended
case 6: // specific extended
testType = GetClassTestSelection();
switch (testType)
{
case 1: // base
switch (testType) {
case 1: // base
testErrors += vieAutoTest.ViEBaseExtendedTest();
break;
case 2: // capture
case 2: // capture
testErrors += vieAutoTest.ViECaptureExtendedTest();
break;
case 3: // codec
case 3: // codec
testErrors += vieAutoTest.ViECodecExtendedTest();
break;
case 5: //encryption
case 5: // encryption
testErrors += vieAutoTest.ViEEncryptionExtendedTest();
break;
case 6: // file
case 6: // file
testErrors += vieAutoTest.ViEFileExtendedTest();
break;
case 7: // image process
case 7: // image process
testErrors += vieAutoTest.ViEImageProcessExtendedTest();
break;
case 8: // network
case 8: // network
testErrors += vieAutoTest.ViENetworkExtendedTest();
break;
case 9: // Render
case 9: // Render
testErrors += vieAutoTest.ViERenderExtendedTest();
break;
case 10: // RTP/RTCP
case 10: // RTP/RTCP
testErrors += vieAutoTest.ViERtpRtcpExtendedTest();
break;
case 11:
@ -262,31 +255,27 @@ bool ViEAutoTestMain::BeginOSIndependentTesting()
windowCreator.TerminateWindows();
if (testErrors)
{
if (testErrors) {
ViETest::Log("Test done with errors, see ViEAutotestLog.txt for test "
"result.\n");
}
else
{
} else {
ViETest::Log("Test done without errors, see ViEAutotestLog.txt for "
"test result.\n");
}
printf("Press enter to quit...");
char c;
while ((c = getchar()) != '\n' && c != EOF)
/* discard */;
while ((c = getchar()) != '\n' && c != EOF) {
/* discard */
}
return true;
}
int ViEAutoTestMain::GetClassTestSelection()
{
int ViEAutoTestMain::GetClassTestSelection() {
int testType = 0;
std::string answer;
while (1)
{
while (1) {
ViETest::Log("Choose specific test: ");
ViETest::Log("\t 1. Base ");
ViETest::Log("\t 2. Capture");
@ -301,18 +290,14 @@ int ViEAutoTestMain::GetClassTestSelection()
ViETest::Log("Select type of test: ");
int items_read = 0;
if (_useAnswerFile)
{
//GetNextAnswer(answer);
}
else
{
if (_useAnswerFile) {
// GetNextAnswer(answer);
} else {
items_read = scanf("%d", &testType);
getchar();
}
ViETest::Log("\n");
if (items_read == 1 && testType >= 1 && testType <= 13)
{
if (items_read == 1 && testType >= 1 && testType <= 13) {
return testType;
}
ViETest::Log("ERROR: Invalid selection. Try again");
@ -321,25 +306,20 @@ int ViEAutoTestMain::GetClassTestSelection()
return -1;
}
bool ViEAutoTestMain::GetAnswer(int index, std::string& answer)
{
if (!_useAnswerFile || index > _answersCount)
{
bool ViEAutoTestMain::GetAnswer(int index, std::string* answer) {
if (!_useAnswerFile || index > _answersCount) {
return false;
}
answer = _answers[index];
*answer = _answers[index];
return true;
}
bool ViEAutoTestMain::IsUsingAnswerFile()
{
bool ViEAutoTestMain::IsUsingAnswerFile() {
return _useAnswerFile;
}
// TODO: write without stl
bool ViEAutoTestMain::UseAnswerFile(const char* fileName)
{
// TODO(unknown): write without stl
bool ViEAutoTestMain::UseAnswerFile(const char* fileName) {
return false;
/*
_useAnswerFile = false;

View File

@ -46,6 +46,9 @@
'helpers/vie_window_creator.cc',
# New, fully automated tests
'automated/vie_api_integration_test.cc',
'automated/vie_extended_integration_test.cc',
'automated/vie_integration_test_base.cc',
'automated/vie_standard_integration_test.cc',
# Platform independent