Diff
Modified: trunk/LayoutTests/ChangeLog (119817 => 119818)
--- trunk/LayoutTests/ChangeLog 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/LayoutTests/ChangeLog 2012-06-08 11:02:27 UTC (rev 119818)
@@ -1,3 +1,16 @@
+2012-06-08 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: mock WebSpeechRecognizer for DumpRenderTree
+ https://bugs.webkit.org/show_bug.cgi?id=87976
+
+ Reviewed by Kent Tamura.
+
+ Add a layout test using the new mock, pushing a mock result through
+ and checking that events fire correctly.
+
+ * fast/speech/scripted/speechrecognition-basics-expected.txt: Added.
+ * fast/speech/scripted/speechrecognition-basics.html: Added.
+
2012-06-08 Zan Dobersek <[email protected]>
Unreviewed GTK gardening after r119795, adding separate test expectations
Added: trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics-expected.txt (0 => 119818)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics-expected.txt 2012-06-08 11:02:27 UTC (rev 119818)
@@ -0,0 +1,55 @@
+Test basic interaction with the Speech _javascript_ API
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitSpeechRecognition' in self is true
+PASS webkitSpeechRecognition == null is false
+
+oneMatchTest():
+onstart
+PASS count is 0
+onaudiostart
+PASS count is 1
+onsoundstart
+PASS count is 2
+onspeechstart
+PASS count is 3
+onresult
+PASS count is 4
+PASS event.result.length is 1
+PASS event.result.item(0).transcript is "hello, world"
+PASS event.result.item(0).confidence is within 0.001 of 0.42
+onspeechend
+PASS count is 5
+onsoundend
+PASS count is 6
+onaudioend
+PASS count is 7
+onend
+PASS count is 8
+
+noMatchTest():
+onstart
+PASS count is 0
+onaudiostart
+PASS count is 1
+onsoundstart
+PASS count is 2
+onspeechstart
+PASS count is 3
+onnomatch
+PASS count is 4
+PASS event.result is null
+onspeechend
+PASS count is 5
+onsoundend
+PASS count is 6
+onaudioend
+PASS count is 7
+onend
+PASS count is 8
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics.html (0 => 119818)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics.html (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-basics.html 2012-06-08 11:02:27 UTC (rev 119818)
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script type="text/_javascript_">
+description('Test basic interaction with the Speech _javascript_ API');
+
+function run() {
+ // Check availability of constructors.
+ shouldBeTrue("'webkitSpeechRecognition' in self");
+ shouldBeFalse("webkitSpeechRecognition == null");
+
+ oneMatchTest();
+}
+
+function oneMatchTest() {
+ debug('\noneMatchTest():');
+ var r = new webkitSpeechRecognition();
+ window.count = 0;
+
+ r._onstart_ = function() { debug('onstart'); shouldBe('count', '0'); ++count; }
+ r._onaudiostart_ = function() { debug('onaudiostart'); shouldBe('count', '1'); ++count; }
+ r._onsoundstart_ = function() { debug('onsoundstart'); shouldBe('count', '2'); ++count; }
+ r._onspeechstart_ = function() { debug('onspeechstart'); shouldBe('count', '3'); ++count; }
+
+ r._onresult_ = function() {
+ debug('onresult');
+ shouldBe('count', '4');
+ ++count;
+ shouldBe('event.result.length', '1');
+ shouldBeEqualToString('event.result.item(0).transcript', 'hello, world');
+ shouldBeCloseTo('event.result.item(0).confidence', 0.42, 1e-3);
+ }
+
+ r._onspeechend_ = function() { debug('onspeechend'); shouldBe('count', '5'); ++count; }
+ r._onsoundend_ = function() { debug('onsoundend'); shouldBe('count', '6'); ++count; }
+ r._onaudioend_ = function() { debug('onaudioend'); shouldBe('count', '7'); ++count; }
+
+ r._onend_ = function() {
+ debug('onend');
+ shouldBe('count', '8');
+ ++count;
+ noMatchTest();
+ }
+
+ if (window.layoutTestController) {
+ layoutTestController.addMockSpeechRecognitionResult('hello, world', 0.42);
+ }
+ r.start();
+}
+
+function noMatchTest() {
+ debug('\nnoMatchTest():');
+ var r = new webkitSpeechRecognition();
+ window.count = 0;
+
+ r._onstart_ = function() { debug('onstart'); shouldBe('count', '0'); ++count; }
+ r._onaudiostart_ = function() { debug('onaudiostart'); shouldBe('count', '1'); ++count; }
+ r._onsoundstart_ = function() { debug('onsoundstart'); shouldBe('count', '2'); ++count; }
+ r._onspeechstart_ = function() { debug('onspeechstart'); shouldBe('count', '3'); ++count; }
+
+ r._onnomatch_ = function() {
+ debug('onnomatch');
+ shouldBe('count', '4');
+ ++count;
+ shouldBe('event.result', 'null');
+ }
+
+ r._onspeechend_ = function() { debug('onspeechend'); shouldBe('count', '5'); ++count; }
+ r._onsoundend_ = function() { debug('onsoundend'); shouldBe('count', '6'); ++count; }
+ r._onaudioend_ = function() { debug('onaudioend'); shouldBe('count', '7'); ++count; }
+
+ r._onend_ = function() {
+ debug('onend');
+ shouldBe('count', '8');
+ ++count;
+ finishJSTest();
+ }
+
+ r.start();
+}
+
+window._onload_ = run;
+window.jsTestIsAsync = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Tools/ChangeLog (119817 => 119818)
--- trunk/Tools/ChangeLog 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/Tools/ChangeLog 2012-06-08 11:02:27 UTC (rev 119818)
@@ -1,3 +1,45 @@
+2012-06-08 Hans Wennborg <[email protected]>
+
+ Speech _javascript_ API: mock WebSpeechRecognizer for DumpRenderTree
+ https://bugs.webkit.org/show_bug.cgi?id=87976
+
+ Reviewed by Kent Tamura.
+
+ Provide a mock implementation of WebSpeechRecognizer for
+ DumpRenderTree. This will allow better testing of the API via layout
+ tests.
+
+ * DumpRenderTree/DumpRenderTree.gypi:
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::addMockSpeechRecognitionResult):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ (LayoutTestController):
+ * DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp: Added.
+ (MockWebSpeechRecognizer::create):
+ (MockWebSpeechRecognizer::start):
+ (MockWebSpeechRecognizer::stop):
+ (MockWebSpeechRecognizer::abort):
+ (MockWebSpeechRecognizer::MockWebSpeechRecognizer):
+ (MockWebSpeechRecognizer::~MockWebSpeechRecognizer):
+ (MockWebSpeechRecognizer::ResultTask::runIfValid):
+ * DumpRenderTree/chromium/MockWebSpeechRecognizer.h: Added.
+ (WebKit):
+ (MockWebSpeechRecognizer):
+ (MockWebSpeechRecognizer::addMockResult):
+ (MockWebSpeechRecognizer::taskList):
+ (ClientCallTask):
+ (MockWebSpeechRecognizer::ClientCallTask::ClientCallTask):
+ (ResultTask):
+ (MockWebSpeechRecognizer::ResultTask::ResultTask):
+ (NoMatchTask):
+ (MockWebSpeechRecognizer::NoMatchTask::NoMatchTask):
+ * DumpRenderTree/chromium/WebViewHost.cpp:
+ (WebViewHost::speechRecognizer):
+ * DumpRenderTree/chromium/WebViewHost.h:
+ (WebViewHost):
+ (WebViewHost::mockSpeechRecognizer):
+
2012-06-07 Kinuko Yasuda <[email protected]>
check-webkit-style needs to be taught about <public/Foo.h>
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.gypi (119817 => 119818)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.gypi 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.gypi 2012-06-08 11:02:27 UTC (rev 119818)
@@ -28,6 +28,8 @@
'chromium/MockWebPrerenderingSupport.h',
'chromium/MockWebSpeechInputController.cpp',
'chromium/MockWebSpeechInputController.h',
+ 'chromium/MockWebSpeechRecognizer.cpp',
+ 'chromium/MockWebSpeechRecognizer.h',
'chromium/NotificationPresenter.h',
'chromium/NotificationPresenter.cpp',
'chromium/Task.h',
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (119817 => 119818)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-06-08 11:02:27 UTC (rev 119818)
@@ -34,6 +34,7 @@
#include "DRTDevToolsAgent.h"
#include "MockWebSpeechInputController.h"
+#include "MockWebSpeechRecognizer.h"
#include "TestShell.h"
#include "WebAnimationController.h"
#include "WebBindings.h"
@@ -115,6 +116,9 @@
bindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult);
bindMethod("setMockSpeechInputDumpRect", &LayoutTestController::setMockSpeechInputDumpRect);
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ bindMethod("addMockSpeechRecognitionResult", &LayoutTestController::addMockSpeechRecognitionResult);
+#endif
bindMethod("addOriginAccessWhitelistEntry", &LayoutTestController::addOriginAccessWhitelistEntry);
bindMethod("addUserScript", &LayoutTestController::addUserScript);
bindMethod("addUserStyleSheet", &LayoutTestController::addUserStyleSheet);
@@ -1958,6 +1962,18 @@
}
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+void LayoutTestController::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isNumber())
+ return;
+
+ if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())
+ recognizer->addMockResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble());
+}
+#endif
+
void LayoutTestController::startSpeechInput(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (119817 => 119818)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2012-06-08 11:02:27 UTC (rev 119818)
@@ -375,6 +375,9 @@
void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);
void setMockSpeechInputDumpRect(const CppArgumentList&, CppVariant*);
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*);
+#endif
void startSpeechInput(const CppArgumentList&, CppVariant*);
void layerTreeAsText(const CppArgumentList& args, CppVariant* result);
Added: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp (0 => 119818)
--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp (rev 0)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp 2012-06-08 11:02:27 UTC (rev 119818)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MockWebSpeechRecognizer.h"
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "WebSpeechRecognitionResult.h"
+#include "WebSpeechRecognizerClient.h"
+
+using namespace WebKit;
+
+namespace {
+
+// Task class for calling a client function that does not take any parameters.
+typedef void (WebSpeechRecognizerClient::*ClientFunctionPointer)(const WebSpeechRecognitionHandle&);
+class ClientCallTask : public MethodTask<MockWebSpeechRecognizer> {
+public:
+ ClientCallTask(MockWebSpeechRecognizer* mock, ClientFunctionPointer function)
+ : MethodTask<MockWebSpeechRecognizer>(mock)
+ , m_function(function)
+ {
+ }
+
+ virtual void runIfValid() OVERRIDE { (m_object->client()->*m_function)(m_object->handle()); }
+
+private:
+ ClientFunctionPointer m_function;
+};
+
+// Task for delivering a result event.
+class ResultTask : public MethodTask<MockWebSpeechRecognizer> {
+public:
+ ResultTask(MockWebSpeechRecognizer* mock, const WebString transcript, float confidence)
+ : MethodTask<MockWebSpeechRecognizer>(mock)
+ , m_transcript(transcript)
+ , m_confidence(confidence)
+ {
+ }
+
+ virtual void runIfValid() OVERRIDE
+ {
+ WebVector<WebString> transcripts(static_cast<size_t>(1));
+ WebVector<float> confidences(static_cast<size_t>(1));
+ transcripts[0] = m_transcript;
+ confidences[0] = m_confidence;
+ WebSpeechRecognitionResult res;
+ res.assign(transcripts, confidences, true);
+
+ m_object->client()->didReceiveResult(m_object->handle(), res, 0, WebVector<WebSpeechRecognitionResult>());
+ }
+
+private:
+ WebString m_transcript;
+ float m_confidence;
+};
+
+// Task for delivering a nomatch event.
+class NoMatchTask : public MethodTask<MockWebSpeechRecognizer> {
+public:
+ NoMatchTask(MockWebSpeechRecognizer* mock) : MethodTask<MockWebSpeechRecognizer>(mock) { }
+ virtual void runIfValid() OVERRIDE { m_object->client()->didReceiveNoMatch(m_object->handle(), WebSpeechRecognitionResult()); }
+};
+
+} // namespace
+
+PassOwnPtr<MockWebSpeechRecognizer> MockWebSpeechRecognizer::create()
+{
+ return adoptPtr(new MockWebSpeechRecognizer());
+}
+
+void MockWebSpeechRecognizer::start(const WebSpeechRecognitionHandle& handle, const WebSpeechRecognitionParams& params, WebSpeechRecognizerClient* client)
+{
+ m_handle = handle;
+ m_client = client;
+
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didStart));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartAudio));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSound));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didStartSpeech));
+
+ if (!m_mockTranscripts.isEmpty()) {
+ ASSERT(m_mockTranscripts.size() == m_mockConfidences.size());
+
+ for (size_t i = 0; i < m_mockTranscripts.size(); ++i)
+ postTask(new ResultTask(this, m_mockTranscripts[i], m_mockConfidences[i]));
+
+ m_mockTranscripts.clear();
+ m_mockConfidences.clear();
+ } else
+ postTask(new NoMatchTask(this));
+
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSpeech));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndSound));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didEndAudio));
+ postTask(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd));
+}
+
+void MockWebSpeechRecognizer::stop(const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* client)
+{
+ m_handle = handle;
+ m_client = client;
+
+ // FIXME: Implement.
+ ASSERT_NOT_REACHED();
+}
+
+void MockWebSpeechRecognizer::abort(const WebSpeechRecognitionHandle& handle, WebSpeechRecognizerClient* client)
+{
+ m_handle = handle;
+ m_client = client;
+
+ // FIXME: Implement.
+ ASSERT_NOT_REACHED();
+}
+
+MockWebSpeechRecognizer::MockWebSpeechRecognizer()
+{
+}
+
+MockWebSpeechRecognizer::~MockWebSpeechRecognizer()
+{
+}
+
+
+#endif // ENABLE(SCRIPTED_SPEECH)
Added: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h (0 => 119818)
--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h (rev 0)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h 2012-06-08 11:02:27 UTC (rev 119818)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MockWebSpeechRecognizer_h
+#define MockWebSpeechRecognizer_h
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "Task.h"
+#include "WebSpeechRecognizer.h"
+#include <wtf/Compiler.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebSpeechRecognitionHandle;
+class WebSpeechRecognitionParams;
+class WebSpeechRecognizerClient;
+}
+
+class MockWebSpeechRecognizer : public WebKit::WebSpeechRecognizer {
+public:
+ static PassOwnPtr<MockWebSpeechRecognizer> create();
+ ~MockWebSpeechRecognizer();
+
+ // WebSpeechRecognizer implementation:
+ virtual void start(const WebKit::WebSpeechRecognitionHandle&, const WebKit::WebSpeechRecognitionParams&, WebKit::WebSpeechRecognizerClient*) OVERRIDE;
+ virtual void stop(const WebKit::WebSpeechRecognitionHandle&, WebKit::WebSpeechRecognizerClient*) OVERRIDE;
+ virtual void abort(const WebKit::WebSpeechRecognitionHandle&, WebKit::WebSpeechRecognizerClient*) OVERRIDE;
+
+ // Methods accessed by layout tests:
+ void addMockResult(const WebKit::WebString& transcript, float confidence)
+ {
+ m_mockTranscripts.append(transcript);
+ m_mockConfidences.append(confidence);
+ }
+
+ TaskList* taskList() { return &m_taskList; }
+ WebKit::WebSpeechRecognizerClient* client() { return m_client; }
+ WebKit::WebSpeechRecognitionHandle& handle() { return m_handle; }
+
+private:
+ MockWebSpeechRecognizer();
+
+ TaskList m_taskList;
+ WebKit::WebSpeechRecognitionHandle m_handle;
+ WebKit::WebSpeechRecognizerClient* m_client;
+ Vector<WebKit::WebString> m_mockTranscripts;
+ Vector<float> m_mockConfidences;
+};
+
+#endif // ENABLE(SCRIPTED_SPEECH)
+
+#endif // MockWebSpeechRecognizer_h
Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (119817 => 119818)
--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp 2012-06-08 11:02:27 UTC (rev 119818)
@@ -34,6 +34,7 @@
#include "LayoutTestController.h"
#include "MockGrammarCheck.h"
#include "MockWebSpeechInputController.h"
+#include "MockWebSpeechRecognizer.h"
#include "TestNavigationController.h"
#include "TestShell.h"
#include "TestWebPlugin.h"
@@ -715,6 +716,15 @@
}
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+WebSpeechRecognizer* WebViewHost::speechRecognizer()
+{
+ if (!m_mockSpeechRecognizer)
+ m_mockSpeechRecognizer = MockWebSpeechRecognizer::create();
+ return m_mockSpeechRecognizer.get();
+}
+#endif
+
WebDeviceOrientationClientMock* WebViewHost::deviceOrientationClientMock()
{
if (!m_deviceOrientationClientMock.get())
Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (119817 => 119818)
--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h 2012-06-08 10:41:47 UTC (rev 119817)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h 2012-06-08 11:02:27 UTC (rev 119818)
@@ -48,6 +48,7 @@
class LayoutTestController;
class MockWebSpeechInputController;
+class MockWebSpeechRecognizer;
class SkCanvas;
class TestShell;
@@ -117,6 +118,10 @@
MockWebSpeechInputController* speechInputControllerMock() { return m_speechInputControllerMock.get(); }
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ MockWebSpeechRecognizer* mockSpeechRecognizer() { return m_mockSpeechRecognizer.get(); }
+#endif
+
#if ENABLE(POINTER_LOCK)
void didLosePointerLock();
void setPointerLockWillFailAsynchronously() { m_pointerLockPlannedResult = PointerLockWillFailAsync; }
@@ -176,6 +181,9 @@
#if ENABLE(INPUT_SPEECH)
virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ virtual WebKit::WebSpeechRecognizer* speechRecognizer() OVERRIDE;
+#endif
virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient();
#if ENABLE(MEDIA_STREAM)
virtual WebKit::WebUserMediaClient* userMediaClient();
@@ -412,6 +420,10 @@
OwnPtr<MockWebSpeechInputController> m_speechInputControllerMock;
#endif
+#if ENABLE(SCRIPTED_SPEECH)
+ OwnPtr<MockWebSpeechRecognizer> m_mockSpeechRecognizer;
+#endif
+
#if ENABLE(MEDIA_STREAM)
OwnPtr<WebKit::WebUserMediaClientMock> m_userMediaClientMock;
OwnPtr<webkit_support::TestMediaStreamClient> m_testMediaStreamClient;