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

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

Issue 6308009: If user had consented for metrics reporting, send speech input request origin to the server. (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_common.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"
11 #include "net/url_request/url_request_status.h" 11 #include "net/url_request/url_request_status.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 using media::AudioInputController; 14 using media::AudioInputController;
15 using media::TestAudioInputController; 15 using media::TestAudioInputController;
16 using media::TestAudioInputControllerFactory; 16 using media::TestAudioInputControllerFactory;
17 17
18 namespace speech_input { 18 namespace speech_input {
19 19
20 class SpeechRecognizerTest : public SpeechRecognizerDelegate, 20 class SpeechRecognizerTest : public SpeechRecognizerDelegate,
21 public testing::Test { 21 public testing::Test {
22 public: 22 public:
23 SpeechRecognizerTest() 23 SpeechRecognizerTest()
24 : io_thread_(BrowserThread::IO, &message_loop_), 24 : io_thread_(BrowserThread::IO, &message_loop_),
25 ALLOW_THIS_IN_INITIALIZER_LIST( 25 ALLOW_THIS_IN_INITIALIZER_LIST(
26 recognizer_(new SpeechRecognizer(this, 1, std::string(), 26 recognizer_(new SpeechRecognizer(this, 1, std::string(),
27 std::string(), std::string()))), 27 std::string(), std::string(),
28 std::string()))),
28 recording_complete_(false), 29 recording_complete_(false),
29 recognition_complete_(false), 30 recognition_complete_(false),
30 result_received_(false), 31 result_received_(false),
31 error_(SpeechRecognizer::RECOGNIZER_NO_ERROR), 32 error_(SpeechRecognizer::RECOGNIZER_NO_ERROR),
32 volume_(-1.0f) { 33 volume_(-1.0f) {
33 int audio_packet_length_bytes = 34 int audio_packet_length_bytes =
34 (SpeechRecognizer::kAudioSampleRate * 35 (SpeechRecognizer::kAudioSampleRate *
35 SpeechRecognizer::kAudioPacketIntervalMs * 36 SpeechRecognizer::kAudioPacketIntervalMs *
36 SpeechRecognizer::kNumAudioChannels * 37 SpeechRecognizer::kNumAudioChannels *
37 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000); 38 SpeechRecognizer::kNumBitsPerAudioSample) / (8 * 1000);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 MessageLoop::current()->RunAllPending(); 291 MessageLoop::current()->RunAllPending();
291 EXPECT_FLOAT_EQ(0.9f, volume_); 292 EXPECT_FLOAT_EQ(0.9f, volume_);
292 293
293 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 294 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
294 EXPECT_FALSE(recording_complete_); 295 EXPECT_FALSE(recording_complete_);
295 EXPECT_FALSE(recognition_complete_); 296 EXPECT_FALSE(recognition_complete_);
296 recognizer_->CancelRecognition(); 297 recognizer_->CancelRecognition();
297 } 298 }
298 299
299 } // namespace speech_input 300 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_recognizer.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698