Chromium Code Reviews| 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 { |
| 24 | |
| 23 namespace conversational_speech { | 25 namespace conversational_speech { |
| 24 | 26 |
| 25 class MockWavReaderFactory : public WavReaderAbstractFactory { | 27 class MockWavReaderFactory : public WavReaderAbstractFactory { |
| 26 public: | 28 public: |
| 27 MockWavReaderFactory(); | 29 struct Params{ |
| 28 // TODO(alessiob): add ctor that gets map string->(sr, #samples, #channels). | 30 int sample_rate; |
| 31 size_t num_channels; | |
| 32 size_t num_samples; | |
| 33 }; | |
| 34 | |
| 35 MockWavReaderFactory(const Params& default_params, | |
| 36 const std::map<std::string, const Params>& | |
| 37 params = std::map<std::string, const Params>{}); | |
|
hlundin-webrtc
2017/04/07 11:54:18
Remove default arg and replace the extra ctor inst
| |
| 29 ~MockWavReaderFactory(); | 38 ~MockWavReaderFactory(); |
| 30 | 39 |
| 31 // TODO(alessiob): use ON_CALL to return MockWavReader with desired params. | |
| 32 MOCK_CONST_METHOD1(Create, std::unique_ptr<WavReaderInterface>( | 40 MOCK_CONST_METHOD1(Create, std::unique_ptr<WavReaderInterface>( |
| 33 const std::string&)); | 41 const std::string&)); |
| 34 | 42 |
| 35 // TODO(alessiob): add const ref to map (see ctor to add). | 43 private: |
| 44 // Creates a MockWavReader instance using the parameters in | |
| 45 // audiotrack_names_params_ if the entry corresponding to filepath exists, | |
| 46 // otherwise creates a MockWavReader instance using the default parameters. | |
| 47 std::unique_ptr<WavReaderInterface> CreateMock(const std::string& filepath); | |
| 48 | |
| 49 const Params default_params_; | |
| 50 const std::map<std::string, const Params>& audiotrack_names_params_; | |
| 36 }; | 51 }; |
| 37 | 52 |
| 38 } // namespace conversational_speech | 53 } // namespace conversational_speech |
| 39 } // namespace test | 54 } // namespace test |
| 40 } // namespace webrtc | 55 } // namespace webrtc |
| 41 | 56 |
| 42 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVRE ADER_FACTORY_H_ | 57 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_CONVERSATIONAL_SPEECH_MOCK_WAVRE ADER_FACTORY_H_ |
| OLD | NEW |