OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/media/speech_recognition_audio_sink.h" | 5 #include "content/renderer/media/speech_recognition_audio_sink.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 MOCK_METHOD0(StoppedCallback, void()); | 284 MOCK_METHOD0(StoppedCallback, void()); |
285 | 285 |
286 protected: | 286 protected: |
287 // Prepares a blink track of a given MediaStreamType and attaches the native | 287 // Prepares a blink track of a given MediaStreamType and attaches the native |
288 // track which can be used to capture audio data and pass it to the producer. | 288 // track which can be used to capture audio data and pass it to the producer. |
289 void PrepareBlinkTrackOfType(const MediaStreamType device_type, | 289 void PrepareBlinkTrackOfType(const MediaStreamType device_type, |
290 blink::WebMediaStreamTrack* blink_track) { | 290 blink::WebMediaStreamTrack* blink_track) { |
291 blink::WebMediaStreamSource blink_source; | 291 blink::WebMediaStreamSource blink_source; |
292 blink_source.initialize(blink::WebString::fromUTF8("dummy_source_id"), | 292 blink_source.initialize(blink::WebString::fromUTF8("dummy_source_id"), |
293 blink::WebMediaStreamSource::TypeAudio, | 293 blink::WebMediaStreamSource::TypeAudio, |
294 blink::WebString::fromUTF8("dummy_source_name")); | 294 blink::WebString::fromUTF8("dummy_source_name"), |
| 295 false /* remote */); |
295 TestDrivenAudioSource* const audio_source = new TestDrivenAudioSource(); | 296 TestDrivenAudioSource* const audio_source = new TestDrivenAudioSource(); |
296 audio_source->SetDeviceInfo( | 297 audio_source->SetDeviceInfo( |
297 StreamDeviceInfo(device_type, "Mock device", "mock_device_id")); | 298 StreamDeviceInfo(device_type, "Mock device", "mock_device_id")); |
298 blink_source.setExtraData(audio_source); // Takes ownership. | 299 blink_source.setExtraData(audio_source); // Takes ownership. |
299 | 300 |
300 blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), | 301 blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), |
301 blink_source); | 302 blink_source); |
302 ASSERT_TRUE(audio_source->ConnectToTrack(*blink_track)); | 303 ASSERT_TRUE(audio_source->ConnectToTrack(*blink_track)); |
303 } | 304 } |
304 | 305 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 const uint32_t buffers_per_notification = Initialize(44100, 441, 16000, 1600); | 539 const uint32_t buffers_per_notification = Initialize(44100, 441, 16000, 1600); |
539 AssertConsumedBuffers(0U); | 540 AssertConsumedBuffers(0U); |
540 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); | 541 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); |
541 EXPECT_CALL(*this, StoppedCallback()).Times(1); | 542 EXPECT_CALL(*this, StoppedCallback()).Times(1); |
542 | 543 |
543 native_track()->Stop(); | 544 native_track()->Stop(); |
544 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); | 545 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); |
545 } | 546 } |
546 | 547 |
547 } // namespace content | 548 } // namespace content |
OLD | NEW |