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

Side by Side Diff: chrome/browser/speech/speech_recognizer_unittest.cc

Issue 6111009: Add the option of compressing speech input audio using FLAC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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 | « chrome/browser/speech/speech_recognizer.cc ('k') | chrome/chrome_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/browser_thread.h" 7 #include "chrome/browser/browser_thread.h"
8 #include "chrome/browser/speech/speech_recognizer.h" 8 #include "chrome/browser/speech/speech_recognizer.h"
9 #include "chrome/common/net/test_url_fetcher_factory.h" 9 #include "chrome/common/net/test_url_fetcher_factory.h"
10 #include "media/audio/test_audio_input_controller_factory.h" 10 #include "media/audio/test_audio_input_controller_factory.h"
(...skipping 20 matching lines...) Expand all
31 error_(SpeechRecognizer::RECOGNIZER_NO_ERROR), 31 error_(SpeechRecognizer::RECOGNIZER_NO_ERROR),
32 volume_(-1.0f) { 32 volume_(-1.0f) {
33 int audio_packet_length_bytes = 33 int audio_packet_length_bytes =
34 (SpeechRecognizer::kAudioSampleRate * 34 (SpeechRecognizer::kAudioSampleRate *
35 SpeechRecognizer::kAudioPacketIntervalMs * 35 SpeechRecognizer::kAudioPacketIntervalMs *
36 SpeechRecognizer::kNumAudioChannels * 36 SpeechRecognizer::kNumAudioChannels *
37 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000); 37 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000);
38 audio_packet_.resize(audio_packet_length_bytes); 38 audio_packet_.resize(audio_packet_length_bytes);
39 } 39 }
40 40
41 void StartTest() {
42 EXPECT_TRUE(recognizer_->StartRecording());
43 }
44
45 // SpeechRecognizer::Delegate methods. 41 // SpeechRecognizer::Delegate methods.
46 virtual void SetRecognitionResult(int caller_id, 42 virtual void SetRecognitionResult(int caller_id,
47 bool error, 43 bool error,
48 const SpeechInputResultArray& result) { 44 const SpeechInputResultArray& result) {
49 result_received_ = true; 45 result_received_ = true;
50 } 46 }
51 47
52 virtual void DidCompleteRecording(int caller_id) { 48 virtual void DidCompleteRecording(int caller_id) {
53 recording_complete_ = true; 49 recording_complete_ = true;
54 } 50 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 MessageLoop::current()->RunAllPending(); 290 MessageLoop::current()->RunAllPending();
295 EXPECT_FLOAT_EQ(0.9f, volume_); 291 EXPECT_FLOAT_EQ(0.9f, volume_);
296 292
297 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 293 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
298 EXPECT_FALSE(recording_complete_); 294 EXPECT_FALSE(recording_complete_);
299 EXPECT_FALSE(recognition_complete_); 295 EXPECT_FALSE(recognition_complete_);
300 recognizer_->CancelRecognition(); 296 recognizer_->CancelRecognition();
301 } 297 }
302 298
303 } // namespace speech_input 299 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_recognizer.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698