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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/browser/renderer_host/render_view_host_impl.h" | 11 #include "content/browser/renderer_host/render_view_host_impl.h" |
12 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
13 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
16 #include "content/public/common/speech_recognition_error.h" | 16 #include "content/public/common/speech_recognition_error.h" |
17 #include "content/public/common/speech_recognition_result.h" | 17 #include "content/public/common/speech_recognition_result.h" |
18 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
19 #include "content/public/test/fake_speech_recognition_manager.h" | 19 #include "content/public/test/fake_speech_recognition_manager.h" |
20 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
21 #include "content/shell/shell.h" | 21 #include "content/shell/shell.h" |
22 #include "content/test/content_browser_test.h" | 22 #include "content/test/content_browser_test.h" |
23 #include "content/test/content_browser_test_utils.h" | 23 #include "content/test/content_browser_test_utils.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
25 | 25 |
26 | |
27 namespace content { | 26 namespace content { |
28 | 27 |
29 | |
30 class SpeechRecognitionBrowserTest : public ContentBrowserTest { | 28 class SpeechRecognitionBrowserTest : public ContentBrowserTest { |
31 public: | 29 public: |
32 // ContentBrowserTest methods | 30 // ContentBrowserTest methods |
33 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 31 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
34 EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableSpeechInput)); | 32 EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableSpeechInput)); |
35 } | 33 } |
36 | 34 |
37 protected: | 35 protected: |
38 void LoadAndStartSpeechRecognitionTest(const char* filename) { | 36 void LoadAndStartSpeechRecognitionTest(const char* filename) { |
39 // The test page calculates the speech button's coordinate in the page on | 37 // The test page calculates the speech button's coordinate in the page on |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // The test checks that the cancel-all callback gets issued when a session | 121 // The test checks that the cancel-all callback gets issued when a session |
124 // is pending, so don't send a fake response. | 122 // is pending, so don't send a fake response. |
125 // We are not expecting a navigation event being raised from the JS of the | 123 // We are not expecting a navigation event being raised from the JS of the |
126 // test page JavaScript in this case. | 124 // test page JavaScript in this case. |
127 fake_speech_recognition_manager_.set_should_send_fake_response(false); | 125 fake_speech_recognition_manager_.set_should_send_fake_response(false); |
128 | 126 |
129 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); | 127 LoadAndStartSpeechRecognitionTest("basic_recognition.html"); |
130 | 128 |
131 // Make the renderer crash. This should trigger | 129 // Make the renderer crash. This should trigger |
132 // InputTagSpeechDispatcherHost to cancel all pending sessions. | 130 // InputTagSpeechDispatcherHost to cancel all pending sessions. |
133 NavigateToURL(shell(), GURL(chrome::kChromeUICrashURL)); | 131 NavigateToURL(shell(), GURL(kChromeUICrashURL)); |
134 | 132 |
135 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); | 133 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); |
136 } | 134 } |
137 | 135 |
138 } // namespace content | 136 } // namespace content |
OLD | NEW |