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

Unified Diff: webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h

Issue 2072753002: WebRtcVoiceEngine: Use AudioDecoderFactory to generate recv codecs. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed tommi's comments. Created 4 years, 5 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
« no previous file with comments | « webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h
diff --git a/webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h b/webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h
index 6e5737c89b87b792ebbbf6a7014b936d87493ed7..f91a26bc105f86f39a11ee6d0bfc763aeb3da60e 100644
--- a/webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h
+++ b/webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h
@@ -14,6 +14,7 @@
#include <vector>
#include "testing/gmock/include/gmock/gmock.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h"
namespace webrtc {
@@ -30,6 +31,45 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
MOCK_METHOD2(MakeAudioDecoderMock,
void(const SdpAudioFormat& format,
std::unique_ptr<AudioDecoder>* return_value));
+
+ // Creates a MockAudioDecoderFactory with no formats and that may not be
+ // invoked to create a codec - useful for initializing a voice engine, for
+ // example.
+ static rtc::scoped_refptr<webrtc::MockAudioDecoderFactory>
+ CreateUnusedFactory() {
+ using testing::_;
+ using testing::AnyNumber;
+ using testing::Return;
+
+ rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> factory =
+ new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
+ ON_CALL(*factory.get(), GetSupportedFormats())
+ .WillByDefault(Return(std::vector<webrtc::SdpAudioFormat>()));
+ EXPECT_CALL(*factory.get(), GetSupportedFormats()).Times(AnyNumber());
+ EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(0);
+ return factory;
+ }
+
+ // Creates a MockAudioDecoderFactory with no formats that may be invoked to
+ // create a codec any number of times. It will, though, return nullptr on each
+ // call, since it supports no codecs.
+ static rtc::scoped_refptr<webrtc::MockAudioDecoderFactory>
+ CreateEmptyFactory() {
+ using testing::_;
+ using testing::AnyNumber;
+ using testing::Return;
+ using testing::SetArgPointee;
+
+ rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> factory =
+ new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
+ ON_CALL(*factory.get(), GetSupportedFormats())
+ .WillByDefault(Return(std::vector<webrtc::SdpAudioFormat>()));
+ EXPECT_CALL(*factory.get(), GetSupportedFormats()).Times(AnyNumber());
+ ON_CALL(*factory.get(), MakeAudioDecoderMock(_, _))
+ .WillByDefault(SetArgPointee<1>(nullptr));
+ EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(AnyNumber());
+ return factory;
+ }
};
} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698