OLD | NEW |
1 ReflectionTests = {}; | 1 ReflectionTests = {}; |
2 | 2 |
3 ReflectionTests.start = new Date().getTime(); | 3 ReflectionTests.start = new Date().getTime(); |
4 | 4 |
5 /** | 5 /** |
6 * Resolve the given URL to an absolute URL, relative to the current document's | 6 * Resolve the given URL to an absolute URL, relative to the current document's |
7 * address. There's no API that I know of that exposes this directly, so we | 7 * address. There's no API that I know of that exposes this directly, so we |
8 * actually just create an <a> element, set its href, and stitch together the | 8 * actually just create an <a> element, set its href, and stitch together the |
9 * various properties. Seems to work. We don't try to reimplement the | 9 * various properties. Seems to work. We don't try to reimplement the |
10 * algorithm here, because we're not concerned with its correctness -- we're | 10 * algorithm here, because we're not concerned with its correctness -- we're |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // Note maxInt, not maxUnsigned. | 455 // Note maxInt, not maxUnsigned. |
456 if (parsed === false || parsed < 1 || parsed > maxInt) { | 456 if (parsed === false || parsed < 1 || parsed > maxInt) { |
457 return null; | 457 return null; |
458 } | 458 } |
459 return parsed; | 459 return parsed; |
460 }, | 460 }, |
461 "idlTests": [0, 1, maxInt, maxInt + 1, maxUnsigned], | 461 "idlTests": [0, 1, maxInt, maxInt + 1, maxUnsigned], |
462 "idlDomExpected": [null/*exception*/, 1, maxInt, null, null] | 462 "idlDomExpected": [null/*exception*/, 1, maxInt, null, null] |
463 }, | 463 }, |
464 /** | 464 /** |
| 465 * "If a reflecting IDL attribute has an unsigned integer type (unsigned |
| 466 * long) that is limited to only non-negative numbers greater than zero |
| 467 * with fallback, then the behaviour is similar to the previous case, but |
| 468 * disallowed values are converted to the default value. On getting, the |
| 469 * content attribute must first be parsed according to the rules for |
| 470 * parsing non-negative integers, and if that is successful, and the value |
| 471 * is in the range 1 to 2147483647 inclusive, the resulting value must be |
| 472 * returned. If, on the other hand, it fails or returns an out of range |
| 473 * value, or if the attribute is absent, the default value must be returned |
| 474 * instead. On setting, first, if the new value is in the range 1 to |
| 475 * 2147483647, then let n be the new value, otherwise let n be the default |
| 476 * value; then, n must be converted to the shortest possible string |
| 477 * representing the number as a valid non-negative integer and that string |
| 478 * must be used as the new content attribute value." |
| 479 */ |
| 480 "limited unsigned long with fallback": { |
| 481 "jsType": "number", |
| 482 "domTests": [minInt - 1, minInt, -36, -1, 0, 1, maxInt, |
| 483 maxInt + 1, maxUnsigned, maxUnsigned + 1, "", "-1", "-0
", "0", "1", |
| 484 "\u00097", "\u000B7", "\u000C7", "\u00207", "\u00A07",
"\uFEFF7", |
| 485 "\u000A7", "\u000D7", "\u20287", "\u20297", "\u16807",
"\u180E7", |
| 486 "\u20007", "\u20017", "\u20027", "\u20037", "\u20047",
"\u20057", |
| 487 "\u20067", "\u20077", "\u20087", "\u20097", "\u200A7",
"\u202F7", |
| 488 "\u30007", |
| 489 " " + binaryString + " foo ", undefined, 1.5, true, fal
se, |
| 490 {"test": 6}, NaN, +Infinity, -Infinity, "\0", |
| 491 {toString:function() {return 2;}, valueOf: null}, |
| 492 {valueOf:function() {return 3;}}], |
| 493 "domExpected": function(val) { |
| 494 var parsed = ReflectionTests.parseNonneg(String(val)); |
| 495 // Note maxInt, not maxUnsigned. |
| 496 if (parsed === false || parsed < 1 || parsed > maxInt) { |
| 497 return null; |
| 498 } |
| 499 return parsed; |
| 500 }, |
| 501 "idlTests": [0, 1, maxInt, maxInt + 1, maxUnsigned], |
| 502 "idlDomExpected": [null, 1, maxInt, null, null] |
| 503 }, |
| 504 /** |
465 * "If a reflecting IDL attribute is a floating point number type (double), | 505 * "If a reflecting IDL attribute is a floating point number type (double), |
466 * then, on getting, the content attribute must be parsed according to the | 506 * then, on getting, the content attribute must be parsed according to the |
467 * rules for parsing floating point number values, and if that is | 507 * rules for parsing floating point number values, and if that is |
468 * successful, the resulting value must be returned. If, on the other hand, | 508 * successful, the resulting value must be returned. If, on the other hand, |
469 * it fails, or if the attribute is absent, the default value must be | 509 * it fails, or if the attribute is absent, the default value must be |
470 * returned instead, or 0.0 if there is no default value. On setting, the | 510 * returned instead, or 0.0 if there is no default value. On setting, the |
471 * given value must be converted to the best representation of the number | 511 * given value must be converted to the best representation of the number |
472 * as a floating point number and then that string must be used as the new | 512 * as a floating point number and then that string must be used as the new |
473 * content attribute value." | 513 * content attribute value." |
474 * | 514 * |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 var time = document.getElementById("time"); | 862 var time = document.getElementById("time"); |
823 if (time) { | 863 if (time) { |
824 time.innerHTML = (new Date().getTime() - ReflectionTests.start)/1000; | 864 time.innerHTML = (new Date().getTime() - ReflectionTests.start)/1000; |
825 } | 865 } |
826 | 866 |
827 if (unimplemented.length) { | 867 if (unimplemented.length) { |
828 var p = document.createElement("p"); | 868 var p = document.createElement("p"); |
829 p.textContent = "(Note: missing tests for types " + unimplemented.join(", ")
+ ".)"; | 869 p.textContent = "(Note: missing tests for types " + unimplemented.join(", ")
+ ".)"; |
830 document.body.appendChild(p); | 870 document.body.appendChild(p); |
831 } | 871 } |
OLD | NEW |