| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 VLOG(1) << "StopRecording invoked."; | 62 VLOG(1) << "StopRecording invoked."; |
| 63 EXPECT_EQ(caller_id_, caller_id); | 63 EXPECT_EQ(caller_id_, caller_id); |
| 64 // Nothing to do here since we aren't really recording. | 64 // Nothing to do here since we aren't really recording. |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 void SetFakeRecognitionResult() { | 68 void SetFakeRecognitionResult() { |
| 69 if (caller_id_) { // Do a check in case we were cancelled.. | 69 if (caller_id_) { // Do a check in case we were cancelled.. |
| 70 VLOG(1) << "Setting fake recognition result."; | 70 VLOG(1) << "Setting fake recognition result."; |
| 71 delegate_->DidCompleteRecording(caller_id_); | 71 delegate_->DidCompleteRecording(caller_id_); |
| 72 delegate_->SetRecognitionResult(caller_id_, | 72 SpeechInputResultArray results; |
| 73 ASCIIToUTF16(kTestResult)); | 73 results.push_back(SpeechInputResultItem(ASCIIToUTF16(kTestResult), 1.0)); |
| 74 delegate_->SetRecognitionResult(caller_id_, results); |
| 74 delegate_->DidCompleteRecognition(caller_id_); | 75 delegate_->DidCompleteRecognition(caller_id_); |
| 75 caller_id_ = 0; | 76 caller_id_ = 0; |
| 76 delegate_ = NULL; | 77 delegate_ = NULL; |
| 77 VLOG(1) << "Finished setting fake recognition result."; | 78 VLOG(1) << "Finished setting fake recognition result."; |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 int caller_id_; | 82 int caller_id_; |
| 82 Delegate* delegate_; | 83 Delegate* delegate_; |
| 83 }; | 84 }; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); | 135 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); |
| 135 | 136 |
| 136 // The above defined fake speech input manager would receive the speech input | 137 // The above defined fake speech input manager would receive the speech input |
| 137 // request and return the test string as recognition result. The test page | 138 // request and return the test string as recognition result. The test page |
| 138 // then sets the URL fragment as 'pass' if it received the expected string. | 139 // then sets the URL fragment as 'pass' if it received the expected string. |
| 139 ui_test_utils::WaitForNavigations(&tab_contents->controller(), 1); | 140 ui_test_utils::WaitForNavigations(&tab_contents->controller(), 1); |
| 140 EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); | 141 EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); |
| 141 } | 142 } |
| 142 | 143 |
| 143 } // namespace speech_input | 144 } // namespace speech_input |
| OLD | NEW |