From 0e2d36662639b660f8b62f13d0dd8d14e5080274 Mon Sep 17 00:00:00 2001 From: "satish@chromium.org" Date: Tue, 23 Nov 2010 12:25:22 +0000 Subject: TestShell changes to support multiple speech input results. This is the chromium side of https://bugs.webkit.org/show_bug.cgi?id=49736. BUG=none TEST=webkit layout tests will be enabled after this CL. TBR=jorlow git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67085 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/tools/test_shell/layout_test_controller.cc | 13 +++++++------ webkit/tools/test_shell/layout_test_controller.h | 2 +- webkit/tools/test_shell/test_webview_delegate.cc | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'webkit/tools') diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 8816e85..d344dfa 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -207,7 +207,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) : BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListItem); BindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation); - BindMethod("setMockSpeechInputResult", &LayoutTestController::setMockSpeechInputResult); + BindMethod("addMockSpeechInputResult", &LayoutTestController::addMockSpeechInputResult); // The fallback method is called when an unknown method is invoked. BindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -1133,12 +1133,13 @@ void LayoutTestController::setAllowFileAccessFromFileURLs( result->SetNull(); } -void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& args, +void LayoutTestController::addMockSpeechInputResult(const CppArgumentList& args, CppVariant* result) { - if (args.size() > 0 && args[0].isString() && args[1].isString()) { - shell_->speech_input_controller_mock()->setMockRecognitionResult( - WebString::fromUTF8(args[0].ToString()), - WebString::fromUTF8(args[1].ToString())); + if (args.size() > 0 && args[0].isString() && args[1].isNumber() && + args[2].isString()) { + shell_->speech_input_controller_mock()->addMockRecognitionResult( + WebString::fromUTF8(args[0].ToString()), args[1].ToDouble(), + WebString::fromUTF8(args[2].ToString())); } result->SetNull(); } diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index bd202cd..9138cc4 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -233,7 +233,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); + void addMockSpeechInputResult(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_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index f22b6b8..1973acb 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -1175,6 +1175,8 @@ void TestWebViewDelegate::Reset() { TestShell* shell = shell_; this->~TestWebViewDelegate(); new (this) TestWebViewDelegate(shell); + if (shell->speech_input_controller_mock()) + shell->speech_input_controller_mock()->clearResults(); } void TestWebViewDelegate::SetSmartInsertDeleteEnabled(bool enabled) { -- cgit v1.1