| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
| 11 #include <memory> |
| 12 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "webrtc/base/format_macros.h" | 14 #include "webrtc/base/format_macros.h" |
| 13 #include "webrtc/base/scoped_ptr.h" | |
| 14 #include "webrtc/modules/audio_device/android/build_info.h" | 15 #include "webrtc/modules/audio_device/android/build_info.h" |
| 15 #include "webrtc/modules/audio_device/android/audio_manager.h" | 16 #include "webrtc/modules/audio_device/android/audio_manager.h" |
| 16 #include "webrtc/modules/audio_device/android/ensure_initialized.h" | 17 #include "webrtc/modules/audio_device/android/ensure_initialized.h" |
| 17 | 18 |
| 18 #define PRINT(...) fprintf(stderr, __VA_ARGS__); | 19 #define PRINT(...) fprintf(stderr, __VA_ARGS__); |
| 19 | 20 |
| 20 namespace webrtc { | 21 namespace webrtc { |
| 21 | 22 |
| 22 static const char kTag[] = " "; | 23 static const char kTag[] = " "; |
| 23 | 24 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 AudioManager* audio_manager() const { return audio_manager_.get(); } | 37 AudioManager* audio_manager() const { return audio_manager_.get(); } |
| 37 | 38 |
| 38 // A valid audio layer must always be set before calling Init(), hence we | 39 // A valid audio layer must always be set before calling Init(), hence we |
| 39 // might as well make it a part of the test fixture. | 40 // might as well make it a part of the test fixture. |
| 40 void SetActiveAudioLayer() { | 41 void SetActiveAudioLayer() { |
| 41 EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds()); | 42 EXPECT_EQ(0, audio_manager()->GetDelayEstimateInMilliseconds()); |
| 42 audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio); | 43 audio_manager()->SetActiveAudioLayer(AudioDeviceModule::kAndroidJavaAudio); |
| 43 EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds()); | 44 EXPECT_NE(0, audio_manager()->GetDelayEstimateInMilliseconds()); |
| 44 } | 45 } |
| 45 | 46 |
| 46 rtc::scoped_ptr<AudioManager> audio_manager_; | 47 std::unique_ptr<AudioManager> audio_manager_; |
| 47 AudioParameters playout_parameters_; | 48 AudioParameters playout_parameters_; |
| 48 AudioParameters record_parameters_; | 49 AudioParameters record_parameters_; |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 TEST_F(AudioManagerTest, ConstructDestruct) { | 52 TEST_F(AudioManagerTest, ConstructDestruct) { |
| 52 } | 53 } |
| 53 | 54 |
| 54 TEST_F(AudioManagerTest, InitClose) { | 55 TEST_F(AudioManagerTest, InitClose) { |
| 55 EXPECT_TRUE(audio_manager()->Init()); | 56 EXPECT_TRUE(audio_manager()->Init()); |
| 56 EXPECT_TRUE(audio_manager()->Close()); | 57 EXPECT_TRUE(audio_manager()->Close()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 params.frames_per_10ms_buffer()); | 146 params.frames_per_10ms_buffer()); |
| 146 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); | 147 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); |
| 147 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); | 148 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); |
| 148 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, | 149 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, |
| 149 params.GetBytesPer10msBuffer()); | 150 params.GetBytesPer10msBuffer()); |
| 150 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); | 151 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace webrtc | 154 } // namespace webrtc |
| 154 | 155 |
| OLD | NEW |