summaryrefslogtreecommitdiffstats
path: root/chrome/browser/speech/speech_input_extension_apitest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/speech/speech_input_extension_apitest.cc')
-rw-r--r--chrome/browser/speech/speech_input_extension_apitest.cc35
1 files changed, 20 insertions, 15 deletions
diff --git a/chrome/browser/speech/speech_input_extension_apitest.cc b/chrome/browser/speech/speech_input_extension_apitest.cc
index cf5e7a9..3718a03 100644
--- a/chrome/browser/speech/speech_input_extension_apitest.cc
+++ b/chrome/browser/speech/speech_input_extension_apitest.cc
@@ -23,6 +23,10 @@ namespace net {
class URLRequestContextGetter;
}
+namespace {
+const int kSessionIDForTests = 0;
+}
+
// Mock class used to test the extension speech input API.
class SpeechInputExtensionApiTest : public ExtensionApiTest,
public SpeechInputExtensionInterface {
@@ -77,10 +81,11 @@ class SpeechInputExtensionApiTest : public ExtensionApiTest,
virtual void StartRecording(
content::SpeechRecognitionEventListener* listener,
net::URLRequestContextGetter* context_getter,
- int session_id,
+ const string16& extension_name,
const std::string& language,
const std::string& grammar,
- bool filter_profanities) OVERRIDE;
+ bool filter_profanities,
+ bool show_notification) OVERRIDE;
virtual void StopRecording(bool recognition_failed) OVERRIDE;
@@ -107,7 +112,7 @@ class SpeechInputExtensionApiTest : public ExtensionApiTest,
};
private:
- void ProvideResults(int session_id);
+ void ProvideResults();
bool recording_devices_available_;
bool recognizer_is_valid_;
@@ -131,10 +136,11 @@ SpeechInputExtensionApiTest::~SpeechInputExtensionApiTest() {
void SpeechInputExtensionApiTest::StartRecording(
content::SpeechRecognitionEventListener* listener,
net::URLRequestContextGetter* context_getter,
- int session_id,
+ const string16& extension_name,
const std::string& language,
const std::string& grammar,
- bool filter_profanities) {
+ bool filter_profanities,
+ bool show_notification) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
recognizer_is_valid_ = true;
@@ -143,7 +149,7 @@ void SpeechInputExtensionApiTest::StartRecording(
FROM_HERE,
base::Bind(&SpeechInputExtensionManager::OnAudioStart,
GetManager(),
- session_id),
+ kSessionIDForTests),
base::TimeDelta());
// Notify sound start in the input device.
@@ -151,16 +157,14 @@ void SpeechInputExtensionApiTest::StartRecording(
FROM_HERE,
base::Bind(&SpeechInputExtensionManager::OnSoundStart,
GetManager(),
- session_id),
+ kSessionIDForTests),
base::TimeDelta());
if (result_delay_ms_ != kDontDispatchCall) {
// Dispatch the recognition results.
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- base::Bind(&SpeechInputExtensionApiTest::ProvideResults,
- this,
- session_id),
+ base::Bind(&SpeechInputExtensionApiTest::ProvideResults, this),
base::TimeDelta::FromMilliseconds(result_delay_ms_));
}
}
@@ -170,18 +174,19 @@ void SpeechInputExtensionApiTest::StopRecording(bool recognition_failed) {
recognizer_is_valid_ = false;
}
-void SpeechInputExtensionApiTest::ProvideResults(int session_id) {
+void SpeechInputExtensionApiTest::ProvideResults() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (next_error_ != content::SPEECH_RECOGNITION_ERROR_NONE) {
GetManager()->OnRecognitionError(
- session_id, content::SpeechRecognitionError(next_error_));
+ kSessionIDForTests, content::SpeechRecognitionError(next_error_));
return;
}
- GetManager()->OnSoundEnd(session_id);
- GetManager()->OnAudioEnd(session_id);
- GetManager()->OnRecognitionResult(session_id, next_result_);
+ GetManager()->OnSoundEnd(kSessionIDForTests);
+ GetManager()->OnAudioEnd(kSessionIDForTests);
+ GetManager()->OnRecognitionResult(kSessionIDForTests, next_result_);
+ GetManager()->OnRecognitionEnd(kSessionIDForTests);
}
// Every test should leave the manager in the idle state when finished.