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

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

Issue 8137005: Applying changes to the existing speech input code to support the extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing unit tests. Created 9 years, 2 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
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 "content/browser/browser_thread.h" 7 #include "content/browser/browser_thread.h"
8 #include "content/browser/speech/speech_recognizer.h" 8 #include "content/browser/speech/speech_recognizer.h"
9 #include "content/test/test_url_fetcher_factory.h" 9 #include "content/test/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 26 matching lines...) Expand all
37 (SpeechRecognizer::kAudioSampleRate * 37 (SpeechRecognizer::kAudioSampleRate *
38 SpeechRecognizer::kAudioPacketIntervalMs * 38 SpeechRecognizer::kAudioPacketIntervalMs *
39 ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) * 39 ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) *
40 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000); 40 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000);
41 audio_packet_.resize(audio_packet_length_bytes); 41 audio_packet_.resize(audio_packet_length_bytes);
42 } 42 }
43 43
44 // SpeechRecognizer::Delegate methods. 44 // SpeechRecognizer::Delegate methods.
45 virtual void SetRecognitionResult(int caller_id, 45 virtual void SetRecognitionResult(int caller_id,
46 bool error, 46 bool error,
47 const SpeechInputResultArray& result) { 47 const SpeechInputResult& result) {
48 result_received_ = true; 48 result_received_ = true;
49 } 49 }
50 50
51 virtual void DidCompleteRecording(int caller_id) { 51 virtual void DidCompleteRecording(int caller_id) {
52 recording_complete_ = true; 52 recording_complete_ = true;
53 } 53 }
54 54
55 virtual void DidCompleteRecognition(int caller_id) { 55 virtual void DidCompleteRecognition(int caller_id) {
56 recognition_complete_ = true; 56 recognition_complete_ = true;
57 } 57 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 EXPECT_FLOAT_EQ(0.89926866f, volume_); 401 EXPECT_FLOAT_EQ(0.89926866f, volume_);
402 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); 402 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_);
403 403
404 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 404 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
405 EXPECT_FALSE(recording_complete_); 405 EXPECT_FALSE(recording_complete_);
406 EXPECT_FALSE(recognition_complete_); 406 EXPECT_FALSE(recognition_complete_);
407 recognizer_->CancelRecognition(); 407 recognizer_->CancelRecognition();
408 } 408 }
409 409
410 } // namespace speech_input 410 } // namespace speech_input
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698