From f9e3dde240ede48387fe1ad5dc8ef7a51a2446b7 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Wed, 10 Oct 2012 04:19:50 +0000 Subject: Valgrind/Heapchecker: Fix leak in remoting AudioPlayerTests. BUG=154986 TBR=garykac,eugenis Review URL: https://codereview.chromium.org/11087042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161039 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/client/audio_player_unittest.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'remoting/client') diff --git a/remoting/client/audio_player_unittest.cc b/remoting/client/audio_player_unittest.cc index e4e6fa6..e9b8637 100644 --- a/remoting/client/audio_player_unittest.cc +++ b/remoting/client/audio_player_unittest.cc @@ -4,8 +4,8 @@ #include "remoting/client/audio_player.h" +#include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "remoting/client/audio_player.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -26,13 +26,13 @@ namespace remoting { class FakeAudioPlayer : public AudioPlayer { public: - FakeAudioPlayer() {}; + FakeAudioPlayer() {} - bool ResetAudioPlayer(AudioPacket::SamplingRate) { + bool ResetAudioPlayer(AudioPacket::SamplingRate) OVERRIDE { return true; }; - uint32 GetSamplesPerFrame() { + uint32 GetSamplesPerFrame() OVERRIDE { return kAudioSamplesPerFrame; }; }; @@ -44,7 +44,12 @@ class AudioPlayerTest : public ::testing::Test { buffer_.reset(new char[kAudioFrameBytes + kPaddingBytes]); } - virtual void TearDown() {} + virtual void TearDown() { + // Drain the samples from |audio_|. + while (GetNumQueuedPackets() > 0) { + ConsumeAudioFrame(); + } + } void ConsumeAudioFrame() { uint8* buffer = reinterpret_cast(buffer_.get()); -- cgit v1.1