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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 const int kTestingSessionId = 1; | 66 const int kTestingSessionId = 1; |
67 | 67 |
68 audio_thread_.StartAndWaitForTesting(); | 68 audio_thread_.StartAndWaitForTesting(); |
69 audio_manager_.reset( | 69 audio_manager_.reset( |
70 new media::MockAudioManager(audio_thread_.task_runner())); | 70 new media::MockAudioManager(audio_thread_.task_runner())); |
71 audio_manager_->SetInputStreamParameters( | 71 audio_manager_->SetInputStreamParameters( |
72 media::AudioParameters::UnavailableDeviceParams()); | 72 media::AudioParameters::UnavailableDeviceParams()); |
73 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); | 73 audio_system_ = media::AudioSystemImpl::Create(audio_manager_.get()); |
74 recognizer_ = new SpeechRecognizerImpl( | 74 recognizer_ = new SpeechRecognizerImpl( |
75 this, audio_system_.get(), kTestingSessionId, false, false, sr_engine); | 75 this, audio_system_.get(), audio_manager_.get(), kTestingSessionId, |
| 76 false, false, sr_engine); |
76 | 77 |
77 int audio_packet_length_bytes = | 78 int audio_packet_length_bytes = |
78 (SpeechRecognizerImpl::kAudioSampleRate * | 79 (SpeechRecognizerImpl::kAudioSampleRate * |
79 SpeechRecognitionEngine::kAudioPacketIntervalMs * | 80 SpeechRecognitionEngine::kAudioPacketIntervalMs * |
80 ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout) * | 81 ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout) * |
81 SpeechRecognizerImpl::kNumBitsPerAudioSample) / (8 * 1000); | 82 SpeechRecognizerImpl::kNumBitsPerAudioSample) / (8 * 1000); |
82 audio_packet_.resize(audio_packet_length_bytes); | 83 audio_packet_.resize(audio_packet_length_bytes); |
83 | 84 |
84 const int channels = | 85 const int channels = |
85 ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout); | 86 ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 649 |
649 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); | 650 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); |
650 EXPECT_FALSE(audio_ended_); | 651 EXPECT_FALSE(audio_ended_); |
651 EXPECT_FALSE(recognition_ended_); | 652 EXPECT_FALSE(recognition_ended_); |
652 recognizer_->AbortRecognition(); | 653 recognizer_->AbortRecognition(); |
653 base::RunLoop().RunUntilIdle(); | 654 base::RunLoop().RunUntilIdle(); |
654 CheckFinalEventsConsistency(); | 655 CheckFinalEventsConsistency(); |
655 } | 656 } |
656 | 657 |
657 } // namespace content | 658 } // namespace content |
OLD | NEW |