OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_platform_support.h" | 5 #include "webkit/support/test_webkit_platform_support.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/metrics/stats_counters.h" | 8 #include "base/metrics/stats_counters.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" | 260 "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" |
261 "\x82"; | 261 "\x82"; |
262 return WebKit::WebData(red_square, arraysize(red_square)); | 262 return WebKit::WebData(red_square, arraysize(red_square)); |
263 } | 263 } |
264 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); | 264 return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); |
265 } | 265 } |
266 | 266 |
267 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( | 267 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( |
268 WebKit::WebLocalizedString::Name name) { | 268 WebKit::WebLocalizedString::Name name) { |
269 // Returns messages same as WebKit's in DRT. | 269 // Returns messages same as WebKit's in DRT. |
270 // We use different strings for form validation messages. | 270 // We use different strings for form validation messages and page popup UI |
271 // strings. | |
271 switch (name) { | 272 switch (name) { |
272 case WebKit::WebLocalizedString::ValidationValueMissing: | 273 case WebKit::WebLocalizedString::ValidationValueMissing: |
273 case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox: | 274 case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox: |
274 case WebKit::WebLocalizedString::ValidationValueMissingForFile: | 275 case WebKit::WebLocalizedString::ValidationValueMissingForFile: |
275 case WebKit::WebLocalizedString::ValidationValueMissingForMultipleFile: | 276 case WebKit::WebLocalizedString::ValidationValueMissingForMultipleFile: |
276 case WebKit::WebLocalizedString::ValidationValueMissingForRadio: | 277 case WebKit::WebLocalizedString::ValidationValueMissingForRadio: |
277 case WebKit::WebLocalizedString::ValidationValueMissingForSelect: | 278 case WebKit::WebLocalizedString::ValidationValueMissingForSelect: |
278 return ASCIIToUTF16("value missing"); | 279 return ASCIIToUTF16("value missing"); |
279 case WebKit::WebLocalizedString::ValidationTypeMismatch: | 280 case WebKit::WebLocalizedString::ValidationTypeMismatch: |
280 case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail: | 281 case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail: |
281 case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail: | 282 case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail: |
282 case WebKit::WebLocalizedString::ValidationTypeMismatchForURL: | 283 case WebKit::WebLocalizedString::ValidationTypeMismatchForURL: |
283 return ASCIIToUTF16("type mismatch"); | 284 return ASCIIToUTF16("type mismatch"); |
284 case WebKit::WebLocalizedString::ValidationPatternMismatch: | 285 case WebKit::WebLocalizedString::ValidationPatternMismatch: |
285 return ASCIIToUTF16("pattern mismatch"); | 286 return ASCIIToUTF16("pattern mismatch"); |
286 case WebKit::WebLocalizedString::ValidationTooLong: | 287 case WebKit::WebLocalizedString::ValidationTooLong: |
287 return ASCIIToUTF16("too long"); | 288 return ASCIIToUTF16("too long"); |
288 case WebKit::WebLocalizedString::ValidationRangeUnderflow: | 289 case WebKit::WebLocalizedString::ValidationRangeUnderflow: |
289 return ASCIIToUTF16("range underflow"); | 290 return ASCIIToUTF16("range underflow"); |
290 case WebKit::WebLocalizedString::ValidationRangeOverflow: | 291 case WebKit::WebLocalizedString::ValidationRangeOverflow: |
291 return ASCIIToUTF16("range overflow"); | 292 return ASCIIToUTF16("range overflow"); |
292 case WebKit::WebLocalizedString::ValidationStepMismatch: | 293 case WebKit::WebLocalizedString::ValidationStepMismatch: |
293 return ASCIIToUTF16("step mismatch"); | 294 return ASCIIToUTF16("step mismatch"); |
295 case WebKit::WebLocalizedString::OtherDateLabel: | |
296 return ASCIIToUTF16("OtherDateLabel"); | |
tkent
2012/10/15 09:24:21
The string should have form with which we can dist
| |
297 case WebKit::WebLocalizedString::OtherMonthLabel: | |
298 return ASCIIToUTF16("OtherMonthLabel"); | |
299 case WebKit::WebLocalizedString::OtherTimeLabel: | |
300 return ASCIIToUTF16("OtherTimeLabel"); | |
301 case WebKit::WebLocalizedString::OtherWeekLabel: | |
302 return ASCIIToUTF16("OtherWeekLabel"); | |
303 case WebKit::WebLocalizedString::CalendarClear: | |
304 return ASCIIToUTF16("CalendarClear"); | |
305 case WebKit::WebLocalizedString::CalendarToday: | |
306 return ASCIIToUTF16("CalendarToday"); | |
294 default: | 307 default: |
295 return WebKitPlatformSupportImpl::queryLocalizedString(name); | 308 return WebKitPlatformSupportImpl::queryLocalizedString(name); |
296 } | 309 } |
297 } | 310 } |
298 | 311 |
299 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( | 312 WebKit::WebString TestWebKitPlatformSupport::queryLocalizedString( |
300 WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) { | 313 WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) { |
301 if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow) | 314 if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow) |
302 return ASCIIToUTF16("range underflow"); | 315 return ASCIIToUTF16("range underflow"); |
303 if (name == WebKit::WebLocalizedString::ValidationRangeOverflow) | 316 if (name == WebKit::WebLocalizedString::ValidationRangeOverflow) |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 // Retrieve the last position where we can insert a hyphen before the given | 581 // Retrieve the last position where we can insert a hyphen before the given |
569 // index. | 582 // index. |
570 if (before_index >= 2) { | 583 if (before_index >= 2) { |
571 for (size_t index = before_index - 2; index > 0; --index) { | 584 for (size_t index = before_index - 2; index > 0; --index) { |
572 if (hyphens[index] & 1) | 585 if (hyphens[index] & 1) |
573 return index + 1; | 586 return index + 1; |
574 } | 587 } |
575 } | 588 } |
576 return 0; | 589 return 0; |
577 } | 590 } |
OLD | NEW |