OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/support/test_webkit_client.h" | 5 #include "webkit/support/test_webkit_client.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/metrics/stats_counters.h" | 10 #include "base/metrics/stats_counters.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" | 240 "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" |
241 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" | 241 "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" |
242 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" | 242 "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" |
243 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" | 243 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" |
244 "\x82"; | 244 "\x82"; |
245 return WebKit::WebData(red_square, arraysize(red_square)); | 245 return WebKit::WebData(red_square, arraysize(red_square)); |
246 } | 246 } |
247 return webkit_glue::WebKitClientImpl::loadResource(name); | 247 return webkit_glue::WebKitClientImpl::loadResource(name); |
248 } | 248 } |
249 | 249 |
| 250 WebKit::WebString TestWebKitClient::queryLocalizedString( |
| 251 WebKit::WebLocalizedString::Name name) { |
| 252 // Returns messages same as WebKit's in DRT. |
| 253 // We use different strings for form validation messages. |
| 254 switch (name) { |
| 255 case WebKit::WebLocalizedString::ValidationValueMissing: |
| 256 case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox: |
| 257 case WebKit::WebLocalizedString::ValidationValueMissingForFile: |
| 258 case WebKit::WebLocalizedString::ValidationValueMissingForMultipleFile: |
| 259 case WebKit::WebLocalizedString::ValidationValueMissingForRadio: |
| 260 case WebKit::WebLocalizedString::ValidationValueMissingForSelect: |
| 261 return ASCIIToUTF16("value missing"); |
| 262 case WebKit::WebLocalizedString::ValidationTypeMismatch: |
| 263 case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail: |
| 264 case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail: |
| 265 case WebKit::WebLocalizedString::ValidationTypeMismatchForURL: |
| 266 return ASCIIToUTF16("type mismatch"); |
| 267 case WebKit::WebLocalizedString::ValidationPatternMismatch: |
| 268 return ASCIIToUTF16("pattern mismatch"); |
| 269 case WebKit::WebLocalizedString::ValidationTooLong: |
| 270 return ASCIIToUTF16("too long"); |
| 271 case WebKit::WebLocalizedString::ValidationRangeUnderflow: |
| 272 return ASCIIToUTF16("range underflow"); |
| 273 case WebKit::WebLocalizedString::ValidationRangeOverflow: |
| 274 return ASCIIToUTF16("range overflow"); |
| 275 case WebKit::WebLocalizedString::ValidationStepMismatch: |
| 276 return ASCIIToUTF16("step mismatch"); |
| 277 default: |
| 278 return WebKitClientImpl::queryLocalizedString(name); |
| 279 } |
| 280 } |
| 281 |
| 282 WebKit::WebString TestWebKitClient::queryLocalizedString( |
| 283 WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) { |
| 284 if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow) |
| 285 return ASCIIToUTF16("range underflow"); |
| 286 if (name == WebKit::WebLocalizedString::ValidationRangeOverflow) |
| 287 return ASCIIToUTF16("range overflow"); |
| 288 return WebKitClientImpl::queryLocalizedString(name, value); |
| 289 } |
| 290 |
| 291 WebKit::WebString TestWebKitClient::queryLocalizedString( |
| 292 WebKit::WebLocalizedString::Name name, |
| 293 const WebKit::WebString& value1, |
| 294 const WebKit::WebString& value2) { |
| 295 if (name == WebKit::WebLocalizedString::ValidationTooLong) |
| 296 return ASCIIToUTF16("too long"); |
| 297 if (name == WebKit::WebLocalizedString::ValidationStepMismatch) |
| 298 return ASCIIToUTF16("step mismatch"); |
| 299 return WebKitClientImpl::queryLocalizedString(name, value1, value2); |
| 300 } |
| 301 |
250 WebKit::WebString TestWebKitClient::defaultLocale() { | 302 WebKit::WebString TestWebKitClient::defaultLocale() { |
251 return ASCIIToUTF16("en-US"); | 303 return ASCIIToUTF16("en-US"); |
252 } | 304 } |
253 | 305 |
254 WebKit::WebStorageNamespace* TestWebKitClient::createLocalStorageNamespace( | 306 WebKit::WebStorageNamespace* TestWebKitClient::createLocalStorageNamespace( |
255 const WebKit::WebString& path, unsigned quota) { | 307 const WebKit::WebString& path, unsigned quota) { |
256 return WebKit::WebStorageNamespace::createLocalStorageNamespace(path, quota); | 308 return WebKit::WebStorageNamespace::createLocalStorageNamespace(path, quota); |
257 } | 309 } |
258 | 310 |
259 void TestWebKitClient::dispatchStorageEvent(const WebKit::WebString& key, | 311 void TestWebKitClient::dispatchStorageEvent(const WebKit::WebString& key, |
(...skipping 29 matching lines...) Expand all Loading... |
289 } | 341 } |
290 #endif | 342 #endif |
291 | 343 |
292 WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() { | 344 WebKit::WebSharedWorkerRepository* TestWebKitClient::sharedWorkerRepository() { |
293 return NULL; | 345 return NULL; |
294 } | 346 } |
295 | 347 |
296 WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() { | 348 WebKit::WebGraphicsContext3D* TestWebKitClient::createGraphicsContext3D() { |
297 return WebKit::WebGraphicsContext3D::createDefault(); | 349 return WebKit::WebGraphicsContext3D::createDefault(); |
298 } | 350 } |
OLD | NEW |