diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 15 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 4 |
6 files changed, 47 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 9878bf6..cad5bb5 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -32,6 +32,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h" #include "third_party/WebKit/WebKit/chromium/public/WebSettings.h" #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" #include "webkit/glue/dom_operations.h" @@ -204,6 +205,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) : BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListItem); BindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation); + BindMethod("setMockSpeechInputResult", &LayoutTestController::setMockSpeechInputResult); // The fallback method is called when an unknown method is invoked. BindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -1123,6 +1125,15 @@ void LayoutTestController::setAllowFileAccessFromFileURLs( result->SetNull(); } +void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& args, + CppVariant* result) { + if (args.size() > 0 && args[0].isString()) { + shell_->speech_input_controller_mock()->setMockRecognitionResult( + WebString::fromUTF8(args[0].ToString())); + } + result->SetNull(); +} + // Need these conversions because the format of the value for booleans // may vary - for example, on mac "1" and "0" are used for boolean. bool LayoutTestController::CppVariantToBool(const CppVariant& value) { diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 29434c1..ee39d97 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -232,6 +232,7 @@ class LayoutTestController : public CppBoundClass { void overridePreference(const CppArgumentList& args, CppVariant* result); void setAllowUniversalAccessFromFileURLs(const CppArgumentList& args, CppVariant* result); void setAllowFileAccessFromFileURLs(const CppArgumentList& args, CppVariant* result); + void setMockSpeechInputResult(const CppArgumentList& args, CppVariant* result); // The fallback method is called when a nonexistent method is called on // the layout test controller object. diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index feb272e..9213f6b 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -34,6 +34,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebAccessibilityObject.h" #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClientMock.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h" @@ -772,6 +773,20 @@ TestShell::device_orientation_client_mock() { return device_orientation_client_mock_.get(); } +WebKit::WebSpeechInputControllerMock* +TestShell::CreateSpeechInputControllerMock( + WebKit::WebSpeechInputListener* listener) { + DCHECK(!speech_input_controller_mock_.get()); + speech_input_controller_mock_.reset( + WebKit::WebSpeechInputControllerMock::create(listener)); + return speech_input_controller_mock_.get(); +} + +WebKit::WebSpeechInputControllerMock* +TestShell::speech_input_controller_mock() { + return speech_input_controller_mock_.get(); +} + //----------------------------------------------------------------------------- namespace webkit_glue { diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index f055e27..bf139d4 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -66,6 +66,8 @@ class StringPiece; namespace WebKit { class WebDeviceOrientationClientMock; +class WebSpeechInputControllerMock; +class WebSpeechInputListener; } class TestShell : public base::SupportsWeakPtr<TestShell> { @@ -342,6 +344,10 @@ public: WebKit::WebDeviceOrientationClientMock* device_orientation_client_mock(); + WebKit::WebSpeechInputControllerMock* CreateSpeechInputControllerMock( + WebKit::WebSpeechInputListener* listener); + WebKit::WebSpeechInputControllerMock* speech_input_controller_mock(); + protected: void CreateDevToolsClient(TestShellDevToolsAgent* agent); bool Initialize(const GURL& starting_url); @@ -423,6 +429,8 @@ private: scoped_ptr<TestShellDevToolsClient> dev_tools_client_; scoped_ptr<WebKit::WebDeviceOrientationClientMock> device_orientation_client_mock_; + scoped_ptr<WebKit::WebSpeechInputControllerMock> + speech_input_controller_mock_; // A temporary directory for FileSystem API. ScopedTempDir file_system_root_; diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index c3dfeae..f4b4684 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -40,6 +40,9 @@ #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h" #include "third_party/WebKit/WebKit/chromium/public/WebRange.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputControllerMock.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputListener.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" @@ -649,6 +652,11 @@ TestWebViewDelegate::deviceOrientationClient() { return shell_->device_orientation_client_mock(); } +WebKit::WebSpeechInputController* TestWebViewDelegate::speechInputController( + WebKit::WebSpeechInputListener* listener) { + return shell_->CreateSpeechInputControllerMock(listener); +} + // WebWidgetClient ----------------------------------------------------------- void TestWebViewDelegate::didInvalidateRect(const WebRect& rect) { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index e4b3e2f..8754d3c 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -52,6 +52,8 @@ class WebWidgetHost; namespace WebKit { class WebDeviceOrientationClient; +class WebSpeechInputController; +class WebSpeechInputListener; class WebStorageNamespace; struct WebWindowFeatures; } @@ -141,6 +143,8 @@ class TestWebViewDelegate : public WebKit::WebViewClient, virtual WebKit::WebNotificationPresenter* notificationPresenter(); virtual WebKit::WebGeolocationService* geolocationService(); virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); + virtual WebKit::WebSpeechInputController* speechInputController( + WebKit::WebSpeechInputListener*); // WebKit::WebWidgetClient virtual void didInvalidateRect(const WebKit::WebRect& rect); |