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

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 according to Hans review + nits. 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 09c344acfcbffb0351fb7a89c686f8cf820ede3e..9b4a10853813cc26ba8ea0d64c3bae049d6ae763 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),
@@ -76,6 +77,7 @@ class FakeSpeechRecognitionManager : public SpeechRecognitionManagerImpl {
listener_ = config.event_listener;
grammar_ = config.grammar;
session_ctx_ = config.initial_context;
+ session_config_ = config;
session_id_ = 1;
return session_id_;
}
@@ -135,6 +137,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_);
@@ -159,6 +167,7 @@ class FakeSpeechRecognitionManager : public SpeechRecognitionManagerImpl {
int session_id_;
SpeechRecognitionEventListener* listener_;
+ SpeechRecognitionSessionConfig session_config_;
SpeechRecognitionSessionContext session_ctx_;
std::string grammar_;
bool did_cancel_all_;
@@ -225,7 +234,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::set_manager_for_tests(
+ speech_recognition_manager_);
}
virtual void TearDownInProcessBrowserTestFixture() {
@@ -236,10 +246,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

Powered by Google App Engine
This is Rietveld 408576698