OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/media/capture/web_contents_audio_input_stream.h" | 5 #include "content/browser/media/capture/web_contents_audio_input_stream.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 VirtualAudioInputStream real_; | 154 VirtualAudioInputStream real_; |
155 bool real_stream_is_closed_; | 155 bool real_stream_is_closed_; |
156 | 156 |
157 DISALLOW_COPY_AND_ASSIGN(MockVirtualAudioInputStream); | 157 DISALLOW_COPY_AND_ASSIGN(MockVirtualAudioInputStream); |
158 }; | 158 }; |
159 | 159 |
160 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { | 160 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { |
161 public: | 161 public: |
162 MockAudioInputCallback() {} | 162 MockAudioInputCallback() {} |
163 | 163 |
164 MOCK_METHOD5(OnData, void(AudioInputStream* stream, const uint8* src, | 164 MOCK_METHOD4(OnData, |
165 uint32 size, uint32 hardware_delay_bytes, | 165 void(AudioInputStream* stream, |
166 double volume)); | 166 const media::AudioBus* src, |
| 167 uint32 hardware_delay_bytes, |
| 168 double volume)); |
167 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); | 169 MOCK_METHOD1(OnError, void(AudioInputStream* stream)); |
168 | 170 |
169 private: | 171 private: |
170 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); | 172 DISALLOW_COPY_AND_ASSIGN(MockAudioInputCallback); |
171 }; | 173 }; |
172 | 174 |
173 } // namespace | 175 } // namespace |
174 | 176 |
175 class WebContentsAudioInputStreamTest : public testing::Test { | 177 class WebContentsAudioInputStreamTest : public testing::Test { |
176 public: | 178 public: |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 .WillOnce(SaveArg<2>(&destination_)) | 233 .WillOnce(SaveArg<2>(&destination_)) |
232 .RetiresOnSaturation(); | 234 .RetiresOnSaturation(); |
233 // At Stop() time, or when the mirroring target changes: | 235 // At Stop() time, or when the mirroring target changes: |
234 EXPECT_CALL(*mock_mirroring_manager_, | 236 EXPECT_CALL(*mock_mirroring_manager_, |
235 StopMirroring(kRenderProcessId, kRenderViewId, NotNull())) | 237 StopMirroring(kRenderProcessId, kRenderViewId, NotNull())) |
236 .WillOnce(Assign( | 238 .WillOnce(Assign( |
237 &destination_, | 239 &destination_, |
238 static_cast<AudioMirroringManager::MirroringDestination*>(NULL))) | 240 static_cast<AudioMirroringManager::MirroringDestination*>(NULL))) |
239 .RetiresOnSaturation(); | 241 .RetiresOnSaturation(); |
240 | 242 |
241 EXPECT_CALL(mock_input_callback_, OnData(NotNull(), NotNull(), _, _, _)) | 243 EXPECT_CALL(mock_input_callback_, OnData(NotNull(), NotNull(), _, _)) |
242 .WillRepeatedly( | 244 .WillRepeatedly( |
243 InvokeWithoutArgs(&on_data_event_, &base::WaitableEvent::Signal)); | 245 InvokeWithoutArgs(&on_data_event_, &base::WaitableEvent::Signal)); |
244 | 246 |
245 wcais_->Start(&mock_input_callback_); | 247 wcais_->Start(&mock_input_callback_); |
246 | 248 |
247 // Test plumbing of volume controls and automatic gain controls. Calls to | 249 // Test plumbing of volume controls and automatic gain controls. Calls to |
248 // wcais_ methods should delegate directly to mock_vais_. | 250 // wcais_ methods should delegate directly to mock_vais_. |
249 EXPECT_CALL(*mock_vais_, GetVolume()); | 251 EXPECT_CALL(*mock_vais_, GetVolume()); |
250 double volume = wcais_->GetVolume(); | 252 double volume = wcais_->GetVolume(); |
251 EXPECT_CALL(*mock_vais_, GetMaxVolume()); | 253 EXPECT_CALL(*mock_vais_, GetMaxVolume()); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 WaitForData(); | 504 WaitForData(); |
503 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); | 505 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
504 WaitForData(); | 506 WaitForData(); |
505 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); | 507 RUN_ON_AUDIO_THREAD(ChangeMirroringTarget); |
506 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); | 508 RUN_ON_AUDIO_THREAD(RemoveOneInputInFIFOOrder); |
507 RUN_ON_AUDIO_THREAD(Stop); | 509 RUN_ON_AUDIO_THREAD(Stop); |
508 RUN_ON_AUDIO_THREAD(Close); | 510 RUN_ON_AUDIO_THREAD(Close); |
509 } | 511 } |
510 | 512 |
511 } // namespace content | 513 } // namespace content |
OLD | NEW |