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

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

Issue 6166010: net: Remove typedef net::URLRequestStatus URLRequestStatus; (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
OLDNEW
1 // Copyright (c) 2010 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"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 MessageLoop::current()->RunAllPending(); 135 MessageLoop::current()->RunAllPending();
136 recognizer_->StopRecording(); 136 recognizer_->StopRecording();
137 EXPECT_TRUE(recording_complete_); 137 EXPECT_TRUE(recording_complete_);
138 EXPECT_FALSE(recognition_complete_); 138 EXPECT_FALSE(recognition_complete_);
139 EXPECT_FALSE(result_received_); 139 EXPECT_FALSE(result_received_);
140 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 140 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
141 141
142 // Issue the network callback to complete the process. 142 // Issue the network callback to complete the process.
143 TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); 143 TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
144 ASSERT_TRUE(fetcher); 144 ASSERT_TRUE(fetcher);
145 URLRequestStatus status; 145 net::URLRequestStatus status;
146 status.set_status(URLRequestStatus::SUCCESS); 146 status.set_status(net::URLRequestStatus::SUCCESS);
147 fetcher->delegate()->OnURLFetchComplete( 147 fetcher->delegate()->OnURLFetchComplete(
148 fetcher, fetcher->original_url(), status, 200, ResponseCookies(), 148 fetcher, fetcher->original_url(), status, 200, ResponseCookies(),
149 "{\"hypotheses\":[{\"utterance\":\"123\"}]}"); 149 "{\"hypotheses\":[{\"utterance\":\"123\"}]}");
150 EXPECT_TRUE(recognition_complete_); 150 EXPECT_TRUE(recognition_complete_);
151 EXPECT_TRUE(result_received_); 151 EXPECT_TRUE(result_received_);
152 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 152 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
153 } 153 }
154 154
155 TEST_F(SpeechRecognizerTest, CancelWithData) { 155 TEST_F(SpeechRecognizerTest, CancelWithData) {
156 // Start recording, give some data and then cancel. This should not create 156 // Start recording, give some data and then cancel. This should not create
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 MessageLoop::current()->RunAllPending(); 294 MessageLoop::current()->RunAllPending();
295 EXPECT_FLOAT_EQ(0.9f, volume_); 295 EXPECT_FLOAT_EQ(0.9f, volume_);
296 296
297 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_); 297 EXPECT_EQ(SpeechRecognizer::RECOGNIZER_NO_ERROR, error_);
298 EXPECT_FALSE(recording_complete_); 298 EXPECT_FALSE(recording_complete_);
299 EXPECT_FALSE(recognition_complete_); 299 EXPECT_FALSE(recognition_complete_);
300 recognizer_->CancelRecognition(); 300 recognizer_->CancelRecognition();
301 } 301 }
302 302
303 } // namespace speech_input 303 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_recognition_request_unittest.cc ('k') | chrome/browser/sync/glue/http_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698