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

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

Issue 9433006: Remove GetAudioManager and GetMediaStreamManager from ResourceContext. The reason is the content mo… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 10 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) 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/speech_recognizer.h" 8 #include "content/browser/speech/speech_recognizer.h"
9 #include "content/public/browser/speech_recognizer_delegate.h" 9 #include "content/public/browser/speech_recognizer_delegate.h"
10 #include "content/test/test_url_fetcher_factory.h" 10 #include "content/test/test_url_fetcher_factory.h"
(...skipping 17 matching lines...) Expand all
28 SpeechRecognizerTest() 28 SpeechRecognizerTest()
29 : io_thread_(BrowserThread::IO, &message_loop_), 29 : io_thread_(BrowserThread::IO, &message_loop_),
30 audio_manager_(AudioManager::Create()), 30 audio_manager_(AudioManager::Create()),
31 recording_complete_(false), 31 recording_complete_(false),
32 recognition_complete_(false), 32 recognition_complete_(false),
33 result_received_(false), 33 result_received_(false),
34 audio_received_(false), 34 audio_received_(false),
35 error_(content::SPEECH_INPUT_ERROR_NONE), 35 error_(content::SPEECH_INPUT_ERROR_NONE),
36 volume_(-1.0f) { 36 volume_(-1.0f) {
37 recognizer_ = new SpeechRecognizer(this, 1, std::string(), std::string(), 37 recognizer_ = new SpeechRecognizer(this, 1, std::string(), std::string(),
38 NULL, audio_manager_.get(), false, 38 NULL, false, std::string(),
39 std::string(), std::string()); 39 std::string());
40 recognizer_->SetAudioManagerForTesting(audio_manager_.get());
40 int audio_packet_length_bytes = 41 int audio_packet_length_bytes =
41 (SpeechRecognizer::kAudioSampleRate * 42 (SpeechRecognizer::kAudioSampleRate *
42 SpeechRecognizer::kAudioPacketIntervalMs * 43 SpeechRecognizer::kAudioPacketIntervalMs *
43 ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) * 44 ChannelLayoutToChannelCount(SpeechRecognizer::kChannelLayout) *
44 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000); 45 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000);
45 audio_packet_.resize(audio_packet_length_bytes); 46 audio_packet_.resize(audio_packet_length_bytes);
46 } 47 }
47 48
48 // Overridden from content::SpeechRecognizerDelegate: 49 // Overridden from content::SpeechRecognizerDelegate:
49 virtual void SetRecognitionResult( 50 virtual void SetRecognitionResult(
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 EXPECT_FLOAT_EQ(0.89926866f, volume_); 415 EXPECT_FLOAT_EQ(0.89926866f, volume_);
415 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); 416 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_);
416 417
417 EXPECT_EQ(content::SPEECH_INPUT_ERROR_NONE, error_); 418 EXPECT_EQ(content::SPEECH_INPUT_ERROR_NONE, error_);
418 EXPECT_FALSE(recording_complete_); 419 EXPECT_FALSE(recording_complete_);
419 EXPECT_FALSE(recognition_complete_); 420 EXPECT_FALSE(recognition_complete_);
420 recognizer_->CancelRecognition(); 421 recognizer_->CancelRecognition();
421 } 422 }
422 423
423 } // namespace speech_input 424 } // namespace speech_input
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer.cc ('k') | content/public/browser/browser_main_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698