summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/test_webview_delegate.cc
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 06:58:27 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-27 06:58:27 +0000
commita003409a254fb3c1b2d563968a787ccd98c476aa (patch)
tree1722071b70a43c56bc55cd562a3c14f75a25f8cc /webkit/tools/test_shell/test_webview_delegate.cc
parentbeb4a93fc12007b11e252b6ac31f98d640def473 (diff)
downloadchromium_src-a003409a254fb3c1b2d563968a787ccd98c476aa.zip
chromium_src-a003409a254fb3c1b2d563968a787ccd98c476aa.tar.gz
chromium_src-a003409a254fb3c1b2d563968a787ccd98c476aa.tar.bz2
Adds a mock spellchecker to test_shell.
This change adds a MockSpellCheck class, a mock implementation of our SpellCheck class, to test_shell so we can render dotted-underlines to misspelled words. Unfortunately, this class is currently enabled only on Mac since it needs rebaselines on Windows and Linux. BUG=11577,23497 TEST=run run_webkit_tests.sh on Mac Review URL: http://codereview.chromium.org/493003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_webview_delegate.cc')
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 64fc528..54a1ea3 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -52,6 +52,7 @@
#include "webkit/glue/webmediaplayer_impl.h"
#include "webkit/glue/window_open_disposition.h"
#include "webkit/tools/test_shell/accessibility_controller.h"
+#include "webkit/tools/test_shell/mock_spellcheck.h"
#include "webkit/tools/test_shell/test_navigation_controller.h"
#include "webkit/tools/test_shell/test_shell.h"
#include "webkit/tools/test_shell/test_web_worker.h"
@@ -462,9 +463,24 @@ bool TestWebViewDelegate::handleCurrentKeyboardEvent() {
WebString::fromUTF8(edit_command_value_));
}
+void TestWebViewDelegate::spellCheck(const WebString& text,
+ int& misspelledOffset,
+ int& misspelledLength) {
+#if defined(OS_MACOSX)
+ // Check the spelling of the given text.
+ // TODO(hbono): rebaseline layout-test results of Windows and Linux so we
+ // can enable this mock spellchecker on them.
+ string16 word(text);
+ mock_spellcheck_.SpellCheckWord(word, &misspelledOffset, &misspelledLength);
+#endif
+}
+
WebString TestWebViewDelegate::autoCorrectWord(const WebString& word) {
- // Dummy implementation.
- return word;
+ // Returns an empty string as Mac WebKit ('WebKitSupport/WebEditorClient.mm')
+ // does. (If this function returns a non-empty string, WebKit replaces the
+ // given misspelled string with the result one. This process executes some
+ // editor commands and causes layout-test failures.)
+ return WebString();
}
void TestWebViewDelegate::runModalAlertDialog(