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

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

Issue 7846007: net: Rename URLRequestStatus::os_error_. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix os_error_code Created 9 years, 3 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 recognizer_->StopRecording(); 214 recognizer_->StopRecording();
215 EXPECT_TRUE(audio_received_); 215 EXPECT_TRUE(audio_received_);
216 EXPECT_TRUE(recording_complete_); 216 EXPECT_TRUE(recording_complete_);
217 EXPECT_FALSE(recognition_complete_); 217 EXPECT_FALSE(recognition_complete_);
218 EXPECT_FALSE(result_received_); 218 EXPECT_FALSE(result_received_);
219 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 219 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
220 220
221 // Issue the network callback to complete the process. 221 // Issue the network callback to complete the process.
222 net::URLRequestStatus status; 222 net::URLRequestStatus status;
223 status.set_status(net::URLRequestStatus::FAILED); 223 status.set_status(net::URLRequestStatus::FAILED);
224 status.set_os_error(net::ERR_CONNECTION_REFUSED); 224 status.set_error(net::ERR_CONNECTION_REFUSED);
225 fetcher->delegate()->OnURLFetchComplete( 225 fetcher->delegate()->OnURLFetchComplete(
226 fetcher, fetcher->original_url(), status, 0, net::ResponseCookies(), ""); 226 fetcher, fetcher->original_url(), status, 0, net::ResponseCookies(), "");
227 EXPECT_FALSE(recognition_complete_); 227 EXPECT_FALSE(recognition_complete_);
228 EXPECT_FALSE(result_received_); 228 EXPECT_FALSE(result_received_);
229 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_ERROR_NETWORK, error_); 229 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_ERROR_NETWORK, error_);
230 } 230 }
231 231
232 TEST_F(SpeechRecognizerTest, ServerError) { 232 TEST_F(SpeechRecognizerTest, ServerError) {
233 // Start recording, give some data and then stop. Issue the network callback 233 // Start recording, give some data and then stop. Issue the network callback
234 // with a 500 error and verify that the recognizer bubbles the error up 234 // with a 500 error and verify that the recognizer bubbles the error up
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 EXPECT_FLOAT_EQ(0.89926866f, volume_); 390 EXPECT_FLOAT_EQ(0.89926866f, volume_);
391 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); 391 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_);
392 392
393 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 393 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
394 EXPECT_FALSE(recording_complete_); 394 EXPECT_FALSE(recording_complete_);
395 EXPECT_FALSE(recognition_complete_); 395 EXPECT_FALSE(recognition_complete_);
396 recognizer_->CancelRecognition(); 396 recognizer_->CancelRecognition();
397 } 397 }
398 398
399 } // namespace speech_input 399 } // namespace speech_input
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_unittest.cc ('k') | content/common/common_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698