content/renderer/media/audio_renderer_mixer_manager_unittest.cc
// Verify GetMixer() and RemoveMixer() both work as expected; particularly with
// respect to the explicit ref counting done.
Verify GetMixer() and RemoveMixer() both work as expected; particularly with
respect to the explicit ref counting done.
Verify GetMixer () and RemoveMixer () both work as expected ; particularly with respect to the explicit ref counting done .
TEST_F(AudioRendererMixerManagerTest, GetRemoveMixer) {
  EXPECT_CALL(*mock_sink_, Start()).Times(2);
  EXPECT_CALL(*mock_sink_, Stop()).Times(2);
  EXPECT_EQ(mixer_count(), 0);
  media::AudioParameters params1(
      media::AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, kSampleRate,
      kBitsPerChannel, kBufferSize);
  media::AudioRendererMixer* mixer1 = GetMixer(params1);
  ASSERT_TRUE(mixer1);
  EXPECT_EQ(mixer_count(), 1);
  EXPECT_EQ(mixer1, GetMixer(params1));
  EXPECT_EQ(mixer_count(), 1);
  RemoveMixer(params1);
  EXPECT_EQ(mixer_count(), 1);
  media::AudioParameters params2(
      media::AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, kSampleRate * 2,
      kBitsPerChannel, kBufferSize * 2);
  media::AudioRendererMixer* mixer2 = GetMixer(params2);
  ASSERT_TRUE(mixer2);
  EXPECT_EQ(mixer_count(), 2);
  EXPECT_NE(mixer1, mixer2);
  RemoveMixer(params1);
  EXPECT_EQ(mixer_count(), 1);
  RemoveMixer(params2);
  EXPECT_EQ(mixer_count(), 0);
}
TEST_F ( AudioRendererMixerManagerTest , GetRemoveMixer ) { EXPECT_CALL ( * mock_sink_ , Start ( ) ) . Times ( 2 ) ; EXPECT_CALL ( * mock_sink_ , Stop ( ) ) . Times ( 2 ) ; EXPECT_EQ ( mixer_count ( ) , 0 ) ; media :: AudioParameters params1 ( media :: AudioParameters :: AUDIO_PCM_LINEAR , kChannelLayout , kSampleRate , kBitsPerChannel , kBufferSize ) ; media :: AudioRendererMixer * mixer1 = GetMixer ( params1 ) ; ASSERT_TRUE ( mixer1 ) ; EXPECT_EQ ( mixer_count ( ) , 1 ) ; EXPECT_EQ ( mixer1 , GetMixer ( params1 ) ) ; EXPECT_EQ ( mixer_count ( ) , 1 ) ; RemoveMixer ( params1 ) ; EXPECT_EQ ( mixer_count ( ) , 1 ) ; media :: AudioParameters params2 ( media :: AudioParameters :: AUDIO_PCM_LINEAR , kChannelLayout , kSampleRate * 2 , kBitsPerChannel , kBufferSize * 2 ) ; media :: AudioRendererMixer * mixer2 = GetMixer ( params2 ) ; ASSERT_TRUE ( mixer2 ) ; EXPECT_EQ ( mixer_count ( ) , 2 ) ; EXPECT_NE ( mixer1 , mixer2 ) ; RemoveMixer ( params1 ) ; EXPECT_EQ ( mixer_count ( ) , 1 ) ; RemoveMixer ( params2 ) ; EXPECT_EQ ( mixer_count ( ) , 0 ) ; }
Verify GetMixer() and RemoveMixer() both work as expected; particularly with
respect to the explicit ref counting done.
Verify GetMixer () and RemoveMixer () both work as expected ; particularly with respect to the explicit ref counting done .
// Since we're testing two different sets of parameters, we expect // AudioRendererMixerManager to call Start and Stop on our mock twice. // There should be no mixers outstanding to start with. // The same parameters should return the same mixer1. // Remove the extra mixer we just acquired. // Different parameters should result in a different mixer1. // Remove both outstanding mixers.