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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
8 #include "content/browser/speech/google_one_shot_remote_engine.h" | 8 #include "content/browser/speech/google_one_shot_remote_engine.h" |
9 #include "content/browser/speech/speech_recognizer_impl.h" | 9 #include "content/browser/speech/speech_recognizer_impl.h" |
10 #include "content/public/browser/speech_recognition_event_listener.h" | 10 #include "content/public/browser/speech_recognition_event_listener.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 sound_started_ = true; | 140 sound_started_ = true; |
141 CheckEventsConsistency(); | 141 CheckEventsConsistency(); |
142 } | 142 } |
143 | 143 |
144 void OnSoundEnd(int session_id) override { | 144 void OnSoundEnd(int session_id) override { |
145 sound_ended_ = true; | 145 sound_ended_ = true; |
146 CheckEventsConsistency(); | 146 CheckEventsConsistency(); |
147 } | 147 } |
148 | 148 |
149 // testing::Test methods. | 149 // testing::Test methods. |
150 virtual void SetUp() override { | 150 void SetUp() override { |
151 AudioInputController::set_factory_for_testing( | 151 AudioInputController::set_factory_for_testing( |
152 &audio_input_controller_factory_); | 152 &audio_input_controller_factory_); |
153 } | 153 } |
154 | 154 |
155 virtual void TearDown() override { | 155 void TearDown() override { |
156 AudioInputController::set_factory_for_testing(NULL); | 156 AudioInputController::set_factory_for_testing(NULL); |
157 } | 157 } |
158 | 158 |
159 void CopyPacketToAudioBus() { | 159 void CopyPacketToAudioBus() { |
160 // Copy the created signal into an audio bus in a deinterleaved format. | 160 // Copy the created signal into an audio bus in a deinterleaved format. |
161 audio_bus_->FromInterleaved( | 161 audio_bus_->FromInterleaved( |
162 &audio_packet_[0], audio_bus_->frames(), bytes_per_sample_); | 162 &audio_packet_[0], audio_bus_->frames(), bytes_per_sample_); |
163 } | 163 } |
164 | 164 |
165 void FillPacketWithTestWaveform() { | 165 void FillPacketWithTestWaveform() { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 499 |
500 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); | 500 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); |
501 EXPECT_FALSE(audio_ended_); | 501 EXPECT_FALSE(audio_ended_); |
502 EXPECT_FALSE(recognition_ended_); | 502 EXPECT_FALSE(recognition_ended_); |
503 recognizer_->AbortRecognition(); | 503 recognizer_->AbortRecognition(); |
504 base::MessageLoop::current()->RunUntilIdle(); | 504 base::MessageLoop::current()->RunUntilIdle(); |
505 CheckFinalEventsConsistency(); | 505 CheckFinalEventsConsistency(); |
506 } | 506 } |
507 | 507 |
508 } // namespace content | 508 } // namespace content |
OLD | NEW |