| Index: media/audio/audio_input_unittest.cc
|
| ===================================================================
|
| --- media/audio/audio_input_unittest.cc (revision 190471)
|
| +++ media/audio/audio_input_unittest.cc (working copy)
|
| @@ -11,6 +11,11 @@
|
| #include "media/audio/audio_manager_base.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "base/android/jni_android.h"
|
| +#include "media/audio/audio_manager_base.h"
|
| +#endif
|
| +
|
| namespace media {
|
|
|
| static const int kSamplingRate = 8000;
|
| @@ -67,6 +72,11 @@
|
| }
|
|
|
| static AudioInputStream* CreateTestAudioInputStream(AudioManager* audio_man) {
|
| +#if defined(OS_ANDROID)
|
| + bool ret = media::AudioManagerBase::RegisterAudioManager(
|
| + base::android::AttachCurrentThread());
|
| + EXPECT_TRUE(ret);
|
| +#endif
|
| AudioInputStream* ais = audio_man->MakeAudioInputStream(
|
| AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
|
| kSamplingRate, 16, kSamplesPerPacket),
|
| @@ -110,12 +120,7 @@
|
| }
|
|
|
| // Test create and close of an AudioInputStream without recording audio.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_CreateAndClose DISABLED_CreateAndClose
|
| -#else
|
| -#define MAYBE_CreateAndClose CreateAndClose
|
| -#endif
|
| -TEST(AudioInputTest, MAYBE_CreateAndClose) {
|
| +TEST(AudioInputTest, CreateAndClose) {
|
| scoped_ptr<AudioManager> audio_man(AudioManager::Create());
|
| if (!CanRunAudioTests(audio_man.get()))
|
| return;
|
| @@ -124,14 +129,7 @@
|
| }
|
|
|
| // Test create, open and close of an AudioInputStream without recording audio.
|
| -// TODO(leozwang): Because java calls were introduced in audio_manager_base,
|
| -// unit test has to register jni first, else it will crash.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_OpenAndClose DISABLED_OpenAndClose
|
| -#else
|
| -#define MAYBE_OpenAndClose OpenAndClose
|
| -#endif
|
| -TEST(AudioInputTest, MAYBE_OpenAndClose) {
|
| +TEST(AudioInputTest, OpenAndClose) {
|
| scoped_ptr<AudioManager> audio_man(AudioManager::Create());
|
| if (!CanRunAudioTests(audio_man.get()))
|
| return;
|
| @@ -141,12 +139,7 @@
|
| }
|
|
|
| // Test create, open, stop and close of an AudioInputStream without recording.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_OpenStopAndClose DISABLED_OpenStopAndClose
|
| -#else
|
| -#define MAYBE_OpenStopAndClose OpenStopAndClose
|
| -#endif
|
| -TEST(AudioInputTest, MAYBE_OpenStopAndClose) {
|
| +TEST(AudioInputTest, OpenStopAndClose) {
|
| scoped_ptr<AudioManager> audio_man(AudioManager::Create());
|
| if (!CanRunAudioTests(audio_man.get()))
|
| return;
|
| @@ -157,12 +150,7 @@
|
| }
|
|
|
| // Test a normal recording sequence using an AudioInputStream.
|
| -#if defined(OS_ANDROID)
|
| -#define MAYBE_Record DISABLED_Record
|
| -#else
|
| -#define MAYBE_Record Record
|
| -#endif
|
| -TEST(AudioInputTest, MAYBE_Record) {
|
| +TEST(AudioInputTest, Record) {
|
| scoped_ptr<AudioManager> audio_man(AudioManager::Create());
|
| if (!CanRunAudioTests(audio_man.get()))
|
| return;
|
|
|