| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "media/audio/audio_io.h" | 7 #include "media/audio/audio_io.h" |
| 8 #include "media/audio/audio_manager.h" | 8 #include "media/audio/audio_manager.h" |
| 9 #include "media/audio/simple_sources.h" | 9 #include "media/audio/simple_sources.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using ::testing::_; | 13 using ::testing::_; |
| 14 using ::testing::AnyNumber; | 14 using ::testing::AnyNumber; |
| 15 using ::testing::DoAll; | 15 using ::testing::DoAll; |
| 16 using ::testing::Field; | 16 using ::testing::Field; |
| 17 using ::testing::InSequence; | 17 using ::testing::InSequence; |
| 18 using ::testing::Invoke; | 18 using ::testing::Invoke; |
| 19 using ::testing::NiceMock; | 19 using ::testing::NiceMock; |
| 20 using ::testing::NotNull; | 20 using ::testing::NotNull; |
| 21 using ::testing::Return; | 21 using ::testing::Return; |
| 22 | 22 |
| 23 namespace media { | 23 namespace media { |
| 24 | 24 |
| 25 class MockAudioSource : public AudioOutputStream::AudioSourceCallback { | 25 class MockAudioSource : public AudioOutputStream::AudioSourceCallback { |
| 26 public: | 26 public: |
| 27 MOCK_METHOD2(OnMoreData, int(AudioBus* audio_bus, | 27 MOCK_METHOD2(OnMoreData, int(AudioBus* audio_bus, |
| 28 AudioBuffersState buffers_state)); | 28 AudioBuffersState buffers_state)); |
| 29 MOCK_METHOD3(OnMoreIOData, int(AudioBus* source, |
| 30 AudioBus* dest, |
| 31 AudioBuffersState buffers_state)); |
| 29 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); | 32 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); |
| 30 }; | 33 }; |
| 31 | 34 |
| 32 // =========================================================================== | 35 // =========================================================================== |
| 33 // Validation of AudioParameters::AUDIO_PCM_LINEAR | 36 // Validation of AudioParameters::AUDIO_PCM_LINEAR |
| 34 // | 37 // |
| 35 | 38 |
| 36 // Test that can it be created and closed. | 39 // Test that can it be created and closed. |
| 37 TEST(MacAudioTest, PCMWaveStreamGetAndClose) { | 40 TEST(MacAudioTest, PCMWaveStreamGetAndClose) { |
| 38 scoped_ptr<AudioManager> audio_man(AudioManager::Create()); | 41 scoped_ptr<AudioManager> audio_man(AudioManager::Create()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 .Times(AnyNumber()) | 156 .Times(AnyNumber()) |
| 154 .WillRepeatedly(Return(0)); | 157 .WillRepeatedly(Return(0)); |
| 155 | 158 |
| 156 oas->Start(&source); | 159 oas->Start(&source); |
| 157 usleep(500000); | 160 usleep(500000); |
| 158 oas->Stop(); | 161 oas->Stop(); |
| 159 oas->Close(); | 162 oas->Close(); |
| 160 } | 163 } |
| 161 | 164 |
| 162 } // namespace media | 165 } // namespace media |
| OLD | NEW |