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/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); | 157 EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); |
158 } | 158 } |
159 | 159 |
160 // InProcessBrowserTest methods. | 160 // InProcessBrowserTest methods. |
161 virtual void SetUpInProcessBrowserTestFixture() { | 161 virtual void SetUpInProcessBrowserTestFixture() { |
162 fake_speech_input_manager_.set_send_fake_response(true); | 162 fake_speech_input_manager_.set_send_fake_response(true); |
163 speech_input_manager_ = &fake_speech_input_manager_; | 163 speech_input_manager_ = &fake_speech_input_manager_; |
164 | 164 |
165 // Inject the fake manager factory so that the test result is returned to | 165 // Inject the fake manager factory so that the test result is returned to |
166 // the web page. | 166 // the web page. |
167 SpeechInputDispatcherHost::set_manager_accessor(&fakeManagerAccessor); | 167 SpeechInputDispatcherHost::set_manager(speech_input_manager_); |
168 } | 168 } |
169 | 169 |
170 virtual void TearDownInProcessBrowserTestFixture() { | 170 virtual void TearDownInProcessBrowserTestFixture() { |
171 speech_input_manager_ = NULL; | 171 speech_input_manager_ = NULL; |
172 } | 172 } |
173 | 173 |
174 // Factory method. | |
175 static SpeechInputManager* fakeManagerAccessor() { | |
176 return speech_input_manager_; | |
177 } | |
178 | |
179 FakeSpeechInputManager fake_speech_input_manager_; | 174 FakeSpeechInputManager fake_speech_input_manager_; |
180 | 175 |
181 // This is used by the static |fakeManagerAccessor|, and it is a pointer | 176 // This is used by the static |fakeManager|, and it is a pointer rather than a |
182 // rather than a direct instance per the style guide. | 177 // direct instance per the style guide. |
183 static SpeechInputManager* speech_input_manager_; | 178 static SpeechInputManager* speech_input_manager_; |
184 }; | 179 }; |
185 | 180 |
186 SpeechInputManager* SpeechInputBrowserTest::speech_input_manager_ = NULL; | 181 SpeechInputManager* SpeechInputBrowserTest::speech_input_manager_ = NULL; |
187 | 182 |
188 // Marked as DISABLED due to http://crbug.com/51337 | 183 // Marked as DISABLED due to http://crbug.com/51337 |
189 // | 184 // |
190 // TODO(satish): Once this flakiness has been fixed, add a second test here to | 185 // TODO(satish): Once this flakiness has been fixed, add a second test here to |
191 // check for sending many clicks in succession to the speech button and verify | 186 // check for sending many clicks in succession to the speech button and verify |
192 // that it doesn't cause any crash but works as expected. This should act as the | 187 // that it doesn't cause any crash but works as expected. This should act as the |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 226 |
232 // Make the renderer crash. This should trigger SpeechInputDispatcherHost to | 227 // Make the renderer crash. This should trigger SpeechInputDispatcherHost to |
233 // cancel all pending sessions. | 228 // cancel all pending sessions. |
234 GURL test_url("about:crash"); | 229 GURL test_url("about:crash"); |
235 ui_test_utils::NavigateToURL(browser(), test_url); | 230 ui_test_utils::NavigateToURL(browser(), test_url); |
236 | 231 |
237 EXPECT_TRUE(fake_speech_input_manager_.did_cancel_all()); | 232 EXPECT_TRUE(fake_speech_input_manager_.did_cancel_all()); |
238 } | 233 } |
239 | 234 |
240 } // namespace speech_input | 235 } // namespace speech_input |
OLD | NEW |