OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 9 #include "content/browser/speech/speech_recognizer.h" |
10 #include "content/public/browser/speech_recognition_event_listener.h" | 10 #include "content/public/browser/speech_recognition_event_listener.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 config.audio_num_bits_per_sample = SpeechRecognizer::kNumBitsPerAudioSample; | 49 config.audio_num_bits_per_sample = SpeechRecognizer::kNumBitsPerAudioSample; |
50 config.audio_sample_rate = SpeechRecognizer::kAudioSampleRate; | 50 config.audio_sample_rate = SpeechRecognizer::kAudioSampleRate; |
51 config.filter_profanities = false; | 51 config.filter_profanities = false; |
52 sr_engine->SetConfig(config); | 52 sr_engine->SetConfig(config); |
53 | 53 |
54 const int kTestingSessionId = 1; | 54 const int kTestingSessionId = 1; |
55 const bool kOneShotMode = true; | 55 const bool kOneShotMode = true; |
56 recognizer_ = new SpeechRecognizer( | 56 recognizer_ = new SpeechRecognizer( |
57 this, kTestingSessionId, kOneShotMode, sr_engine); | 57 this, kTestingSessionId, kOneShotMode, sr_engine); |
58 audio_manager_.reset(new media::MockAudioManager( | 58 audio_manager_.reset(new media::MockAudioManager( |
59 MessageLoop::current()->message_loop_proxy())); | 59 MessageLoop::current()->message_loop_proxy().get())); |
60 recognizer_->SetAudioManagerForTests(audio_manager_.get()); | 60 recognizer_->SetAudioManagerForTests(audio_manager_.get()); |
61 | 61 |
62 int audio_packet_length_bytes = | 62 int audio_packet_length_bytes = |
63 (SpeechRecognizer::kAudioSampleRate * | 63 (SpeechRecognizer::kAudioSampleRate * |
64 GoogleOneShotRemoteEngine::kAudioPacketIntervalMs * | 64 GoogleOneShotRemoteEngine::kAudioPacketIntervalMs * |
65 ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) * | 65 ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) * |
66 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000); | 66 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000); |
67 audio_packet_.resize(audio_packet_length_bytes); | 67 audio_packet_.resize(audio_packet_length_bytes); |
68 } | 68 } |
69 | 69 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); | 489 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); |
490 EXPECT_FALSE(audio_ended_); | 490 EXPECT_FALSE(audio_ended_); |
491 EXPECT_FALSE(recognition_ended_); | 491 EXPECT_FALSE(recognition_ended_); |
492 recognizer_->AbortRecognition(); | 492 recognizer_->AbortRecognition(); |
493 MessageLoop::current()->RunAllPending(); | 493 MessageLoop::current()->RunAllPending(); |
494 CheckFinalEventsConsistency(); | 494 CheckFinalEventsConsistency(); |
495 } | 495 } |
496 | 496 |
497 } // namespace content | 497 } // namespace content |
OLD | NEW |