1 // Copyright 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/basictypes.h" 6 #include "base/memory/scoped_ptr.h" 7 #include "media/audio/audio_io.h" 8 #include "media/audio/audio_manager.h" 9 #include "testing/gtest/include/gtest/gtest.h" 10 11 using namespace media; 12 13 // Test that input is supported and output is not. 14 TEST(IOSAudioTest, AudioSupport) { 15 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 16 ASSERT_TRUE(NULL != audio_manager.get()); 17 ASSERT_FALSE(audio_manager->HasAudioOutputDevices()); 18 ASSERT_TRUE(audio_manager->HasAudioInputDevices()); 19 } 20 21 // Test that input stream can be opened and closed. 22 TEST(IOSAudioTest, InputStreamOpenAndClose) { 23 scoped_ptr<AudioManager> audio_manager(AudioManager::Create()); 24 ASSERT_TRUE(NULL != audio_manager.get()); 25 if (!audio_manager->HasAudioInputDevices()) 26 return; 27 AudioInputStream* ias = audio_manager->MakeAudioInputStream( 28 AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, 29 8000, 16, 1024), 30 std::string("test_device")); 31 ASSERT_TRUE(NULL != ias); 32 EXPECT_TRUE(ias->Open()); 33 ias->Close(); 34 } 35