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

Unified Diff: content/browser/speech/speech_recognizer_unittest.cc

Issue 6615020: Stream speech audio to server as it gets recorded, instead of waiting until end of recording. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/speech_recognizer_unittest.cc
diff --git a/content/browser/speech/speech_recognizer_unittest.cc b/content/browser/speech/speech_recognizer_unittest.cc
index 4b162598e5db2f7ff0d348dbcdc7c887541bd772..e24873d35f56a89da976a2bfd52b91c15b9b0747 100644
--- a/content/browser/speech/speech_recognizer_unittest.cc
+++ b/content/browser/speech/speech_recognizer_unittest.cc
@@ -138,9 +138,21 @@ TEST_F(SpeechRecognizerTest, StopWithData) {
ASSERT_TRUE(controller);
controller = audio_input_controller_factory_.controller();
ASSERT_TRUE(controller);
- controller->event_handler()->OnData(controller, &audio_packet_[0],
- audio_packet_.size());
- MessageLoop::current()->RunAllPending();
+
+ // Try sending 5 chunks of mock audio data and verify that each of them
+ // resulted immediately in a packet sent out via the network. This verifies
+ // that we are streaming out encoded data as chunks without waiting for the
+ // full recording to complete.
+ const int kNumChunks = 5;
+ for (int i = 0; i < kNumChunks; ++i) {
bulach 2011/03/04 12:41:08 size_t both here and the const above (I think 153
+ controller->event_handler()->OnData(controller, &audio_packet_[0],
+ audio_packet_.size());
+ MessageLoop::current()->RunAllPending();
+ TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
+ ASSERT_TRUE(fetcher);
+ EXPECT_EQ(i + 1, fetcher->upload_chunks().size());
+ }
+
recognizer_->StopRecording();
EXPECT_TRUE(recording_complete_);
EXPECT_FALSE(recognition_complete_);
« content/browser/speech/speech_recognizer.cc ('K') | « content/browser/speech/speech_recognizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698