| Index: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/noise_generation_unittest.py
 | 
| diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/noise_generation_unittest.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/noise_generation_unittest.py
 | 
| index 55fd1fd2a8a7e775e475c48d6df08b5527cfec20..2b750913acb660a7e64988c37f0e5cf25c3a2488 100644
 | 
| --- a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/noise_generation_unittest.py
 | 
| +++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/noise_generation_unittest.py
 | 
| @@ -6,14 +6,19 @@
 | 
|  # in the file PATENTS.  All contributing project authors may
 | 
|  # be found in the AUTHORS file in the root of the source tree.
 | 
|  
 | 
| +"""Unit tests for the noise_generation module.
 | 
| +"""
 | 
| +
 | 
|  import os
 | 
|  import shutil
 | 
|  import tempfile
 | 
|  import unittest
 | 
|  
 | 
|  from . import noise_generation
 | 
| +from . import noise_generation_factory
 | 
|  from . import signal_processing
 | 
|  
 | 
| +
 | 
|  class TestNoiseGen(unittest.TestCase):
 | 
|  
 | 
|    def setUp(self):
 | 
| @@ -36,6 +41,13 @@ class TestNoiseGen(unittest.TestCase):
 | 
|      self.assertIsInstance(registered_classes, dict)
 | 
|      self.assertGreater(len(registered_classes), 0)
 | 
|  
 | 
| +    # Instance noise generator factory.
 | 
| +    noise_generator_factory = noise_generation_factory.NoiseGeneratorFactory(
 | 
| +        aechen_ir_database_path='')
 | 
| +    # TODO(alessiob): Replace with a mock of NoiseGeneratorFactory that takes
 | 
| +    # no arguments in the ctor. For those generators that need parameters, it
 | 
| +    # will return a mock generator (see the first comment in the next for loop).
 | 
| +
 | 
|      # Use a sample input file as clean input signal.
 | 
|      input_signal_filepath = os.path.join(
 | 
|          os.getcwd(), 'probing_signals', 'tone-880.wav')
 | 
| @@ -47,9 +59,17 @@ class TestNoiseGen(unittest.TestCase):
 | 
|  
 | 
|      # Try each registered noise generator.
 | 
|      for noise_generator_name in registered_classes:
 | 
| +      # Exclude EchoNoiseGenerator.
 | 
| +      # TODO(alessiob): Mock EchoNoiseGenerator, the mock should rely on
 | 
| +      # hard-coded impulse responses. This requires a mock for
 | 
| +      # NoiseGeneratorFactory. The latter knows whether returning the actual
 | 
| +      # generator or a mock object (as in the case of EchoNoiseGenerator).
 | 
| +      if noise_generator_name == 'echo':
 | 
| +        continue
 | 
| +
 | 
|        # Instance noise generator.
 | 
| -      noise_generator_class = registered_classes[noise_generator_name]
 | 
| -      noise_generator = noise_generator_class()
 | 
| +      noise_generator = noise_generator_factory.GetInstance(
 | 
| +          registered_classes[noise_generator_name])
 | 
|  
 | 
|        # Generate the noisy input - reference pairs.
 | 
|        noise_generator.generate(
 | 
| @@ -78,8 +98,14 @@ class TestNoiseGen(unittest.TestCase):
 | 
|  
 | 
|    def _CheckNoiseGeneratorPairsSignalDurations(
 | 
|        self, noise_generator, input_signal):
 | 
| -    """Checks that the noisy input and the reference tracks are audio files
 | 
| -       with duration >= to that of the input signal.
 | 
| +    """Check duration of the signals generated by a noise generator.
 | 
| +
 | 
| +    Checks that the noisy input and the reference tracks are audio files
 | 
| +    with duration equal to or greater than that of the input signal.
 | 
| +
 | 
| +    Args:
 | 
| +      noise_generator: NoiseGenerator instance.
 | 
| +      input_signal: AudioSegment instance.
 | 
|      """
 | 
|      input_signal_length = (
 | 
|          signal_processing.SignalProcessingUtils.count_samples(input_signal))
 | 
| @@ -111,6 +137,9 @@ class TestNoiseGen(unittest.TestCase):
 | 
|  
 | 
|    def _CheckNoiseGeneratorPairsOutputPaths(self, noise_generator):
 | 
|      """Checks that the output path created by the generator exists.
 | 
| +
 | 
| +    Args:
 | 
| +      noise_generator: NoiseGenerator instance.
 | 
|      """
 | 
|      # Iterate over the noisy signal - reference pairs.
 | 
|      for noise_config_name in noise_generator.config_names:
 | 
| 
 |