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