Chromium Code Reviews| Index: webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc |
| diff --git a/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc b/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc |
| index 221ad7c7066f3e568ea788f76947a2dfe42d4bc3..51a5a474ce36fc21b1abdd7d59d8da83a195083c 100644 |
| --- a/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc |
| +++ b/webrtc/modules/audio_processing/test/conversational_speech/generator_unittest.cc |
| @@ -12,7 +12,10 @@ |
| #include <memory> |
| #include "webrtc/modules/audio_processing/test/conversational_speech/config.h" |
| +#include "webrtc/modules/audio_processing/test/conversational_speech/multiend_call.h" |
| #include "webrtc/modules/audio_processing/test/conversational_speech/timing.h" |
| +#include "webrtc/modules/audio_processing/test/conversational_speech/mock_wavreader_factory.h" |
|
hlundin-webrtc
2017/03/24 13:44:05
Order of includes.
AleBzk
2017/03/27 08:24:13
Done.
|
| +#include "webrtc/test/gmock.h" |
| #include "webrtc/test/gtest.h" |
| #include "webrtc/test/testsupport/fileutils.h" |
| @@ -22,7 +25,10 @@ namespace { |
| using conversational_speech::LoadTiming; |
| using conversational_speech::SaveTiming; |
| +using conversational_speech::MockWavReaderFactory; |
| +using conversational_speech::MultiEndCall; |
| using conversational_speech::Turn; |
| +using conversational_speech::WavReaderAbstractFactory; |
| const char* const audiotracks_path = "/path/to/audiotracks"; |
| const char* const timing_filepath = "/path/to/timing_file.txt"; |
| @@ -34,7 +40,7 @@ const std::vector<Turn> expected_timing = { |
| {"A", "a2", 100}, |
| {"B", "b2", -200}, |
| {"A", "a3", 0}, |
| - {"A", "a4", 0}, |
| + {"A", "a3", 0}, |
|
AleBzk
2017/03/23 15:07:13
Note that we have 5 unique track names (a Turn is
|
| }; |
| const std::size_t kNumberOfTurns = expected_timing.size(); |
| @@ -50,11 +56,6 @@ TEST(ConversationalSpeechTest, Settings) { |
| EXPECT_EQ(output_path, config.output_path()); |
| } |
| -TEST(ConversationalSpeechTest, ExpectedTimingSize) { |
| - // Check the expected timing size. |
| - EXPECT_EQ(kNumberOfTurns, 6u); |
| -} |
| - |
| TEST(ConversationalSpeechTest, TimingSaveLoad) { |
| // Save test timing. |
| const std::string temporary_filepath = webrtc::test::TempFilename( |
| @@ -75,5 +76,21 @@ TEST(ConversationalSpeechTest, TimingSaveLoad) { |
| } |
| } |
| +TEST(ConversationalSpeechTest, MultiEndCallCreate) { |
| + auto mock_wavreader_factory = std::unique_ptr<MockWavReaderFactory>( |
| + new MockWavReaderFactory()); |
| + |
| + // There are 5 unique audio tracks to read. |
| + EXPECT_CALL(*mock_wavreader_factory, Create(testing::_)).Times(5); |
| + |
| + // Inject the mock wav reader factory. |
| + conversational_speech::MultiEndCall multiend_call( |
| + expected_timing, audiotracks_path, std::move(mock_wavreader_factory)); |
| + |
| + // Test. |
| + EXPECT_EQ(2u, multiend_call.speaker_names().size()); |
| + EXPECT_EQ(5u, multiend_call.audiotrack_readers().size()); |
| +} |
| + |
| } // namespace test |
| } // namespace webrtc |