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

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

Issue 8137005: Applying changes to the existing speech input code to support the extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review and unit test fixes. Created 9 years, 2 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 virtual void ShowNoMicError(int caller_id) {} 110 virtual void ShowNoMicError(int caller_id) {}
111 virtual void ShowRecognizerError(int caller_id, 111 virtual void ShowRecognizerError(int caller_id,
112 SpeechRecognizer::ErrorCode error) {} 112 SpeechRecognizer::ErrorCode error) {}
113 virtual void DoClose(int caller_id) {} 113 virtual void DoClose(int caller_id) {}
114 114
115 private: 115 private:
116 void SetFakeRecognitionResult() { 116 void SetFakeRecognitionResult() {
117 if (caller_id_) { // Do a check in case we were cancelled.. 117 if (caller_id_) { // Do a check in case we were cancelled..
118 VLOG(1) << "Setting fake recognition result."; 118 VLOG(1) << "Setting fake recognition result.";
119 delegate_->DidCompleteRecording(caller_id_); 119 delegate_->DidCompleteRecording(caller_id_);
120 SpeechInputResultArray results; 120 SpeechInputResult results;
121 results.push_back(SpeechInputResultItem(ASCIIToUTF16(kTestResult), 1.0)); 121 results.stable.push_back(SpeechInputResultItem(
Satish 2011/10/06 09:09:06 did you mean '.hypotheses' here? I don't see a 'st
Leandro GraciĆ” Gil 2011/10/06 18:26:25 Done.
122 ASCIIToUTF16(kTestResult), 1.0));
122 delegate_->SetRecognitionResult(caller_id_, results); 123 delegate_->SetRecognitionResult(caller_id_, results);
123 delegate_->DidCompleteRecognition(caller_id_); 124 delegate_->DidCompleteRecognition(caller_id_);
124 caller_id_ = 0; 125 caller_id_ = 0;
125 delegate_ = NULL; 126 delegate_ = NULL;
126 VLOG(1) << "Finished setting fake recognition result."; 127 VLOG(1) << "Finished setting fake recognition result.";
127 } 128 }
128 } 129 }
129 130
130 int caller_id_; 131 int caller_id_;
131 Delegate* delegate_; 132 Delegate* delegate_;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 249
249 // Make the renderer crash. This should trigger SpeechInputDispatcherHost to 250 // Make the renderer crash. This should trigger SpeechInputDispatcherHost to
250 // cancel all pending sessions. 251 // cancel all pending sessions.
251 GURL test_url("about:crash"); 252 GURL test_url("about:crash");
252 ui_test_utils::NavigateToURL(browser(), test_url); 253 ui_test_utils::NavigateToURL(browser(), test_url);
253 254
254 EXPECT_TRUE(fake_speech_input_manager_.did_cancel_all()); 255 EXPECT_TRUE(fake_speech_input_manager_.did_cancel_all());
255 } 256 }
256 257
257 } // namespace speech_input 258 } // namespace speech_input
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698