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

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

Issue 4119004: Add ability to parse multiple recognition results and send them to WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move header to chrome/common and address review comments. Created 10 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/speech/speech_input_dispatcher_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/speech/speech_input_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698