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; | |
29 using media::AudioInputStream; | 28 using media::AudioInputStream; |
30 using media::AudioManager; | 29 using media::AudioManager; |
31 using media::AudioManagerBase; | 30 using media::AudioManagerBase; |
32 using media::AudioOutputDispatcher; | 31 using media::AudioOutputDispatcher; |
33 using media::AudioOutputProxy; | 32 using media::AudioOutputProxy; |
34 using media::AudioOutputStream; | 33 using media::AudioOutputStream; |
35 using media::AudioParameters; | 34 using media::AudioParameters; |
36 using media::FakeAudioOutputStream; | 35 using media::FakeAudioOutputStream; |
37 | 36 |
38 namespace { | 37 namespace { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 const AudioParameters& params, const std::string& device_id)); | 117 const AudioParameters& params, const std::string& device_id)); |
119 MOCK_METHOD2(GetPreferredOutputStreamParameters, AudioParameters( | 118 MOCK_METHOD2(GetPreferredOutputStreamParameters, AudioParameters( |
120 const std::string& device_id, const AudioParameters& params)); | 119 const std::string& device_id, const AudioParameters& params)); |
121 | 120 |
122 private: | 121 private: |
123 media::FakeAudioLogFactory fake_audio_log_factory_; | 122 media::FakeAudioLogFactory fake_audio_log_factory_; |
124 }; | 123 }; |
125 | 124 |
126 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { | 125 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { |
127 public: | 126 public: |
128 int OnMoreData(AudioBus* audio_bus, AudioBuffersState buffers_state) { | 127 int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) { |
129 audio_bus->Zero(); | 128 audio_bus->Zero(); |
130 return audio_bus->frames(); | 129 return audio_bus->frames(); |
131 } | 130 } |
132 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); | 131 MOCK_METHOD1(OnError, void(AudioOutputStream* stream)); |
133 }; | 132 }; |
134 | 133 |
135 } // namespace | 134 } // namespace |
136 | 135 |
137 namespace media { | 136 namespace media { |
138 | 137 |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 proxy1->Stop(); | 670 proxy1->Stop(); |
672 CloseAndWaitForCloseTimer(proxy1, &stream1); | 671 CloseAndWaitForCloseTimer(proxy1, &stream1); |
673 | 672 |
674 EXPECT_TRUE(stream1.stop_called()); | 673 EXPECT_TRUE(stream1.stop_called()); |
675 EXPECT_TRUE(stream1.start_called()); | 674 EXPECT_TRUE(stream1.start_called()); |
676 EXPECT_TRUE(stream2.stop_called()); | 675 EXPECT_TRUE(stream2.stop_called()); |
677 EXPECT_TRUE(stream2.start_called()); | 676 EXPECT_TRUE(stream2.start_called()); |
678 } | 677 } |
679 | 678 |
680 } // namespace media | 679 } // namespace media |
OLD | NEW |