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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/renderer/media/media_stream_audio_source.h" | 9 #include "content/renderer/media/media_stream_audio_source.h" |
10 #include "content/renderer/media/mock_media_constraint_factory.h" | 10 #include "content/renderer/media/mock_media_constraint_factory.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 typedef std::map<MediaStreamType, bool> SupportedTrackPolicy; | 368 typedef std::map<MediaStreamType, bool> SupportedTrackPolicy; |
369 | 369 |
370 // This test must be aligned with the policy of supported tracks. | 370 // This test must be aligned with the policy of supported tracks. |
371 SupportedTrackPolicy p; | 371 SupportedTrackPolicy p; |
372 p[MEDIA_NO_SERVICE] = false; | 372 p[MEDIA_NO_SERVICE] = false; |
373 p[MEDIA_DEVICE_AUDIO_CAPTURE] = true; // The only one supported for now. | 373 p[MEDIA_DEVICE_AUDIO_CAPTURE] = true; // The only one supported for now. |
374 p[MEDIA_DEVICE_VIDEO_CAPTURE] = false; | 374 p[MEDIA_DEVICE_VIDEO_CAPTURE] = false; |
375 p[MEDIA_TAB_AUDIO_CAPTURE] = false; | 375 p[MEDIA_TAB_AUDIO_CAPTURE] = false; |
376 p[MEDIA_TAB_VIDEO_CAPTURE] = false; | 376 p[MEDIA_TAB_VIDEO_CAPTURE] = false; |
377 p[MEDIA_DESKTOP_VIDEO_CAPTURE] = false; | 377 p[MEDIA_DESKTOP_VIDEO_CAPTURE] = false; |
378 p[MEDIA_LOOPBACK_AUDIO_CAPTURE] = false; | 378 p[MEDIA_DESKTOP_AUDIO_CAPTURE] = false; |
379 p[MEDIA_DEVICE_AUDIO_OUTPUT] = false; | 379 p[MEDIA_DEVICE_AUDIO_OUTPUT] = false; |
380 | 380 |
381 // Ensure this test gets updated along with |content::MediaStreamType| enum. | 381 // Ensure this test gets updated along with |content::MediaStreamType| enum. |
382 EXPECT_EQ(NUM_MEDIA_TYPES, p.size()); | 382 EXPECT_EQ(NUM_MEDIA_TYPES, p.size()); |
383 | 383 |
384 // Check the the entire policy. | 384 // Check the the entire policy. |
385 for (SupportedTrackPolicy::iterator it = p.begin(); it != p.end(); ++it) { | 385 for (SupportedTrackPolicy::iterator it = p.begin(); it != p.end(); ++it) { |
386 blink::WebMediaStreamTrack blink_track; | 386 blink::WebMediaStreamTrack blink_track; |
387 PrepareBlinkTrackOfType(it->first, &blink_track); | 387 PrepareBlinkTrackOfType(it->first, &blink_track); |
388 ASSERT_EQ( | 388 ASSERT_EQ( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 const uint32 kBuffersPerNotification = Initialize(44100, 441, 16000, 1600); | 505 const uint32 kBuffersPerNotification = Initialize(44100, 441, 16000, 1600); |
506 AssertConsumedBuffers(0U); | 506 AssertConsumedBuffers(0U); |
507 CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); | 507 CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); |
508 EXPECT_CALL(*this, StoppedCallback()).Times(1); | 508 EXPECT_CALL(*this, StoppedCallback()).Times(1); |
509 | 509 |
510 native_track()->Stop(); | 510 native_track()->Stop(); |
511 CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); | 511 CaptureAudioAndAssertConsumedBuffers(kBuffersPerNotification, 1U); |
512 } | 512 } |
513 | 513 |
514 } // namespace content | 514 } // namespace content |
OLD | NEW |