Rewrote the hardware-before-streaming test.

Restructured the test hierarchy somewhat - there is now a fixture for before-voe-init time and one for after-voe-init time.

Rewrote the hardware-before-streaming test.
Separated unrelated tests out from the rtp_rtcp tests.

BUG=
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1184 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2011-12-14 13:55:34 +00:00
parent fbf5af444b
commit 667eca6290
10 changed files with 336 additions and 223 deletions

View File

@ -0,0 +1,36 @@
/*
* 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 "after_initialization_fixture.h"
class TestErrorObserver : public webrtc::VoiceEngineObserver {
public:
TestErrorObserver() {}
virtual ~TestErrorObserver() {}
void CallbackOnError(const int channel, const int error_code) {
ADD_FAILURE() << "Unexpected error on channel " << channel <<
": error code " << error_code;
}
};
AfterInitializationFixture::AfterInitializationFixture()
: error_observer_(new TestErrorObserver()) {
EXPECT_EQ(0, voe_base_->Init());
#if defined(WEBRTC_ANDROID)
EXPECT_EQ(0, voe_hardware_->SetLoudspeakerStatus(false));
#endif
EXPECT_EQ(0, voe_base_->RegisterVoiceEngineObserver(*error_observer_));
}
AfterInitializationFixture::~AfterInitializationFixture() {
EXPECT_EQ(0, voe_base_->DeRegisterVoiceEngineObserver());
}

View File

@ -0,0 +1,30 @@
/*
* 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_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
#define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
#include "before_initialization_fixture.h"
#include "scoped_ptr.h"
class TestErrorObserver;
// This fixture initializes the voice engine in addition to the work
// done by the before-initialization fixture. It also registers an error
// observer which will fail tests on error callbacks.
class AfterInitializationFixture : public BeforeInitializationFixture {
public:
AfterInitializationFixture();
virtual ~AfterInitializationFixture();
protected:
webrtc::scoped_ptr<TestErrorObserver> error_observer_;
};
#endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_

View File

@ -0,0 +1,50 @@
/*
* 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 "before_initialization_fixture.h"
BeforeInitializationFixture::BeforeInitializationFixture()
: voice_engine_(webrtc::VoiceEngine::Create()) {
EXPECT_TRUE(voice_engine_ != NULL);
voe_base_ = webrtc::VoEBase::GetInterface(voice_engine_);
voe_codec_ = webrtc::VoECodec::GetInterface(voice_engine_);
voe_volume_control_ = webrtc::VoEVolumeControl::GetInterface(voice_engine_);
voe_dtmf_ = webrtc::VoEDtmf::GetInterface(voice_engine_);
voe_rtp_rtcp_ = webrtc::VoERTP_RTCP::GetInterface(voice_engine_);
voe_apm_ = webrtc::VoEAudioProcessing::GetInterface(voice_engine_);
voe_network_ = webrtc::VoENetwork::GetInterface(voice_engine_);
voe_file_ = webrtc::VoEFile::GetInterface(voice_engine_);
voe_vsync_ = webrtc::VoEVideoSync::GetInterface(voice_engine_);
voe_encrypt_ = webrtc::VoEEncryption::GetInterface(voice_engine_);
voe_hardware_ = webrtc::VoEHardware::GetInterface(voice_engine_);
voe_xmedia_ = webrtc::VoEExternalMedia::GetInterface(voice_engine_);
voe_call_report_ = webrtc::VoECallReport::GetInterface(voice_engine_);
voe_neteq_stats_ = webrtc::VoENetEqStats::GetInterface(voice_engine_);
}
BeforeInitializationFixture::~BeforeInitializationFixture() {
EXPECT_EQ(0, voe_base_->Release());
EXPECT_EQ(0, voe_codec_->Release());
EXPECT_EQ(0, voe_volume_control_->Release());
EXPECT_EQ(0, voe_dtmf_->Release());
EXPECT_EQ(0, voe_rtp_rtcp_->Release());
EXPECT_EQ(0, voe_apm_->Release());
EXPECT_EQ(0, voe_network_->Release());
EXPECT_EQ(0, voe_file_->Release());
EXPECT_EQ(0, voe_vsync_->Release());
EXPECT_EQ(0, voe_encrypt_->Release());
EXPECT_EQ(0, voe_hardware_->Release());
EXPECT_EQ(0, voe_xmedia_->Release());
EXPECT_EQ(0, voe_call_report_->Release());
EXPECT_EQ(0, voe_neteq_stats_->Release());
EXPECT_TRUE(webrtc::VoiceEngine::Delete(voice_engine_));
}

View File

@ -14,6 +14,7 @@
#include <assert.h>
#include "common_types.h"
#include "engine_configurations.h"
#include "voe_audio_processing.h"
#include "voe_base.h"
#include "voe_call_report.h"
@ -38,54 +39,21 @@
#include "gtest/gtest.h"
#include "gmock/gmock.h"
// This convenience class sets up all the VoE interfaces automatically for
// This convenient fixture sets up all voice engine interfaces automatically for
// use by testing subclasses. It allocates each interface and releases it once
// which means that if a tests allocates additional interfaces from the voice
// engine and forgets to release it, this test will fail in the destructor.
class TestBase : public testing::Test {
// It will not call any init methods.
//
// Implementation note:
// The interface fetching is done in the constructor and not SetUp() since
// this relieves our subclasses from calling SetUp in the superclass if they
// choose to override SetUp() themselves. This is fine as googletest will
// construct new test objects for each method.
class BeforeInitializationFixture : public testing::Test {
public:
// The interface fetching is done in the constructor and not SetUp() since
// this relieves our subclasses from calling SetUp in the superclass if they
// choose to override SetUp() themselves. This is fine as googletest will
// construct new test objects for each method.
TestBase() {
voice_engine_ = webrtc::VoiceEngine::Create();
EXPECT_TRUE(voice_engine_ != NULL);
voe_base_ = webrtc::VoEBase::GetInterface(voice_engine_);
voe_codec_ = webrtc::VoECodec::GetInterface(voice_engine_);
voe_volume_control_ = webrtc::VoEVolumeControl::GetInterface(voice_engine_);
voe_dtmf_ = webrtc::VoEDtmf::GetInterface(voice_engine_);
voe_rtp_rtcp_ = webrtc::VoERTP_RTCP::GetInterface(voice_engine_);
voe_apm_ = webrtc::VoEAudioProcessing::GetInterface(voice_engine_);
voe_network_ = webrtc::VoENetwork::GetInterface(voice_engine_);
voe_file_ = webrtc::VoEFile::GetInterface(voice_engine_);
voe_vsync_ = webrtc::VoEVideoSync::GetInterface(voice_engine_);
voe_encrypt_ = webrtc::VoEEncryption::GetInterface(voice_engine_);
voe_hardware_ = webrtc::VoEHardware::GetInterface(voice_engine_);
voe_xmedia_ = webrtc::VoEExternalMedia::GetInterface(voice_engine_);
voe_call_report_ = webrtc::VoECallReport::GetInterface(voice_engine_);
voe_neteq_stats_ = webrtc::VoENetEqStats::GetInterface(voice_engine_);
}
virtual ~TestBase() {
EXPECT_EQ(0, voe_base_->Release());
EXPECT_EQ(0, voe_codec_->Release());
EXPECT_EQ(0, voe_volume_control_->Release());
EXPECT_EQ(0, voe_dtmf_->Release());
EXPECT_EQ(0, voe_rtp_rtcp_->Release());
EXPECT_EQ(0, voe_apm_->Release());
EXPECT_EQ(0, voe_network_->Release());
EXPECT_EQ(0, voe_file_->Release());
EXPECT_EQ(0, voe_vsync_->Release());
EXPECT_EQ(0, voe_encrypt_->Release());
EXPECT_EQ(0, voe_hardware_->Release());
EXPECT_EQ(0, voe_xmedia_->Release());
EXPECT_EQ(0, voe_call_report_->Release());
EXPECT_EQ(0, voe_neteq_stats_->Release());
EXPECT_TRUE(webrtc::VoiceEngine::Delete(voice_engine_));
}
BeforeInitializationFixture();
virtual ~BeforeInitializationFixture();
protected:
webrtc::VoiceEngine* voice_engine_;

View File

@ -9,11 +9,11 @@
*/
#include "common_types.h"
#include "test_base.h"
#include "before_initialization_fixture.h"
using namespace webrtc;
class HardwareBeforeInitializingTest : public TestBase {
class HardwareBeforeInitializingTest : public BeforeInitializationFixture {
};
TEST_F(HardwareBeforeInitializingTest,

View File

@ -0,0 +1,161 @@
/*
* 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 <cstring>
#include "after_initialization_fixture.h"
using namespace webrtc;
static const char* kNoDevicesErrorMessage =
"Either you have no recording / playout device "
"on your system, or the method failed.";
class HardwareBeforeStreamingTest : public AfterInitializationFixture {
};
// Tests that apply to both mobile and desktop:
TEST_F(HardwareBeforeStreamingTest,
SetAudioDeviceLayerFailsSinceTheVoiceEngineHasBeenInitialized) {
EXPECT_NE(0, voe_hardware_->SetAudioDeviceLayer(kAudioPlatformDefault));
EXPECT_EQ(VE_ALREADY_INITED, voe_base_->LastError());
}
TEST_F(HardwareBeforeStreamingTest,
GetCPULoadSucceedsOnWindowsButNotOtherPlatforms) {
int load_percent;
#if defined(_WIN32)
EXPECT_EQ(0, voe_hardware_->GetCPULoad(load_percent));
#else
EXPECT_NE(0, voe_hardware_->GetCPULoad(load_percent)) <<
"Should fail on non-Windows platforms.";
#endif
}
// Tests that only apply to mobile:
#ifdef MAC_IPHONE
TEST_F(HardwareBeforeStreamingTest, ResetsAudioDeviceOnIphone) {
EXPECT_EQ(0, voe_hardware_->ResetAudioDevice());
}
#endif
// Tests that only apply to desktop:
#if !defined(MAC_IPHONE) & !defined(WEBRTC_ANDROID)
TEST_F(HardwareBeforeStreamingTest, GetSystemCpuLoadSucceeds) {
int load_percent;
EXPECT_EQ(0, voe_hardware_->GetSystemCPULoad(load_percent));
}
TEST_F(HardwareBeforeStreamingTest, GetPlayoutDeviceStatusReturnsTrue) {
bool play_available = false;
EXPECT_EQ(0, voe_hardware_->GetPlayoutDeviceStatus(play_available));
ASSERT_TRUE(play_available) <<
"Ensures that the method works and that hardware is in the right state.";
}
TEST_F(HardwareBeforeStreamingTest, GetRecordingDeviceStatusReturnsTrue) {
bool recording_available = false;
EXPECT_EQ(0, voe_hardware_->GetRecordingDeviceStatus(recording_available));
EXPECT_TRUE(recording_available) <<
"Ensures that the method works and that hardware is in the right state.";
}
// Win, Mac and Linux sound device tests.
TEST_F(HardwareBeforeStreamingTest,
GetRecordingDeviceNameRetrievesDeviceNames) {
char device_name[128] = {0};
char guid_name[128] = {0};
#if defined(_WIN32)
EXPECT_EQ(0, voe_hardware_->GetRecordingDeviceName(
-1, device_name, guid_name));
EXPECT_GT(strlen(device_name), 0u) << kNoDevicesErrorMessage;
device_name[0] = '\0';
EXPECT_EQ(0, voe_hardware_->GetPlayoutDeviceName(
-1, device_name, guid_name));
EXPECT_GT(strlen(device_name), 0u) << kNoDevicesErrorMessage;
#else
EXPECT_EQ(0, voe_hardware_->GetRecordingDeviceName(
0, device_name, guid_name));
EXPECT_GT(strlen(device_name), 0u) << kNoDevicesErrorMessage;
device_name[0] = '\0';
EXPECT_EQ(0, voe_hardware_->GetPlayoutDeviceName(
0, device_name, guid_name));
EXPECT_GT(strlen(device_name), 0u) << kNoDevicesErrorMessage;
#endif // !WIN32
}
TEST_F(HardwareBeforeStreamingTest,
AllEnumeratedRecordingDevicesCanBeSetAsRecordingDevice) {
// Check recording side.
// Extended Win32 enumeration tests: unique GUID outputs on Vista and up:
// Win XP and below : device_name is copied to guid_name.
// Win Vista and up : device_name is the friendly name and GUID is a unique
// identifier.
// Other : guid_name is left unchanged.
int num_of_recording_devices = 0;
EXPECT_EQ(0, voe_hardware_->GetNumOfRecordingDevices(
num_of_recording_devices));
EXPECT_GT(num_of_recording_devices, 0) << kNoDevicesErrorMessage;
char device_name[128] = {0};
char guid_name[128] = {0};
for (int i = 0; i < num_of_recording_devices; i++) {
EXPECT_EQ(0, voe_hardware_->GetRecordingDeviceName(
i, device_name, guid_name));
EXPECT_GT(strlen(device_name), 0u) <<
"There should be no empty device names "
"among the ones the system gives us.";
EXPECT_EQ(0, voe_hardware_->SetRecordingDevice(i));
}
}
TEST_F(HardwareBeforeStreamingTest,
AllEnumeratedPlayoutDevicesCanBeSetAsPlayoutDevice) {
// Check playout side (see recording side test for more info on GUIDs).
int num_of_playout_devices = 0;
EXPECT_EQ(0, voe_hardware_->GetNumOfPlayoutDevices(
num_of_playout_devices));
EXPECT_GT(num_of_playout_devices, 0) << kNoDevicesErrorMessage;
char device_name[128] = {0};
char guid_name[128] = {0};
for (int i = 0; i < num_of_playout_devices; ++i) {
EXPECT_EQ(0, voe_hardware_->GetPlayoutDeviceName(
i, device_name, guid_name));
EXPECT_GT(strlen(device_name), 0u) <<
"There should be no empty device names "
"among the ones the system gives us.";
EXPECT_EQ(0, voe_hardware_->SetPlayoutDevice(i));
}
}
TEST_F(HardwareBeforeStreamingTest,
SetDeviceWithMagicalArgumentsSetsDefaultSoundDevices) {
#ifdef _WIN32
// -1 means "default device" on Windows.
EXPECT_EQ(0, voe_hardware_->SetRecordingDevice(-1));
EXPECT_EQ(0, voe_hardware_->SetPlayoutDevice(-1));
#else
EXPECT_EQ(0, voe_hardware_->SetRecordingDevice(0));
EXPECT_EQ(0, voe_hardware_->SetPlayoutDevice(0));
#endif
}
#endif // !defined(MAC_IPHONE) & !defined(WEBRTC_ANDROID)

View File

@ -8,25 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "test_base.h"
#include "after_initialization_fixture.h"
using namespace webrtc;
using namespace testing;
class TestErrorObserver : public VoiceEngineObserver {
public:
TestErrorObserver() {}
virtual ~TestErrorObserver() {}
void CallbackOnError(const int channel, const int error_code) {
ADD_FAILURE() << "Unexpected error on channel " << channel <<
": error code " << error_code;
}
};
class RtpRtcpBeforeStreamingTest : public TestBase {
class RtpRtcpBeforeStreamingTest : public AfterInitializationFixture {
protected:
TestErrorObserver error_observer_;
void SetUp();
void TearDown();
@ -34,39 +22,16 @@ class RtpRtcpBeforeStreamingTest : public TestBase {
};
void RtpRtcpBeforeStreamingTest::SetUp() {
#if defined BLACKFIN
EXPECT_EQ(0, voe_base_->Init(0, LINUX_AUDIO_OSS));
#else
EXPECT_EQ(0, voe_base_->Init());
#endif
#if defined(WEBRTC_ANDROID)
EXPECT_EQ(0, voe_hardware_->SetLoudspeakerStatus(false));
#endif
// Ensure we have an error observer and a channel up.
EXPECT_EQ(0, voe_base_->RegisterVoiceEngineObserver(error_observer_));
EXPECT_THAT(channel_ = voe_base_->CreateChannel(), Not(Lt(0)));
}
void RtpRtcpBeforeStreamingTest::TearDown() {
EXPECT_EQ(0, voe_base_->DeleteChannel(channel_));
EXPECT_EQ(0, voe_base_->DeRegisterVoiceEngineObserver());
}
TEST_F(RtpRtcpBeforeStreamingTest, MaxNumChannelsIsBiggerThanZero) {
EXPECT_GT(voe_base_->MaxNumOfChannels(), 0);
}
TEST_F(RtpRtcpBeforeStreamingTest, GetVersionPrintsSomeUsefulInformation) {
char char_buffer[1024];
EXPECT_EQ(0, voe_base_->GetVersion(char_buffer));
EXPECT_THAT(char_buffer, ContainsRegex("VoiceEngine [0-9].[0-9].[0-9]"));
}
TEST_F(RtpRtcpBeforeStreamingTest,
GetRtcpStatusReturnsTrueByDefaultAndObeysSetRtcpStatus) {
bool on;
bool on = false;
EXPECT_EQ(0, voe_rtp_rtcp_->GetRTCPStatus(channel_, on));
EXPECT_TRUE(on);
EXPECT_EQ(0, voe_rtp_rtcp_->SetRTCPStatus(channel_, false));

View File

@ -0,0 +1,26 @@
/*
* 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 "before_initialization_fixture.h"
class VoeBaseMiscTest : public BeforeInitializationFixture {
};
using namespace testing;
TEST_F(VoeBaseMiscTest, MaxNumChannelsIs32) {
EXPECT_EQ(32, voe_base_->MaxNumOfChannels());
}
TEST_F(VoeBaseMiscTest, GetVersionPrintsSomeUsefulInformation) {
char char_buffer[1024];
EXPECT_EQ(0, voe_base_->GetVersion(char_buffer));
EXPECT_THAT(char_buffer, ContainsRegex("VoiceEngine [0-9].[0-9].[0-9]"));
}

View File

@ -902,6 +902,12 @@ int VoETestManager::SetUp() {
TEST_MUSTPASS(voe_base_->Init());
#if defined(WEBRTC_ANDROID)
TEST_MUSTPASS(voe_hardware_->SetLoudspeakerStatus(false));
#endif
TEST_MUSTPASS(voe_base_->RegisterVoiceEngineObserver(obs));
TEST_LOG("Get version \n");
TEST_MUSTPASS(voe_base_->GetVersion(char_buffer));
TEST_LOG("--------------------\n%s\n--------------------\n", char_buffer);
@ -915,144 +921,6 @@ int VoETestManager::SetUp() {
return 0;
}
int VoETestManager::TestHardwareBeforeStreaming() {
#ifdef _TEST_HARDWARE_
TEST_LOG("\n\n+++ Hardware tests +++\n\n");
AudioLayers wanted_layer = TESTED_AUDIO_LAYER;
AudioLayers given_layer;
TEST_LOG("Set/Get audio device layer\n");
TEST_MUSTPASS(-1 != voe_hardware_->SetAudioDeviceLayer(wanted_layer));
TEST_MUSTPASS(VE_ALREADY_INITED != voe_base_->LastError());
TEST_MUSTPASS(voe_hardware_->GetAudioDeviceLayer(given_layer));
switch (given_layer) {
case kAudioPlatformDefault:
// Already set above.
break;
case kAudioWindowsCore:
TEST_LOG("Running kAudioWindowsCore\n");
break;
case kAudioWindowsWave:
TEST_LOG("Running kAudioWindowsWave\n");
break;
case kAudioLinuxAlsa:
TEST_LOG("Running kAudioLinuxAlsa\n");
break;
case kAudioLinuxPulse:
TEST_LOG("Running kAudioLinuxPulse\n");
break;
default:
TEST_LOG("ERROR: Running unknown audio layer!!\n");
return -1;
}
int load_percent;
#if defined(_WIN32)
TEST_LOG("CPU load \n");
TEST_MUSTPASS(voe_hardware_->GetCPULoad(load_percent));
TEST_LOG("GetCPULoad => %d%%\n", load_percent);
#else
TEST_MUSTPASS(!voe_hardware_->GetCPULoad(load_percent));
#endif
#if !defined(MAC_IPHONE) & !defined(WEBRTC_ANDROID)
TEST_MUSTPASS(voe_hardware_->GetSystemCPULoad(load_percent));
TEST_LOG("GetSystemCPULoad => %d%%\n", load_percent);
#endif
#if !defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID)
bool play_available = false;
bool recording_available = false;
TEST_LOG("Get device status \n");
TEST_MUSTPASS(voe_hardware_->GetPlayoutDeviceStatus(play_available));
TEST_MUSTPASS(voe_hardware_->GetRecordingDeviceStatus(recording_available));
TEST_MUSTPASS(!(recording_available && play_available));
#endif
// Win, Mac and Linux sound device tests.
#if (defined(WEBRTC_MAC) && !defined(MAC_IPHONE)) || defined(_WIN32) || \
(defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID))
char device_name[128] = {0};
char guid_name[128] = {0};
TEST_LOG("Printing names of default sound devices \n");
#if defined(_WIN32)
TEST_MUSTPASS(voe_hardware_->GetRecordingDeviceName(-1, device_name,
guid_name));
TEST_LOG("Recording device= %s, guid=%s\n", device_name, guid_name);
TEST_MUSTPASS(voe_hardware_->GetPlayoutDeviceName(-1, device_name,
guid_name));
TEST_LOG("Playout device= %s, guid=%s\n", device_name, guid_name);
#else
TEST_MUSTPASS(voe_hardware_->GetRecordingDeviceName(0, device_name,
guid_name));
TEST_LOG("Recording device= %s\n",device_name);
TEST_MUSTPASS(voe_hardware_->GetPlayoutDeviceName(0, device_name,
guid_name));
TEST_LOG("Playout device= %s\n",device_name);
#endif
// Check recording side.
// Extended Win32 enumeration tests: unique GUID outputs on Vista and up:
// Win XP and below : device_name is copied to guid_name.
// Win Vista and up : device_name is the friendly name and GUID is a unique
// identifier.
// Other : guid_name is left unchanged.
int num_of_recording_devices = 0;
TEST_MUSTPASS(voe_hardware_->GetNumOfRecordingDevices(
num_of_recording_devices));
TEST_LOG("GetNumOfRecordingDevices = %d\n", num_of_recording_devices);
for (int i = 0; i < num_of_recording_devices; i++) {
TEST_MUSTPASS(voe_hardware_->GetRecordingDeviceName(i, device_name,
guid_name));
#if defined(_WIN32)
TEST_LOG("GetRecordingDeviceName(%d) => name=%s, guid=%s\n",
i, device_name, guid_name);
#else
TEST_LOG("GetRecordingDeviceName(%d) => name=%s\n", i, device_name);
#endif
TEST_MUSTPASS(voe_hardware_->SetRecordingDevice(i));
}
// Check playout side (the check is similar to the recording side).
int num_plays = 0;
TEST_MUSTPASS(voe_hardware_->GetNumOfPlayoutDevices(num_plays));
TEST_LOG("GetNumDevsPlayout = %d\n", num_plays);
for (int i = 0; i < num_plays; i++) {
TEST_MUSTPASS(voe_hardware_->GetPlayoutDeviceName(i, device_name,
guid_name));
#if defined(_WIN32)
TEST_LOG("GetPlayoutDeviceName(%d) => name=%s, guid=%s\n",
i, device_name, guid_name);
#else
TEST_LOG("GetPlayoutDeviceName(%d) => name=%s\n", i, device_name);
#endif
TEST_MUSTPASS(voe_hardware_->SetPlayoutDevice(i));
}
#endif // #if (defined(WEBRTC_MAC) && !defined(MAC_IPHONE)) || (defined(_WI...&
TEST_LOG("Setting default sound devices \n");
#ifdef _WIN32
TEST_MUSTPASS(voe_hardware_->SetRecordingDevice(-1));
TEST_MUSTPASS(voe_hardware_->SetPlayoutDevice(-1));
#else
#if !defined(MAC_IPHONE) && !defined(WEBRTC_ANDROID)
TEST_MUSTPASS(voe_hardware_->SetRecordingDevice(0));
TEST_MUSTPASS(voe_hardware_->SetPlayoutDevice(0));
#endif
#endif
#ifdef MAC_IPHONE
// Reset sound device
TEST_LOG("Reset sound device \n");
TEST_MUSTPASS(voe_hardware_->ResetAudioDevice());
#endif
#else
TEST_LOG("\n\n+++ Hardware tests NOT ENABLED +++\n");
#endif // #ifdef _TEST_HARDWARE_
return 0;
}
int VoETestManager::TestCodecsBeforeStreaming() {
CodecInst codec_instance;
memset(&codec_instance, 0, sizeof(codec_instance));
@ -1597,14 +1465,19 @@ int VoETestManager::TestCodecs() {
}
int VoETestManager::DoStandardTest() {
TEST_LOG("\n\n+++ Base tests +++\n\n");
if (SetUp() != 0) return -1;
if (TestHardwareBeforeStreaming() != 0) return -1;
if (TestCodecsBeforeStreaming() != 0) return -1;
if (TestNetworkBeforeStreaming() != 0) return -1;
// TODO(qhogpat): this gets verified way later - quite ugly. Make sure to
// put this into setup when rewriting the test that requires this.
TEST_MUSTPASS(voe_rtp_rtcp_->SetRTCP_CNAME(0, "Niklas"));
TEST_MUSTPASS(voe_rtp_rtcp_->SetLocalSSRC(0, 1234));
FakeExternalTransport channel0_transport(voe_network_);
if (TestStartStreaming(channel0_transport) != 0) return -1;

View File

@ -26,8 +26,12 @@
],
'sources': [
'auto_test/automated_mode.cc',
'auto_test/standard/after_initialization_fixture.cc',
'auto_test/standard/before_initialization_fixture.cc',
'auto_test/standard/hardware_before_initializing_test.cc',
'auto_test/standard/hardware_before_streaming_test.cc',
'auto_test/standard/rtp_rtcp_before_streaming_test.cc',
'auto_test/standard/voe_base_misc_test.cc',
'auto_test/voe_cpu_test.cc',
'auto_test/voe_cpu_test.h',
'auto_test/voe_extended_test.cc',