OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVREADE
R_FACTORY_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVREADE
R_FACTORY_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVREADE
R_FACTORY_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVREADE
R_FACTORY_H_ |
13 | 13 |
| 14 #include <map> |
14 #include <memory> | 15 #include <memory> |
15 #include <string> | 16 #include <string> |
16 | 17 |
17 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_a
bstract_factory.h" | 18 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_a
bstract_factory.h" |
18 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_i
nterface.h" | 19 #include "webrtc/modules/audio_processing/test/conversational_speech/wavreader_i
nterface.h" |
19 #include "webrtc/test/gmock.h" | 20 #include "webrtc/test/gmock.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 namespace test { | 23 namespace test { |
23 namespace conversational_speech { | 24 namespace conversational_speech { |
24 | 25 |
25 class MockWavReaderFactory : public WavReaderAbstractFactory { | 26 class MockWavReaderFactory : public WavReaderAbstractFactory { |
26 public: | 27 public: |
27 MockWavReaderFactory(); | 28 struct Params{ |
28 // TODO(alessiob): add ctor that gets map string->(sr, #samples, #channels). | 29 int sample_rate; |
| 30 size_t num_channels; |
| 31 size_t num_samples; |
| 32 }; |
| 33 |
| 34 MockWavReaderFactory(const Params& default_params, |
| 35 const std::map<std::string, const Params>& params); |
| 36 explicit MockWavReaderFactory(const Params& default_params); |
29 ~MockWavReaderFactory(); | 37 ~MockWavReaderFactory(); |
30 | 38 |
31 // TODO(alessiob): use ON_CALL to return MockWavReader with desired params. | |
32 MOCK_CONST_METHOD1(Create, std::unique_ptr<WavReaderInterface>( | 39 MOCK_CONST_METHOD1(Create, std::unique_ptr<WavReaderInterface>( |
33 const std::string&)); | 40 const std::string&)); |
34 | 41 |
35 // TODO(alessiob): add const ref to map (see ctor to add). | 42 private: |
| 43 // Creates a MockWavReader instance using the parameters in |
| 44 // audiotrack_names_params_ if the entry corresponding to filepath exists, |
| 45 // otherwise creates a MockWavReader instance using the default parameters. |
| 46 std::unique_ptr<WavReaderInterface> CreateMock(const std::string& filepath); |
| 47 |
| 48 const Params& default_params_; |
| 49 std::map<std::string, const Params> audiotrack_names_params_; |
36 }; | 50 }; |
37 | 51 |
38 } // namespace conversational_speech | 52 } // namespace conversational_speech |
39 } // namespace test | 53 } // namespace test |
40 } // namespace webrtc | 54 } // namespace webrtc |
41 | 55 |
42 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVRE
ADER_FACTORY_H_ | 56 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVRE
ADER_FACTORY_H_ |
OLD | NEW |