From 06c1d6f3a1c38724901d436b59717d65235f5e65 Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Wed, 14 May 2014 09:03:33 +0000 Subject: [PATCH] VoEVolumeTest: Adds error return tests. BUG=367 TESTED=trybots, voe_auto_test R=henrikg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/19469006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6139 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../test/auto_test/standard/volume_test.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/webrtc/voice_engine/test/auto_test/standard/volume_test.cc b/webrtc/voice_engine/test/auto_test/standard/volume_test.cc index e4a9bd2fb..3e794309c 100644 --- a/webrtc/voice_engine/test/auto_test/standard/volume_test.cc +++ b/webrtc/voice_engine/test/auto_test/standard/volume_test.cc @@ -31,6 +31,23 @@ class VolumeTest : public AfterStreamingFixture { // investigation in // http://code.google.com/p/webrtc/issues/detail?id=367 +TEST_F(VolumeTest, VerifyCorrectErrorReturns) { + // All tests run on correct initialization which eliminates one possible error + // return. In addition, we assume the audio_device returning values without + // error, which eliminates another potential error. + // Left to verify are sanity checks of set parameters. + + // Valid volume range: [0, 255] + EXPECT_EQ(-1, voe_volume_control_->SetSpeakerVolume(256)); + EXPECT_EQ(-1, voe_volume_control_->SetMicVolume(256)); + + // Valid panning rage: [0, 1] + EXPECT_EQ(-1, voe_volume_control_->SetOutputVolumePan(channel_, -0.1f, 0.5f)); + EXPECT_EQ(-1, voe_volume_control_->SetOutputVolumePan(channel_, 1.1f, 0.5f)); + EXPECT_EQ(-1, voe_volume_control_->SetOutputVolumePan(channel_, 0.5f, -0.1f)); + EXPECT_EQ(-1, voe_volume_control_->SetOutputVolumePan(channel_, 0.5f, 1.1f)); +} + TEST_F(VolumeTest, DefaultSpeakerVolumeIsAtMost255) { unsigned int volume = 1000; EXPECT_EQ(0, voe_volume_control_->GetSpeakerVolume(volume));