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 */); | |
296 TestDrivenAudioSource* const audio_source = new TestDrivenAudioSource(); | 295 TestDrivenAudioSource* const audio_source = new TestDrivenAudioSource(); |
297 audio_source->SetDeviceInfo( | 296 audio_source->SetDeviceInfo( |
298 StreamDeviceInfo(device_type, "Mock device", "mock_device_id")); | 297 StreamDeviceInfo(device_type, "Mock device", "mock_device_id")); |
299 blink_source.setExtraData(audio_source); // Takes ownership. | 298 blink_source.setExtraData(audio_source); // Takes ownership. |
300 | 299 |
301 blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), | 300 blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), |
302 blink_source); | 301 blink_source); |
303 ASSERT_TRUE(audio_source->ConnectToTrack(*blink_track)); | 302 ASSERT_TRUE(audio_source->ConnectToTrack(*blink_track)); |
304 } | 303 } |
305 | 304 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 const uint32_t buffers_per_notification = Initialize(44100, 441, 16000, 1600); | 538 const uint32_t buffers_per_notification = Initialize(44100, 441, 16000, 1600); |
540 AssertConsumedBuffers(0U); | 539 AssertConsumedBuffers(0U); |
541 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); | 540 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); |
542 EXPECT_CALL(*this, StoppedCallback()).Times(1); | 541 EXPECT_CALL(*this, StoppedCallback()).Times(1); |
543 | 542 |
544 native_track()->Stop(); | 543 native_track()->Stop(); |
545 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); | 544 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); |
546 } | 545 } |
547 | 546 |
548 } // namespace content | 547 } // namespace content |
OLD | NEW |