Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 1403363003: Move VoiceEngineObserver into AudioSendStream so that we detect typing noises and return properly i… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: better comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698