OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
22 #include "content/public/common/speech_recognition_error.h" | 22 #include "content/public/common/speech_recognition_error.h" |
23 #include "content/public/common/speech_recognition_result.h" | 23 #include "content/public/common/speech_recognition_result.h" |
24 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
25 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
26 #include "content/shell/shell.h" | 26 #include "content/shell/shell.h" |
27 #include "content/test/content_browser_test.h" | 27 #include "content/test/content_browser_test.h" |
28 #include "content/test/content_browser_test_utils.h" | 28 #include "content/test/content_browser_test_utils.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
30 | 30 |
| 31 using content::NavigationController; |
31 using content::SpeechRecognitionEventListener; | 32 using content::SpeechRecognitionEventListener; |
32 using content::SpeechRecognitionSessionConfig; | 33 using content::SpeechRecognitionSessionConfig; |
33 using content::SpeechRecognitionSessionContext; | 34 using content::SpeechRecognitionSessionContext; |
34 using content::NavigationController; | |
35 using content::WebContents; | 35 using content::WebContents; |
36 | 36 |
37 namespace speech { | 37 namespace speech { |
38 class FakeSpeechRecognitionManager; | 38 class FakeSpeechRecognitionManager; |
39 } | 39 } |
40 | 40 |
41 namespace speech { | 41 namespace speech { |
42 | 42 |
43 const char kTestResult[] = "Pictures of the moon"; | 43 const char kTestResult[] = "Pictures of the moon"; |
44 | 44 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 RunSpeechRecognitionTest("basic_recognition.html"); | 269 RunSpeechRecognitionTest("basic_recognition.html"); |
270 EXPECT_TRUE(fake_speech_recognition_manager_.grammar().empty()); | 270 EXPECT_TRUE(fake_speech_recognition_manager_.grammar().empty()); |
271 } | 271 } |
272 | 272 |
273 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, GrammarAttribute) { | 273 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, GrammarAttribute) { |
274 RunSpeechRecognitionTest("grammar_attribute.html"); | 274 RunSpeechRecognitionTest("grammar_attribute.html"); |
275 EXPECT_EQ("http://example.com/grammar.xml", | 275 EXPECT_EQ("http://example.com/grammar.xml", |
276 fake_speech_recognition_manager_.grammar()); | 276 fake_speech_recognition_manager_.grammar()); |
277 } | 277 } |
278 | 278 |
279 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, TestCancelAll) { | 279 // Flaky on Linux and Windows, http://crbug.com/140765. |
| 280 #if defined(OS_WIN) || defined(OS_LINUX) |
| 281 #define MAYBE_TestCancelAll DISABLED_TestCancelAll |
| 282 #else |
| 283 #define MAYBE_TestCancelAll TestCancelAll |
| 284 #endif |
| 285 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, MAYBE_TestCancelAll) { |
280 // The test checks that the cancel-all callback gets issued when a session | 286 // The test checks that the cancel-all callback gets issued when a session |
281 // is pending, so don't send a fake response. | 287 // is pending, so don't send a fake response. |
282 // We are not expecting a navigation event being raised from the JS of the | 288 // We are not expecting a navigation event being raised from the JS of the |
283 // test page JavaScript in this case. | 289 // test page JavaScript in this case. |
284 fake_speech_recognition_manager_.set_should_send_fake_response(false); | 290 fake_speech_recognition_manager_.set_should_send_fake_response(false); |
285 | 291 |
286 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); | 292 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); |
287 | 293 |
288 // Make the renderer crash. This should trigger | 294 // Make the renderer crash. This should trigger |
289 // InputTagSpeechDispatcherHost to cancel all pending sessions. | 295 // InputTagSpeechDispatcherHost to cancel all pending sessions. |
290 content::NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); | 296 content::NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); |
291 | 297 |
292 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); | 298 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); |
293 } | 299 } |
294 | 300 |
295 } // namespace speech | 301 } // namespace speech |
OLD | NEW |