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

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

Issue 12611030: Remove unused parameter to OnError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits + rebase Created 7 years, 9 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
« no previous file with comments | « content/browser/speech/speech_recognizer.cc ('k') | media/audio/android/opensles_input.cc » ('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) 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/google_one_shot_remote_engine.h" 8 #include "content/browser/speech/google_one_shot_remote_engine.h"
9 #include "content/browser/speech/speech_recognizer.h" 9 #include "content/browser/speech/speech_recognizer.h"
10 #include "content/public/browser/speech_recognition_event_listener.h" 10 #include "content/public/browser/speech_recognition_event_listener.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 CheckFinalEventsConsistency(); 351 CheckFinalEventsConsistency();
352 } 352 }
353 353
354 TEST_F(SpeechRecognizerTest, AudioControllerErrorNoData) { 354 TEST_F(SpeechRecognizerTest, AudioControllerErrorNoData) {
355 // Check if things tear down properly if AudioInputController threw an error. 355 // Check if things tear down properly if AudioInputController threw an error.
356 recognizer_->StartRecognition(); 356 recognizer_->StartRecognition();
357 MessageLoop::current()->RunUntilIdle(); 357 MessageLoop::current()->RunUntilIdle();
358 TestAudioInputController* controller = 358 TestAudioInputController* controller =
359 audio_input_controller_factory_.controller(); 359 audio_input_controller_factory_.controller();
360 ASSERT_TRUE(controller); 360 ASSERT_TRUE(controller);
361 controller->event_handler()->OnError(controller, 0); 361 controller->event_handler()->OnError(controller);
362 MessageLoop::current()->RunUntilIdle(); 362 MessageLoop::current()->RunUntilIdle();
363 EXPECT_TRUE(recognition_started_); 363 EXPECT_TRUE(recognition_started_);
364 EXPECT_FALSE(audio_started_); 364 EXPECT_FALSE(audio_started_);
365 EXPECT_FALSE(result_received_); 365 EXPECT_FALSE(result_received_);
366 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_AUDIO, error_); 366 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_AUDIO, error_);
367 CheckFinalEventsConsistency(); 367 CheckFinalEventsConsistency();
368 } 368 }
369 369
370 TEST_F(SpeechRecognizerTest, AudioControllerErrorWithData) { 370 TEST_F(SpeechRecognizerTest, AudioControllerErrorWithData) {
371 // Check if things tear down properly if AudioInputController threw an error 371 // Check if things tear down properly if AudioInputController threw an error
372 // after giving some audio data. 372 // after giving some audio data.
373 recognizer_->StartRecognition(); 373 recognizer_->StartRecognition();
374 MessageLoop::current()->RunUntilIdle(); 374 MessageLoop::current()->RunUntilIdle();
375 TestAudioInputController* controller = 375 TestAudioInputController* controller =
376 audio_input_controller_factory_.controller(); 376 audio_input_controller_factory_.controller();
377 ASSERT_TRUE(controller); 377 ASSERT_TRUE(controller);
378 controller->event_handler()->OnData(controller, &audio_packet_[0], 378 controller->event_handler()->OnData(controller, &audio_packet_[0],
379 audio_packet_.size()); 379 audio_packet_.size());
380 controller->event_handler()->OnError(controller, 0); 380 controller->event_handler()->OnError(controller);
381 MessageLoop::current()->RunUntilIdle(); 381 MessageLoop::current()->RunUntilIdle();
382 ASSERT_TRUE(url_fetcher_factory_.GetFetcherByID(0)); 382 ASSERT_TRUE(url_fetcher_factory_.GetFetcherByID(0));
383 EXPECT_TRUE(recognition_started_); 383 EXPECT_TRUE(recognition_started_);
384 EXPECT_TRUE(audio_started_); 384 EXPECT_TRUE(audio_started_);
385 EXPECT_FALSE(result_received_); 385 EXPECT_FALSE(result_received_);
386 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_AUDIO, error_); 386 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_AUDIO, error_);
387 CheckFinalEventsConsistency(); 387 CheckFinalEventsConsistency();
388 } 388 }
389 389
390 TEST_F(SpeechRecognizerTest, NoSpeechCallbackIssued) { 390 TEST_F(SpeechRecognizerTest, NoSpeechCallbackIssued) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); 489 EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_);
490 EXPECT_FALSE(audio_ended_); 490 EXPECT_FALSE(audio_ended_);
491 EXPECT_FALSE(recognition_ended_); 491 EXPECT_FALSE(recognition_ended_);
492 recognizer_->AbortRecognition(); 492 recognizer_->AbortRecognition();
493 MessageLoop::current()->RunUntilIdle(); 493 MessageLoop::current()->RunUntilIdle();
494 CheckFinalEventsConsistency(); 494 CheckFinalEventsConsistency();
495 } 495 }
496 496
497 } // namespace content 497 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer.cc ('k') | media/audio/android/opensles_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698