1/* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11#include "testing/gtest/include/gtest/gtest.h" 12#include "webrtc/modules/media_file/interface/media_file.h" 13#include "webrtc/system_wrappers/interface/sleep.h" 14#include "webrtc/test/testsupport/fileutils.h" 15#include "webrtc/test/testsupport/gtest_disable.h" 16 17class MediaFileTest : public testing::Test { 18 protected: 19 void SetUp() { 20 // Use number 0 as the the identifier and pass to CreateMediaFile. 21 media_file_ = webrtc::MediaFile::CreateMediaFile(0); 22 ASSERT_TRUE(media_file_ != NULL); 23 } 24 void TearDown() { 25 webrtc::MediaFile::DestroyMediaFile(media_file_); 26 media_file_ = NULL; 27 } 28 webrtc::MediaFile* media_file_; 29}; 30 31TEST_F(MediaFileTest, DISABLED_ON_ANDROID(StartPlayingAudioFileWithoutError)) { 32 // TODO(leozwang): Use hard coded filename here, we want to 33 // loop through all audio files in future 34 const std::string audio_file = webrtc::test::ProjectRootPath() + 35 "data/voice_engine/audio_tiny48.wav"; 36 ASSERT_EQ(0, media_file_->StartPlayingAudioFile( 37 audio_file.c_str(), 38 0, 39 false, 40 webrtc::kFileFormatWavFile)); 41 42 ASSERT_EQ(true, media_file_->IsPlaying()); 43 44 webrtc::SleepMs(1); 45 46 ASSERT_EQ(0, media_file_->StopPlaying()); 47} 48