| OLD | NEW |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 int render_view_id, | 102 int render_view_id, |
| 103 const gfx::Rect& element_rect) {} | 103 const gfx::Rect& element_rect) {} |
| 104 virtual void ShowWarmUp(int caller_id) {} | 104 virtual void ShowWarmUp(int caller_id) {} |
| 105 virtual void ShowRecognizing(int caller_id) {} | 105 virtual void ShowRecognizing(int caller_id) {} |
| 106 virtual void ShowRecording(int caller_id) {} | 106 virtual void ShowRecording(int caller_id) {} |
| 107 virtual void ShowInputVolume(int caller_id, | 107 virtual void ShowInputVolume(int caller_id, |
| 108 float volume, | 108 float volume, |
| 109 float noise_volume) {} | 109 float noise_volume) {} |
| 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 SpeechInputError 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.hypotheses.push_back(SpeechInputHypothesis( |
| 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 Loading... |
| 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 |
| OLD | NEW |