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

Unified Diff: content/browser/speech/speech_recognition_browsertest.cc

Issue 10399025: Moved instantiation of SpeechRecognitionManager inside browser_main_loop, instead of Singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed build issues. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/speech_recognition_browsertest.cc
diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc
index 64156404cd661fc1263debe8e70dad167c71556b..a939fb6ad5aaa045961e1599cdda5f3e31aff617 100644
--- a/content/browser/speech/speech_recognition_browsertest.cc
+++ b/content/browser/speech/speech_recognition_browsertest.cc
@@ -14,9 +14,9 @@
#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/speech/input_tag_speech_dispatcher_host.h"
-#include "content/browser/speech/speech_recognition_manager_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/notification_types.h"
+#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/speech_recognition_session_config.h"
#include "content/public/browser/speech_recognition_session_context.h"
#include "content/public/common/content_switches.h"
@@ -25,6 +25,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
using content::SpeechRecognitionEventListener;
+using content::SpeechRecognitionSessionConfig;
using content::SpeechRecognitionSessionContext;
using content::NavigationController;
using content::WebContents;
@@ -37,7 +38,7 @@ namespace speech {
const char kTestResult[] = "Pictures of the moon";
-class FakeSpeechRecognitionManager : public SpeechRecognitionManagerImpl {
+class FakeSpeechRecognitionManager : public content::SpeechRecognitionManager {
public:
FakeSpeechRecognitionManager()
: session_id_(0),
@@ -77,6 +78,7 @@ class FakeSpeechRecognitionManager : public SpeechRecognitionManagerImpl {
if (config.grammars.size() > 0)
grammar_ = config.grammars[0].url;
session_ctx_ = config.initial_context;
+ session_config_ = config;
session_id_ = 1;
return session_id_;
}
@@ -136,6 +138,12 @@ class FakeSpeechRecognitionManager : public SpeechRecognitionManagerImpl {
return matched ? session_id_ : 0;
}
+ virtual const SpeechRecognitionSessionConfig& GetSessionConfig(
+ int session_id) const OVERRIDE {
+ EXPECT_EQ(session_id, session_id_);
+ return session_config_;
+ }
+
virtual content::SpeechRecognitionSessionContext GetSessionContext(
int session_id) const OVERRIDE {
EXPECT_EQ(session_id, session_id_);
@@ -160,6 +168,7 @@ class FakeSpeechRecognitionManager : public SpeechRecognitionManagerImpl {
int session_id_;
SpeechRecognitionEventListener* listener_;
+ SpeechRecognitionSessionConfig session_config_;
SpeechRecognitionSessionContext session_ctx_;
std::string grammar_;
bool did_cancel_all_;
@@ -226,7 +235,8 @@ class SpeechRecognitionBrowserTest : public InProcessBrowserTest {
// Inject the fake manager factory so that the test result is returned to
// the web page.
- InputTagSpeechDispatcherHost::set_manager(speech_recognition_manager_);
+ InputTagSpeechDispatcherHost::SetManagerForTests(
+ speech_recognition_manager_);
}
virtual void TearDownInProcessBrowserTestFixture() {
@@ -237,10 +247,10 @@ class SpeechRecognitionBrowserTest : public InProcessBrowserTest {
// This is used by the static |fakeManager|, and it is a pointer rather than a
// direct instance per the style guide.
- static SpeechRecognitionManagerImpl* speech_recognition_manager_;
+ static content::SpeechRecognitionManager* speech_recognition_manager_;
};
-SpeechRecognitionManagerImpl*
+content::SpeechRecognitionManager*
SpeechRecognitionBrowserTest::speech_recognition_manager_ = NULL;
// TODO(satish): Once this flakiness has been fixed, add a second test here to
« no previous file with comments | « content/browser/speech/input_tag_speech_dispatcher_host.cc ('k') | content/browser/speech/speech_recognition_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698