diff options
author | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-25 05:37:37 +0000 |
---|---|---|
committer | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-25 05:37:37 +0000 |
commit | 8ef5716c097776a9ae5c93e895c0effe7695a985 (patch) | |
tree | 197a96d2fdcf0ffcd0e90f205222b877b14506e5 /webkit/support/test_webkit_client.cc | |
parent | 7fb865207d11400bc69b15fef20c5e4826c221c2 (diff) | |
download | chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.zip chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.tar.gz chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.tar.bz2 |
Add form validation message strings.
* webkit/glue/
- Add overloads of queryLocalizedString() functions
They will be added to WebKit::WebKitClient later.
- Add implementations for WebLocalizedString::Validation*
- Add message strings
The English strings are different from WebKit's to avoid the brusque
WebKit's strings.
Port some messages from Mozilla.
* webkit/tools/test_shell/ and webkit/support/
Hook queryLocalizedString() functions in order to return messages same as
WebKit in layout test.
BUG=28264
TEST=LayoutTests/fast/forms/validationMessage.html
Review URL: http://codereview.chromium.org/4678006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support/test_webkit_client.cc')
-rw-r--r-- | webkit/support/test_webkit_client.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index 5c46cf8..e45c263 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -247,6 +247,58 @@ WebKit::WebData TestWebKitClient::loadResource(const char* name) { return webkit_glue::WebKitClientImpl::loadResource(name); } +WebKit::WebString TestWebKitClient::queryLocalizedString( + WebKit::WebLocalizedString::Name name) { + // Returns messages same as WebKit's in DRT. + // We use different strings for form validation messages. + switch (name) { + case WebKit::WebLocalizedString::ValidationValueMissing: + case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox: + case WebKit::WebLocalizedString::ValidationValueMissingForFile: + case WebKit::WebLocalizedString::ValidationValueMissingForMultipleFile: + case WebKit::WebLocalizedString::ValidationValueMissingForRadio: + case WebKit::WebLocalizedString::ValidationValueMissingForSelect: + return ASCIIToUTF16("value missing"); + case WebKit::WebLocalizedString::ValidationTypeMismatch: + case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail: + case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail: + case WebKit::WebLocalizedString::ValidationTypeMismatchForURL: + return ASCIIToUTF16("type mismatch"); + case WebKit::WebLocalizedString::ValidationPatternMismatch: + return ASCIIToUTF16("pattern mismatch"); + case WebKit::WebLocalizedString::ValidationTooLong: + return ASCIIToUTF16("too long"); + case WebKit::WebLocalizedString::ValidationRangeUnderflow: + return ASCIIToUTF16("range underflow"); + case WebKit::WebLocalizedString::ValidationRangeOverflow: + return ASCIIToUTF16("range overflow"); + case WebKit::WebLocalizedString::ValidationStepMismatch: + return ASCIIToUTF16("step mismatch"); + default: + return WebKitClientImpl::queryLocalizedString(name); + } +} + +WebKit::WebString TestWebKitClient::queryLocalizedString( + WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) { + if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow) + return ASCIIToUTF16("range underflow"); + if (name == WebKit::WebLocalizedString::ValidationRangeOverflow) + return ASCIIToUTF16("range overflow"); + return WebKitClientImpl::queryLocalizedString(name, value); +} + +WebKit::WebString TestWebKitClient::queryLocalizedString( + WebKit::WebLocalizedString::Name name, + const WebKit::WebString& value1, + const WebKit::WebString& value2) { + if (name == WebKit::WebLocalizedString::ValidationTooLong) + return ASCIIToUTF16("too long"); + if (name == WebKit::WebLocalizedString::ValidationStepMismatch) + return ASCIIToUTF16("step mismatch"); + return WebKitClientImpl::queryLocalizedString(name, value1, value2); +} + WebKit::WebString TestWebKitClient::defaultLocale() { return ASCIIToUTF16("en-US"); } |