Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Unified Diff: media/audio/win/audio_output_win_unittest.cc

Issue 155471: Refactoring to share MockAudioOutputStream implementations across 3 platforms... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/win/audio_output_win.cc ('k') | media/audio/win/waveout_output_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_output_win_unittest.cc
===================================================================
--- media/audio/win/audio_output_win_unittest.cc (revision 20503)
+++ media/audio/win/audio_output_win_unittest.cc (working copy)
@@ -193,51 +193,6 @@
EXPECT_EQ(1, source.was_closed());
}
-// Validate that the SineWaveAudioSource writes the expected values for
-// the FORMAT_16BIT_MONO. The values are carefully selected so rounding issues
-// do not affect the result. We also test that AudioManager::GetLastMockBuffer
-// works.
-// TODO(hclam): move this test to SimpleSourcesTest once mock audio stream is
-// implemented on other platform.
-TEST(WinAudioTest, SineWaveAudio16MonoTest) {
- const size_t samples = 1024;
- const size_t bytes_per_sample = 2;
- const int freq = 200;
-
- SineWaveAudioSource source(SineWaveAudioSource::FORMAT_16BIT_LINEAR_PCM, 1,
- freq, AudioManager::kTelephoneSampleRate);
-
- AudioManager* audio_man = AudioManager::GetAudioManager();
- ASSERT_TRUE(NULL != audio_man);
- AudioOutputStream* oas =
- audio_man->MakeAudioStream(AudioManager::AUDIO_MOCK, 1,
- AudioManager::kTelephoneSampleRate,
- bytes_per_sample * 2);
- ASSERT_TRUE(NULL != oas);
- EXPECT_TRUE(oas->Open(samples * bytes_per_sample));
-
- oas->Start(&source);
- oas->Stop();
- oas->Close();
-
- const int16* last_buffer =
- reinterpret_cast<const int16*>(audio_man->GetLastMockBuffer());
- ASSERT_TRUE(NULL != last_buffer);
-
- size_t half_period = AudioManager::kTelephoneSampleRate / (freq * 2);
-
- // Spot test positive incursion of sine wave.
- EXPECT_EQ(0, last_buffer[0]);
- EXPECT_EQ(5126, last_buffer[1]);
- EXPECT_TRUE(last_buffer[1] < last_buffer[2]);
- EXPECT_TRUE(last_buffer[2] < last_buffer[3]);
- // Spot test negative incursion of sine wave.
- EXPECT_EQ(0, last_buffer[half_period]);
- EXPECT_EQ(-5126, last_buffer[half_period + 1]);
- EXPECT_TRUE(last_buffer[half_period + 1] > last_buffer[half_period + 2]);
- EXPECT_TRUE(last_buffer[half_period + 2] > last_buffer[half_period + 3]);
-}
-
// ===========================================================================
// Validation of AudioManager::AUDIO_PCM_LINEAR
//
« no previous file with comments | « media/audio/win/audio_output_win.cc ('k') | media/audio/win/waveout_output_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698