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

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

Issue 8416020: Handle additional feedback from http://codereview.chromium.org/8395038/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 EXPECT_TRUE(audio_received_); 169 EXPECT_TRUE(audio_received_);
170 EXPECT_TRUE(recording_complete_); 170 EXPECT_TRUE(recording_complete_);
171 EXPECT_FALSE(recognition_complete_); 171 EXPECT_FALSE(recognition_complete_);
172 EXPECT_FALSE(result_received_); 172 EXPECT_FALSE(result_received_);
173 EXPECT_EQ(kErrorNone, error_); 173 EXPECT_EQ(kErrorNone, error_);
174 174
175 // Issue the network callback to complete the process. 175 // Issue the network callback to complete the process.
176 TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); 176 TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
177 ASSERT_TRUE(fetcher); 177 ASSERT_TRUE(fetcher);
178 178
179 fetcher->set_url(fetcher->GetOriginalUrl()); 179 fetcher->set_url(fetcher->GetOriginalURL());
180 net::URLRequestStatus status; 180 net::URLRequestStatus status;
181 status.set_status(net::URLRequestStatus::SUCCESS); 181 status.set_status(net::URLRequestStatus::SUCCESS);
182 fetcher->set_status(status); 182 fetcher->set_status(status);
183 fetcher->set_response_code(200); 183 fetcher->set_response_code(200);
184 fetcher->SetResponseString( 184 fetcher->SetResponseString(
185 "{\"status\":0,\"hypotheses\":[{\"utterance\":\"123\"}]}"); 185 "{\"status\":0,\"hypotheses\":[{\"utterance\":\"123\"}]}");
186 fetcher->delegate()->OnURLFetchComplete(fetcher); 186 fetcher->delegate()->OnURLFetchComplete(fetcher);
187 187
188 EXPECT_TRUE(recognition_complete_); 188 EXPECT_TRUE(recognition_complete_);
189 EXPECT_TRUE(result_received_); 189 EXPECT_TRUE(result_received_);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ASSERT_TRUE(fetcher); 223 ASSERT_TRUE(fetcher);
224 224
225 recognizer_->StopRecording(); 225 recognizer_->StopRecording();
226 EXPECT_TRUE(audio_received_); 226 EXPECT_TRUE(audio_received_);
227 EXPECT_TRUE(recording_complete_); 227 EXPECT_TRUE(recording_complete_);
228 EXPECT_FALSE(recognition_complete_); 228 EXPECT_FALSE(recognition_complete_);
229 EXPECT_FALSE(result_received_); 229 EXPECT_FALSE(result_received_);
230 EXPECT_EQ(kErrorNone, error_); 230 EXPECT_EQ(kErrorNone, error_);
231 231
232 // Issue the network callback to complete the process. 232 // Issue the network callback to complete the process.
233 fetcher->set_url(fetcher->GetOriginalUrl()); 233 fetcher->set_url(fetcher->GetOriginalURL());
234 net::URLRequestStatus status; 234 net::URLRequestStatus status;
235 status.set_status(net::URLRequestStatus::FAILED); 235 status.set_status(net::URLRequestStatus::FAILED);
236 status.set_error(net::ERR_CONNECTION_REFUSED); 236 status.set_error(net::ERR_CONNECTION_REFUSED);
237 fetcher->set_status(status); 237 fetcher->set_status(status);
238 fetcher->set_response_code(0); 238 fetcher->set_response_code(0);
239 fetcher->SetResponseString(""); 239 fetcher->SetResponseString("");
240 fetcher->delegate()->OnURLFetchComplete(fetcher); 240 fetcher->delegate()->OnURLFetchComplete(fetcher);
241 241
242 EXPECT_FALSE(recognition_complete_); 242 EXPECT_FALSE(recognition_complete_);
243 EXPECT_FALSE(result_received_); 243 EXPECT_FALSE(result_received_);
(...skipping 14 matching lines...) Expand all
258 ASSERT_TRUE(fetcher); 258 ASSERT_TRUE(fetcher);
259 259
260 recognizer_->StopRecording(); 260 recognizer_->StopRecording();
261 EXPECT_TRUE(audio_received_); 261 EXPECT_TRUE(audio_received_);
262 EXPECT_TRUE(recording_complete_); 262 EXPECT_TRUE(recording_complete_);
263 EXPECT_FALSE(recognition_complete_); 263 EXPECT_FALSE(recognition_complete_);
264 EXPECT_FALSE(result_received_); 264 EXPECT_FALSE(result_received_);
265 EXPECT_EQ(kErrorNone, error_); 265 EXPECT_EQ(kErrorNone, error_);
266 266
267 // Issue the network callback to complete the process. 267 // Issue the network callback to complete the process.
268 fetcher->set_url(fetcher->GetOriginalUrl()); 268 fetcher->set_url(fetcher->GetOriginalURL());
269 net::URLRequestStatus status; 269 net::URLRequestStatus status;
270 status.set_status(net::URLRequestStatus::SUCCESS); 270 status.set_status(net::URLRequestStatus::SUCCESS);
271 fetcher->set_status(status); 271 fetcher->set_status(status);
272 fetcher->set_response_code(500); 272 fetcher->set_response_code(500);
273 fetcher->SetResponseString("Internal Server Error"); 273 fetcher->SetResponseString("Internal Server Error");
274 fetcher->delegate()->OnURLFetchComplete(fetcher); 274 fetcher->delegate()->OnURLFetchComplete(fetcher);
275 275
276 EXPECT_FALSE(recognition_complete_); 276 EXPECT_FALSE(recognition_complete_);
277 EXPECT_FALSE(result_received_); 277 EXPECT_FALSE(result_received_);
278 EXPECT_EQ(kErrorNetwork, error_); 278 EXPECT_EQ(kErrorNetwork, error_);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 EXPECT_FLOAT_EQ(0.89926866f, volume_); 408 EXPECT_FLOAT_EQ(0.89926866f, volume_);
409 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); 409 EXPECT_FLOAT_EQ(0.75071919f, noise_volume_);
410 410
411 EXPECT_EQ(kErrorNone, error_); 411 EXPECT_EQ(kErrorNone, error_);
412 EXPECT_FALSE(recording_complete_); 412 EXPECT_FALSE(recording_complete_);
413 EXPECT_FALSE(recognition_complete_); 413 EXPECT_FALSE(recognition_complete_);
414 recognizer_->CancelRecognition(); 414 recognizer_->CancelRecognition();
415 } 415 }
416 416
417 } // namespace speech_input 417 } // namespace speech_input
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698