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 { | |
24 | |
25 class MockAudioSource : public AudioOutputStream::AudioSourceCallback { | 23 class MockAudioSource : public AudioOutputStream::AudioSourceCallback { |
26 public: | 24 public: |
27 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, uint8* dest, | 25 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, uint8* dest, |
28 uint32 max_size, | 26 uint32 max_size, |
29 AudioBuffersState buffers_state)); | 27 AudioBuffersState buffers_state)); |
30 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); | 28 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); |
31 }; | 29 }; |
32 | 30 |
33 // Validate that the SineWaveAudioSource writes the expected values for | 31 // Validate that the SineWaveAudioSource writes the expected values for |
34 // the FORMAT_16BIT_MONO. | 32 // the FORMAT_16BIT_MONO. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 .WillOnce(Return(0)); | 168 .WillOnce(Return(0)); |
171 EXPECT_CALL(source, OnMoreData(oas, NotNull(), bytes_100_ms, _)) | 169 EXPECT_CALL(source, OnMoreData(oas, NotNull(), bytes_100_ms, _)) |
172 .Times(AnyNumber()) | 170 .Times(AnyNumber()) |
173 .WillRepeatedly(Return(0)); | 171 .WillRepeatedly(Return(0)); |
174 | 172 |
175 oas->Start(&source); | 173 oas->Start(&source); |
176 usleep(500000); | 174 usleep(500000); |
177 oas->Stop(); | 175 oas->Stop(); |
178 oas->Close(); | 176 oas->Close(); |
179 } | 177 } |
180 | |
181 } // namespace media | |
OLD | NEW |