OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <list> | 5 #include <list> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 &FeedSingleBufferToAudioController, | 165 &FeedSingleBufferToAudioController, |
166 scoped_refptr<media::TestAudioInputController>(controller), | 166 scoped_refptr<media::TestAudioInputController>(controller), |
167 buffer_size, | 167 buffer_size, |
168 feed_with_noise)); | 168 feed_with_noise)); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 SpeechRecognitionResult GetGoodSpeechResult() { | 172 SpeechRecognitionResult GetGoodSpeechResult() { |
173 SpeechRecognitionResult result; | 173 SpeechRecognitionResult result; |
174 result.hypotheses.push_back(SpeechRecognitionHypothesis( | 174 result.hypotheses.push_back(SpeechRecognitionHypothesis( |
175 UTF8ToUTF16("Pictures of the moon"), 1.0F)); | 175 base::UTF8ToUTF16("Pictures of the moon"), 1.0F)); |
176 return result; | 176 return result; |
177 } | 177 } |
178 | 178 |
179 StreamingServerState streaming_server_state_; | 179 StreamingServerState streaming_server_state_; |
180 scoped_ptr<MockGoogleStreamingServer> mock_streaming_server_; | 180 scoped_ptr<MockGoogleStreamingServer> mock_streaming_server_; |
181 media::TestAudioInputControllerFactory test_audio_input_controller_factory_; | 181 media::TestAudioInputControllerFactory test_audio_input_controller_factory_; |
182 }; | 182 }; |
183 | 183 |
184 // Simply loads the test page and checks if it was able to create a Speech | 184 // Simply loads the test page and checks if it was able to create a Speech |
185 // Recognition object in JavaScript, to make sure the Web Speech API is enabled. | 185 // Recognition object in JavaScript, to make sure the Web Speech API is enabled. |
186 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, Precheck) { | 186 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, Precheck) { |
187 NavigateToURLBlockUntilNavigationsComplete( | 187 NavigateToURLBlockUntilNavigationsComplete( |
188 shell(), GetTestUrlFromFragment("precheck"), 2); | 188 shell(), GetTestUrlFromFragment("precheck"), 2); |
189 | 189 |
190 EXPECT_EQ(kIdle, streaming_server_state()); | 190 EXPECT_EQ(kIdle, streaming_server_state()); |
191 EXPECT_EQ("success", GetPageFragment()); | 191 EXPECT_EQ("success", GetPageFragment()); |
192 } | 192 } |
193 | 193 |
194 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { | 194 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { |
195 NavigateToURLBlockUntilNavigationsComplete( | 195 NavigateToURLBlockUntilNavigationsComplete( |
196 shell(), GetTestUrlFromFragment("oneshot"), 2); | 196 shell(), GetTestUrlFromFragment("oneshot"), 2); |
197 | 197 |
198 EXPECT_EQ(kClientDisconnected, streaming_server_state()); | 198 EXPECT_EQ(kClientDisconnected, streaming_server_state()); |
199 EXPECT_EQ("goodresult1", GetPageFragment()); | 199 EXPECT_EQ("goodresult1", GetPageFragment()); |
200 } | 200 } |
201 | 201 |
202 } // namespace content | 202 } // namespace content |
OLD | NEW |