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 f2ef1707103f5dc0ea81fbbdbf19cdba28a4c524..5b9ce62092a3550d706f026e5af368e30548ec3b 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 |
@@ -15,6 +15,7 @@ |
#include "webrtc/base/scoped_ref_ptr.h" |
#include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h" |
+#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
#include "webrtc/test/gmock.h" |
namespace webrtc { |
@@ -22,6 +23,7 @@ namespace webrtc { |
class MockAudioDecoderFactory : public AudioDecoderFactory { |
public: |
MOCK_METHOD0(GetSupportedDecoders, std::vector<AudioCodecSpec>()); |
+ MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&)); |
std::unique_ptr<AudioDecoder> MakeAudioDecoder( |
const SdpAudioFormat& format) { |
std::unique_ptr<AudioDecoder> return_value; |
@@ -46,10 +48,33 @@ class MockAudioDecoderFactory : public AudioDecoderFactory { |
ON_CALL(*factory.get(), GetSupportedDecoders()) |
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>())); |
EXPECT_CALL(*factory.get(), GetSupportedDecoders()).Times(AnyNumber()); |
+ ON_CALL(*factory, IsSupportedDecoder(_)).WillByDefault(Return(false)); |
+ EXPECT_CALL(*factory, IsSupportedDecoder(_)).Times(AnyNumber()); |
EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(0); |
return factory; |
} |
+ // Like CreateUnusedFactory(), but its IsSupportedDecoder() methods claims to |
+ // support the same set of codecs as BuiltinAudioDecoderFactory. |
+ static rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> |
+ CreateUnusedPotemkinFactory() { |
+ using testing::_; |
+ |
+ rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> factory = |
+ new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>; |
+ ON_CALL(*factory, GetSupportedDecoders()) |
+ .WillByDefault(testing::Return(std::vector<webrtc::AudioCodecSpec>())); |
ossu
2016/12/14 13:53:35
Why does it not propose any decoders but further d
kwiberg-webrtc
2016/12/15 14:30:50
It's the minimal functionality required by the tes
|
+ EXPECT_CALL(*factory, GetSupportedDecoders()).Times(testing::AnyNumber()); |
+ ON_CALL(*factory, IsSupportedDecoder(_)) |
+ .WillByDefault(testing::Invoke([](const SdpAudioFormat& format) { |
+ return webrtc::CreateBuiltinAudioDecoderFactory()->IsSupportedDecoder( |
+ format); |
+ })); |
+ EXPECT_CALL(*factory, IsSupportedDecoder(_)).Times(testing::AnyNumber()); |
+ EXPECT_CALL(*factory, 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. |
@@ -65,6 +90,8 @@ class MockAudioDecoderFactory : public AudioDecoderFactory { |
ON_CALL(*factory.get(), GetSupportedDecoders()) |
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>())); |
EXPECT_CALL(*factory.get(), GetSupportedDecoders()).Times(AnyNumber()); |
+ ON_CALL(*factory, IsSupportedDecoder(_)).WillByDefault(Return(false)); |
+ EXPECT_CALL(*factory, IsSupportedDecoder(_)).Times(AnyNumber()); |
ON_CALL(*factory.get(), MakeAudioDecoderMock(_, _)) |
.WillByDefault(SetArgPointee<1>(nullptr)); |
EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(AnyNumber()); |