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

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

Issue 10407120: Moving tray icon and notification balloon for background speech recognition sessions to ChromeSpeec… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed win issued ("interface" member clashes with a VS macro name, sigh) Created 8 years, 6 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 | Annotate | Revision Log
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"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return HasValidRecognizer(); 74 return HasValidRecognizer();
75 } 75 }
76 76
77 virtual bool HasValidRecognizer() OVERRIDE { 77 virtual bool HasValidRecognizer() OVERRIDE {
78 return recognizer_is_valid_; 78 return recognizer_is_valid_;
79 } 79 }
80 80
81 virtual void StartRecording( 81 virtual void StartRecording(
82 content::SpeechRecognitionEventListener* listener, 82 content::SpeechRecognitionEventListener* listener,
83 net::URLRequestContextGetter* context_getter, 83 net::URLRequestContextGetter* context_getter,
84 const string16& extension_name, 84 const std::string& extension_name,
85 const std::string& language, 85 const std::string& language,
86 const std::string& grammar, 86 const std::string& grammar,
87 bool filter_profanities, 87 bool filter_profanities,
88 bool show_notification) OVERRIDE; 88 int render_process_id) OVERRIDE;
89 89
90 virtual void StopRecording(bool recognition_failed) OVERRIDE; 90 virtual void StopRecording(bool recognition_failed) OVERRIDE;
91 91
92 SpeechInputExtensionManager* GetManager() { 92 SpeechInputExtensionManager* GetManager() {
93 return manager_.get(); 93 return manager_.get();
94 } 94 }
95 95
96 // Auxiliary class used to hook the API manager into the test during its 96 // Auxiliary class used to hook the API manager into the test during its
97 // lifetime. Required since browser() is not available during the set up 97 // lifetime. Required since browser() is not available during the set up
98 // or tear down callbacks, or during the test class construction. 98 // or tear down callbacks, or during the test class construction.
(...skipping 30 matching lines...) Expand all
129 next_error_(content::SPEECH_RECOGNITION_ERROR_NONE), 129 next_error_(content::SPEECH_RECOGNITION_ERROR_NONE),
130 result_delay_ms_(0) { 130 result_delay_ms_(0) {
131 } 131 }
132 132
133 SpeechInputExtensionApiTest::~SpeechInputExtensionApiTest() { 133 SpeechInputExtensionApiTest::~SpeechInputExtensionApiTest() {
134 } 134 }
135 135
136 void SpeechInputExtensionApiTest::StartRecording( 136 void SpeechInputExtensionApiTest::StartRecording(
137 content::SpeechRecognitionEventListener* listener, 137 content::SpeechRecognitionEventListener* listener,
138 net::URLRequestContextGetter* context_getter, 138 net::URLRequestContextGetter* context_getter,
139 const string16& extension_name, 139 const std::string& extension_name,
140 const std::string& language, 140 const std::string& language,
141 const std::string& grammar, 141 const std::string& grammar,
142 bool filter_profanities, 142 bool filter_profanities,
143 bool show_notification) { 143 int render_process_id) {
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
145 recognizer_is_valid_ = true; 145 recognizer_is_valid_ = true;
146 146
147 // Notify that recording started. 147 // Notify that recording started.
148 MessageLoop::current()->PostDelayedTask( 148 MessageLoop::current()->PostDelayedTask(
149 FROM_HERE, 149 FROM_HERE,
150 base::Bind(&SpeechInputExtensionManager::OnAudioStart, 150 base::Bind(&SpeechInputExtensionManager::OnAudioStart,
151 GetManager(), 151 GetManager(),
152 kSessionIDForTests), 152 kSessionIDForTests),
153 base::TimeDelta()); 153 base::TimeDelta());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 SetRecognitionResult(result); 214 SetRecognitionResult(result);
215 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_; 215 ASSERT_TRUE(RunExtensionTest("speech_input/recognition")) << message_;
216 } 216 }
217 217
218 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) { 218 IN_PROC_BROWSER_TEST_F(SpeechInputExtensionApiTest, RecognitionError) {
219 AutoManagerHook hook(this); 219 AutoManagerHook hook(this);
220 220
221 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK); 221 SetRecognitionError(content::SPEECH_RECOGNITION_ERROR_NETWORK);
222 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_; 222 ASSERT_TRUE(RunExtensionTest("speech_input/recognition_error")) << message_;
223 } 223 }
OLDNEW
« no previous file with comments | « chrome/browser/speech/chrome_speech_recognition_preferences.cc ('k') | chrome/browser/speech/speech_input_extension_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698