Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: content/browser/speech/speech_recognizer_impl_unittest.cc

Issue 10233010: Introducing new data types and IPC messages for scripted JS speech recognition APIs (Speech CL2.0) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added CONTENT_EXPORT to SpeechRecognitionEngine::Config Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 recognition_started_(false), 101 recognition_started_(false),
102 recognition_ended_(false), 102 recognition_ended_(false),
103 result_received_(false), 103 result_received_(false),
104 audio_started_(false), 104 audio_started_(false),
105 audio_ended_(false), 105 audio_ended_(false),
106 sound_started_(false), 106 sound_started_(false),
107 sound_ended_(false), 107 sound_ended_(false),
108 error_(content::SPEECH_RECOGNITION_ERROR_NONE), 108 error_(content::SPEECH_RECOGNITION_ERROR_NONE),
109 volume_(-1.0f) { 109 volume_(-1.0f) {
110 // SpeechRecognizerImpl takes ownership of sr_engine. 110 // SpeechRecognizerImpl takes ownership of sr_engine.
111 GoogleOneShotRemoteEngine* sr_engine = 111 SpeechRecognitionEngine* sr_engine =
112 new GoogleOneShotRemoteEngine(NULL /* URLRequestContextGetter */); 112 new GoogleOneShotRemoteEngine(NULL /* URLRequestContextGetter */);
113 GoogleOneShotRemoteEngineConfig config; 113 SpeechRecognitionEngineConfig config;
114 config.audio_num_bits_per_sample = 114 config.audio_num_bits_per_sample =
115 SpeechRecognizerImpl::kNumBitsPerAudioSample; 115 SpeechRecognizerImpl::kNumBitsPerAudioSample;
116 config.audio_sample_rate = SpeechRecognizerImpl::kAudioSampleRate; 116 config.audio_sample_rate = SpeechRecognizerImpl::kAudioSampleRate;
117 config.filter_profanities = false; 117 config.filter_profanities = false;
118 sr_engine->SetConfig(config); 118 sr_engine->SetConfig(config);
119 119
120 recognizer_ = new SpeechRecognizerImpl(this, 1, sr_engine); 120 recognizer_ = new SpeechRecognizerImpl(this, 1, sr_engine);
121 recognizer_->SetAudioManagerForTesting(audio_manager_.get()); 121 recognizer_->SetAudioManagerForTesting(audio_manager_.get());
122 122
123 int audio_packet_length_bytes = 123 int audio_packet_length_bytes =
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 549
550 EXPECT_EQ(content::SPEECH_RECOGNITION_ERROR_NONE, error_); 550 EXPECT_EQ(content::SPEECH_RECOGNITION_ERROR_NONE, error_);
551 EXPECT_FALSE(audio_ended_); 551 EXPECT_FALSE(audio_ended_);
552 EXPECT_FALSE(recognition_ended_); 552 EXPECT_FALSE(recognition_ended_);
553 recognizer_->AbortRecognition(); 553 recognizer_->AbortRecognition();
554 MessageLoop::current()->RunAllPending(); 554 MessageLoop::current()->RunAllPending();
555 CheckFinalEventsConsistency(); 555 CheckFinalEventsConsistency();
556 } 556 }
557 557
558 } // namespace speech 558 } // namespace speech
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698