| 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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 // SpeechRecognitionManager methods. | 70 // SpeechRecognitionManager methods. |
| 71 virtual int CreateSession( | 71 virtual int CreateSession( |
| 72 const content::SpeechRecognitionSessionConfig& config, | 72 const content::SpeechRecognitionSessionConfig& config, |
| 73 SpeechRecognitionEventListener* event_listener) OVERRIDE { | 73 SpeechRecognitionEventListener* event_listener) OVERRIDE { |
| 74 VLOG(1) << "FAKE CreateSession invoked."; | 74 VLOG(1) << "FAKE CreateSession invoked."; |
| 75 EXPECT_EQ(0, session_id_); | 75 EXPECT_EQ(0, session_id_); |
| 76 EXPECT_EQ(NULL, listener_); | 76 EXPECT_EQ(NULL, listener_); |
| 77 listener_ = event_listener; | 77 listener_ = event_listener; |
| 78 grammar_ = config.grammar; | 78 if (config.grammars.size() > 0) |
| 79 grammar_ = config.grammars[0].url; |
| 79 session_ctx_ = config.initial_context; | 80 session_ctx_ = config.initial_context; |
| 80 session_id_ = 1; | 81 session_id_ = 1; |
| 81 return session_id_; | 82 return session_id_; |
| 82 } | 83 } |
| 83 | 84 |
| 84 virtual void StartSession(int session_id) OVERRIDE { | 85 virtual void StartSession(int session_id) OVERRIDE { |
| 85 VLOG(1) << "FAKE StartSession invoked."; | 86 VLOG(1) << "FAKE StartSession invoked."; |
| 86 EXPECT_EQ(session_id, session_id_); | 87 EXPECT_EQ(session_id, session_id_); |
| 87 EXPECT_TRUE(listener_ != NULL); | 88 EXPECT_TRUE(listener_ != NULL); |
| 88 | 89 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 277 |
| 277 // Make the renderer crash. This should trigger | 278 // Make the renderer crash. This should trigger |
| 278 // InputTagSpeechDispatcherHost to cancel all pending sessions. | 279 // InputTagSpeechDispatcherHost to cancel all pending sessions. |
| 279 GURL test_url("about:crash"); | 280 GURL test_url("about:crash"); |
| 280 ui_test_utils::NavigateToURL(browser(), test_url); | 281 ui_test_utils::NavigateToURL(browser(), test_url); |
| 281 | 282 |
| 282 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); | 283 EXPECT_TRUE(fake_speech_recognition_manager_.did_cancel_all()); |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace speech | 286 } // namespace speech |
| OLD | NEW |