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

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

Issue 7989001: Remove use of default request context and fix use of speech censor flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Separate overriden methods in profile_impl.h 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
« no previous file with comments | « content/browser/speech/speech_recognizer.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) 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"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using media::AudioInputController; 15 using media::AudioInputController;
16 using media::TestAudioInputController; 16 using media::TestAudioInputController;
17 using media::TestAudioInputControllerFactory; 17 using media::TestAudioInputControllerFactory;
18 18
19 namespace speech_input { 19 namespace speech_input {
20 20
21 class SpeechRecognizerTest : public SpeechRecognizerDelegate, 21 class SpeechRecognizerTest : public SpeechRecognizerDelegate,
22 public testing::Test { 22 public testing::Test {
23 public: 23 public:
24 SpeechRecognizerTest() 24 SpeechRecognizerTest()
25 : io_thread_(BrowserThread::IO, &message_loop_), 25 : io_thread_(BrowserThread::IO, &message_loop_),
26 ALLOW_THIS_IN_INITIALIZER_LIST( 26 ALLOW_THIS_IN_INITIALIZER_LIST(
27 recognizer_(new SpeechRecognizer(this, 1, std::string(), 27 recognizer_(new SpeechRecognizer(this, 1, std::string(),
28 std::string(), false, 28 std::string(), NULL, false,
29 std::string(), std::string()))), 29 std::string(), std::string()))),
30 recording_complete_(false), 30 recording_complete_(false),
31 recognition_complete_(false), 31 recognition_complete_(false),
32 result_received_(false), 32 result_received_(false),
33 audio_received_(false), 33 audio_received_(false),
34 error_(SpeechRecognizer::RECOGNIZER_NO_ERROR), 34 error_(SpeechRecognizer::RECOGNIZER_NO_ERROR),
35 volume_(-1.0f) { 35 volume_(-1.0f) {
36 int audio_packet_length_bytes = 36 int audio_packet_length_bytes =
37 (SpeechRecognizer::kAudioSampleRate * 37 (SpeechRecognizer::kAudioSampleRate *
38 SpeechRecognizer::kAudioPacketIntervalMs * 38 SpeechRecognizer::kAudioPacketIntervalMs *
(...skipping 362 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
« no previous file with comments | « content/browser/speech/speech_recognizer.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698