Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: chrome/browser/speech/speech_input_extension_apitest.cc

Issue 9568002: Renamed speech input implementation from to speech_recognition_*. The namespace has been renamed fr… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/speech/speech_input_extension_api.h" 10 #include "chrome/browser/speech/speech_input_extension_api.h"
11 #include "chrome/browser/speech/speech_input_extension_manager.h" 11 #include "chrome/browser/speech/speech_input_extension_manager.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/common/chrome_notification_types.h" 13 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
15 #include "content/public/browser/speech_recognizer_delegate.h" 15 #include "content/public/browser/speech_recognizer_delegate.h"
16 #include "content/public/common/speech_input_result.h" 16 #include "content/public/common/speech_recognition_traits.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using content::BrowserThread; 19 using content::BrowserThread;
20 20
21 namespace net { 21 namespace net {
22 class URLRequestContextGetter; 22 class URLRequestContextGetter;
23 } 23 }
24 24
25 // Mock class used to test the extension speech input API. 25 // Mock class used to test the extension speech input API.
26 class SpeechInputExtensionApiTest : public ExtensionApiTest, 26 class SpeechInputExtensionApiTest : public ExtensionApiTest,
(...skipping 25 matching lines...) Expand all
52 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 52 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
53 ExtensionApiTest::SetUpCommandLine(command_line); 53 ExtensionApiTest::SetUpCommandLine(command_line);
54 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 54 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
55 } 55 }
56 56
57 // SpeechInputExtensionInterface methods. 57 // SpeechInputExtensionInterface methods.
58 virtual bool HasAudioInputDevices() OVERRIDE { 58 virtual bool HasAudioInputDevices() OVERRIDE {
59 return recording_devices_available_; 59 return recording_devices_available_;
60 } 60 }
61 61
62 virtual bool IsRecordingInProcess() OVERRIDE { 62 virtual bool IsCapturingAudio() OVERRIDE {
63 // Only the mock recognizer is supposed to be recording during testing. 63 // Only the mock recognizer is supposed to be recording during testing.
64 return HasValidRecognizer(); 64 return HasValidRecognizer();
65 } 65 }
66 66
67 virtual bool HasValidRecognizer() OVERRIDE { 67 virtual bool HasValidRecognizer() OVERRIDE {
68 return recognizer_is_valid_; 68 return recognizer_is_valid_;
69 } 69 }
70 70
71 virtual void StartRecording( 71 virtual void StartRecording(
72 content::SpeechRecognizerDelegate* delegate, 72 content::SpeechRecognizerDelegate* delegate,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 SetRecognitionResult(result); 189 SetRecognitionResult(result);
190 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; 190 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_;
191 } 191 }
192 192
193 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { 193 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) {
194 AutoManagerHook hook(this); 194 AutoManagerHook hook(this);
195 195
196 SetRecognitionError(content::SPEECH_INPUT_ERROR_NETWORK); 196 SetRecognitionError(content::SPEECH_INPUT_ERROR_NETWORK);
197 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; 197 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_;
198 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698