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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "media/audio/audio_manager.h" | 9 #include "media/audio/audio_manager.h" |
10 #include "media/audio/audio_manager_base.h" | 10 #include "media/audio/audio_manager_base.h" |
11 #include "media/audio/audio_output_dispatcher_impl.h" | 11 #include "media/audio/audio_output_dispatcher_impl.h" |
12 #include "media/audio/audio_output_proxy.h" | 12 #include "media/audio/audio_output_proxy.h" |
13 #include "media/audio/audio_output_resampler.h" | 13 #include "media/audio/audio_output_resampler.h" |
14 #include "media/audio/fake_audio_log_factory.h" | 14 #include "media/audio/fake_audio_log_factory.h" |
15 #include "media/audio/fake_audio_output_stream.h" | 15 #include "media/audio/fake_audio_output_stream.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 using ::testing::_; | 19 using ::testing::_; |
20 using ::testing::AllOf; | 20 using ::testing::AllOf; |
21 using ::testing::DoAll; | 21 using ::testing::DoAll; |
22 using ::testing::Field; | 22 using ::testing::Field; |
23 using ::testing::Mock; | 23 using ::testing::Mock; |
24 using ::testing::NotNull; | 24 using ::testing::NotNull; |
25 using ::testing::Return; | 25 using ::testing::Return; |
26 using ::testing::SetArrayArgument; | 26 using ::testing::SetArrayArgument; |
27 using media::AudioBus; | 27 using media::AudioBus; |
| 28 using media::AudioBuffersState; |
28 using media::AudioInputStream; | 29 using media::AudioInputStream; |
29 using media::AudioManager; | 30 using media::AudioManager; |
30 using media::AudioManagerBase; | 31 using media::AudioManagerBase; |
31 using media::AudioOutputDispatcher; | 32 using media::AudioOutputDispatcher; |
32 using media::AudioOutputProxy; | 33 using media::AudioOutputProxy; |
33 using media::AudioOutputStream; | 34 using media::AudioOutputStream; |
34 using media::AudioParameters; | 35 using media::AudioParameters; |
35 using media::FakeAudioOutputStream; | 36 using media::FakeAudioOutputStream; |
36 | 37 |
37 namespace { | 38 namespace { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const AudioParameters& params, const std::string& device_id)); | 118 const AudioParameters& params, const std::string& device_id)); |
118 MOCK_METHOD2(GetPreferredOutputStreamParameters, AudioParameters( | 119 MOCK_METHOD2(GetPreferredOutputStreamParameters, AudioParameters( |
119 const std::string& device_id, const AudioParameters& params)); | 120 const std::string& device_id, const AudioParameters& params)); |
120 | 121 |
121 private: | 122 private: |
122 media::FakeAudioLogFactory fake_audio_log_factory_; | 123 media::FakeAudioLogFactory fake_audio_log_factory_; |
123 }; | 124 }; |
124 | 125 |
125 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { | 126 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { |
126 public: | 127 public: |
127 int OnMoreData(AudioBus* audio_bus, int total_bytes_delay) { | 128 int OnMoreData(AudioBus* audio_bus, AudioBuffersState buffers_state) { |
128 audio_bus->Zero(); | 129 audio_bus->Zero(); |
129 return audio_bus->frames(); | 130 return audio_bus->frames(); |
130 } | 131 } |
131 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); | 132 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); |
132 }; | 133 }; |
133 | 134 |
134 } // namespace | 135 } // namespace |
135 | 136 |
136 namespace media { | 137 namespace media { |
137 | 138 |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 proxy1->Stop(); | 663 proxy1->Stop(); |
663 CloseAndWaitForCloseTimer(proxy1, &stream1); | 664 CloseAndWaitForCloseTimer(proxy1, &stream1); |
664 | 665 |
665 EXPECT_TRUE(stream1.stop_called()); | 666 EXPECT_TRUE(stream1.stop_called()); |
666 EXPECT_TRUE(stream1.start_called()); | 667 EXPECT_TRUE(stream1.start_called()); |
667 EXPECT_TRUE(stream2.stop_called()); | 668 EXPECT_TRUE(stream2.stop_called()); |
668 EXPECT_TRUE(stream2.start_called()); | 669 EXPECT_TRUE(stream2.start_called()); |
669 } | 670 } |
670 | 671 |
671 } // namespace media | 672 } // namespace media |
OLD | NEW |