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.
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"
11 using namespace media
;
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());
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())
27 AudioInputStream
* ias
= audio_manager
->MakeAudioInputStream(
28 AudioParameters(AudioParameters::AUDIO_PCM_LINEAR
, CHANNEL_LAYOUT_STEREO
,
30 std::string("test_device"));
31 ASSERT_TRUE(NULL
!= ias
);
32 EXPECT_TRUE(ias
->Open());