Index: webrtc/audio/audio_send_stream_unittest.cc |
diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc |
index 227ec8379971f3e6c2ad73b52acf75872e27a08a..819b66873a16c0638ebb7873afdd8c79a601c16d 100644 |
--- a/webrtc/audio/audio_send_stream_unittest.cc |
+++ b/webrtc/audio/audio_send_stream_unittest.cc |
@@ -11,9 +11,34 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "webrtc/audio/audio_send_stream.h" |
+#include "webrtc/audio/audio_state.h" |
#include "webrtc/audio/conversion.h" |
+#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/test/fake_voice_engine.h" |
+namespace { |
+ |
+struct ConfigHelper { |
+ ConfigHelper() : stream_config_(nullptr) { |
+ webrtc::AudioState::Config config; |
+ config.voice_engine = &voice_engine_; |
+ audio_state_.reset(new webrtc::internal::AudioState(config)); |
+ } |
+ |
+ webrtc::AudioSendStream::Config& config() { |
+ return stream_config_; |
+ } |
+ webrtc::internal::AudioState* audio_state() { |
+ return audio_state_.get(); |
+ } |
+ |
+ private: |
+ webrtc::test::FakeVoiceEngine voice_engine_; |
+ rtc::scoped_ptr<webrtc::internal::AudioState> audio_state_; |
+ webrtc::AudioSendStream::Config stream_config_; |
+}; |
+} // namespace |
+ |
namespace webrtc { |
namespace test { |
@@ -33,18 +58,16 @@ TEST(AudioSendStreamTest, ConfigToString) { |
} |
TEST(AudioSendStreamTest, ConstructDestruct) { |
- FakeVoiceEngine voice_engine; |
- AudioSendStream::Config config(nullptr); |
- config.voe_channel_id = 1; |
- internal::AudioSendStream send_stream(config, &voice_engine); |
+ ConfigHelper helper; |
+ helper.config().voe_channel_id = 1; |
+ internal::AudioSendStream send_stream(helper.config(), helper.audio_state()); |
} |
TEST(AudioSendStreamTest, GetStats) { |
- FakeVoiceEngine voice_engine; |
- AudioSendStream::Config config(nullptr); |
- config.rtp.ssrc = FakeVoiceEngine::kSendSsrc; |
- config.voe_channel_id = FakeVoiceEngine::kSendChannelId; |
- internal::AudioSendStream send_stream(config, &voice_engine); |
+ ConfigHelper helper; |
+ helper.config().rtp.ssrc = FakeVoiceEngine::kSendSsrc; |
+ helper.config().voe_channel_id = FakeVoiceEngine::kSendChannelId; |
+ internal::AudioSendStream send_stream(helper.config(), helper.audio_state()); |
AudioSendStream::Stats stats = send_stream.GetStats(); |
const CallStatistics& call_stats = FakeVoiceEngine::kSendCallStats; |