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