OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 media_file_ = webrtc::MediaFile::CreateMediaFile(0); | 21 media_file_ = webrtc::MediaFile::CreateMediaFile(0); |
22 ASSERT_TRUE(media_file_ != NULL); | 22 ASSERT_TRUE(media_file_ != NULL); |
23 } | 23 } |
24 void TearDown() { | 24 void TearDown() { |
25 webrtc::MediaFile::DestroyMediaFile(media_file_); | 25 webrtc::MediaFile::DestroyMediaFile(media_file_); |
26 media_file_ = NULL; | 26 media_file_ = NULL; |
27 } | 27 } |
28 webrtc::MediaFile* media_file_; | 28 webrtc::MediaFile* media_file_; |
29 }; | 29 }; |
30 | 30 |
31 TEST_F(MediaFileTest, DISABLED_ON_ANDROID(StartPlayingAudioFileWithoutError)) { | 31 TEST_F(MediaFileTest, DISABLED_ON_IOS( |
| 32 DISABLED_ON_ANDROID(StartPlayingAudioFileWithoutError))) { |
32 // TODO(leozwang): Use hard coded filename here, we want to | 33 // TODO(leozwang): Use hard coded filename here, we want to |
33 // loop through all audio files in future | 34 // loop through all audio files in future |
34 const std::string audio_file = webrtc::test::ProjectRootPath() + | 35 const std::string audio_file = webrtc::test::ProjectRootPath() + |
35 "data/voice_engine/audio_tiny48.wav"; | 36 "data/voice_engine/audio_tiny48.wav"; |
36 ASSERT_EQ(0, media_file_->StartPlayingAudioFile( | 37 ASSERT_EQ(0, media_file_->StartPlayingAudioFile( |
37 audio_file.c_str(), | 38 audio_file.c_str(), |
38 0, | 39 0, |
39 false, | 40 false, |
40 webrtc::kFileFormatWavFile)); | 41 webrtc::kFileFormatWavFile)); |
41 | 42 |
42 ASSERT_EQ(true, media_file_->IsPlaying()); | 43 ASSERT_EQ(true, media_file_->IsPlaying()); |
43 | 44 |
44 webrtc::SleepMs(1); | 45 webrtc::SleepMs(1); |
45 | 46 |
46 ASSERT_EQ(0, media_file_->StopPlaying()); | 47 ASSERT_EQ(0, media_file_->StopPlaying()); |
47 } | 48 } |
48 | 49 |
49 TEST_F(MediaFileTest, WriteWavFile) { | 50 TEST_F(MediaFileTest, DISABLED_ON_IOS(WriteWavFile)) { |
50 // Write file. | 51 // Write file. |
51 static const size_t kHeaderSize = 44; | 52 static const size_t kHeaderSize = 44; |
52 static const size_t kPayloadSize = 320; | 53 static const size_t kPayloadSize = 320; |
53 webrtc::CodecInst codec = { | 54 webrtc::CodecInst codec = { |
54 0, "L16", 16000, static_cast<int>(kPayloadSize), 1 | 55 0, "L16", 16000, static_cast<int>(kPayloadSize), 1 |
55 }; | 56 }; |
56 std::string outfile = webrtc::test::OutputPath() + "wavtest.wav"; | 57 std::string outfile = webrtc::test::OutputPath() + "wavtest.wav"; |
57 ASSERT_EQ(0, | 58 ASSERT_EQ(0, |
58 media_file_->StartRecordingAudioFile( | 59 media_file_->StartRecordingAudioFile( |
59 outfile.c_str(), webrtc::kFileFormatWavFile, codec)); | 60 outfile.c_str(), webrtc::kFileFormatWavFile, codec)); |
(...skipping 26 matching lines...) Expand all Loading... |
86 uint8_t header[kHeaderSize]; | 87 uint8_t header[kHeaderSize]; |
87 ASSERT_EQ(1u, fread(header, kHeaderSize, 1, f)); | 88 ASSERT_EQ(1u, fread(header, kHeaderSize, 1, f)); |
88 EXPECT_EQ(0, memcmp(kExpectedHeader, header, kHeaderSize)); | 89 EXPECT_EQ(0, memcmp(kExpectedHeader, header, kHeaderSize)); |
89 | 90 |
90 uint8_t payload[kPayloadSize]; | 91 uint8_t payload[kPayloadSize]; |
91 ASSERT_EQ(1u, fread(payload, kPayloadSize, 1, f)); | 92 ASSERT_EQ(1u, fread(payload, kPayloadSize, 1, f)); |
92 EXPECT_EQ(0, memcmp(kFakeData, payload, kPayloadSize)); | 93 EXPECT_EQ(0, memcmp(kFakeData, payload, kPayloadSize)); |
93 | 94 |
94 EXPECT_EQ(0, fclose(f)); | 95 EXPECT_EQ(0, fclose(f)); |
95 } | 96 } |
OLD | NEW |