Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/LayoutTests/resources/idlharness.js

Issue 2891463002: Update testharness.js and idlharness.js. (Closed)
Patch Set: Update expectations Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Distributed under both the W3C Test Suite License [1] and the W3C 2 Distributed under both the W3C Test Suite License [1] and the W3C
3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the 3 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
4 policies and contribution forms [3]. 4 policies and contribution forms [3].
5 5
6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license 6 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license 7 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
8 [3] http://www.w3.org/2004/10/27-testcases 8 [3] http://www.w3.org/2004/10/27-testcases
9 */ 9 */
10 10
11 /* For user documentation see docs/idlharness.md */ 11 /* For user documentation see docs/_writing-tests/idlharness.md */
12 12
13 /** 13 /**
14 * Notes for people who want to edit this file (not just use it as a library): 14 * Notes for people who want to edit this file (not just use it as a library):
15 * 15 *
16 * Most of the interesting stuff happens in the derived classes of IdlObject, 16 * Most of the interesting stuff happens in the derived classes of IdlObject,
17 * especially IdlInterface. The entry point for all IdlObjects is .test(), 17 * especially IdlInterface. The entry point for all IdlObjects is .test(),
18 * which is called by IdlArray.test(). An IdlObject is conceptually just 18 * which is called by IdlArray.test(). An IdlObject is conceptually just
19 * "thing we want to run tests on", and an IdlArray is an array of IdlObjects 19 * "thing we want to run tests on", and an IdlArray is an array of IdlObjects
20 * with some additional data thrown in. 20 * with some additional data thrown in.
21 * 21 *
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 } 1626 }
1627 current_interface.test_interface_of(desc, obj, exception, expected_typeo f); 1627 current_interface.test_interface_of(desc, obj, exception, expected_typeo f);
1628 current_interface = this.array.members[current_interface.base]; 1628 current_interface = this.array.members[current_interface.base];
1629 } 1629 }
1630 }; 1630 };
1631 1631
1632 //@} 1632 //@}
1633 IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception , expected_typeof) 1633 IdlInterface.prototype.test_primary_interface_of = function(desc, obj, exception , expected_typeof)
1634 //@{ 1634 //@{
1635 { 1635 {
1636 // Only the object itself, not its members, are tested here, so if the
1637 // interface is untested, there is nothing to do.
1638 if (!this.untested)
1639 {
1640 return;
1641 }
1642
1636 // We can't easily test that its prototype is correct if there's no 1643 // We can't easily test that its prototype is correct if there's no
1637 // interface object, or the object is from a different global environment 1644 // interface object, or the object is from a different global environment
1638 // (not instanceof Object). TODO: test in this case that its prototype at 1645 // (not instanceof Object). TODO: test in this case that its prototype at
1639 // least looks correct, even if we can't test that it's actually correct. 1646 // least looks correct, even if we can't test that it's actually correct.
1640 if (!this.has_extended_attribute("NoInterfaceObject") 1647 if (!this.has_extended_attribute("NoInterfaceObject")
1641 && (typeof obj != expected_typeof || obj instanceof Object)) 1648 && (typeof obj != expected_typeof || obj instanceof Object))
1642 { 1649 {
1643 test(function() 1650 test(function()
1644 { 1651 {
1645 assert_equals(exception, null, "Unexpected exception when evaluating object"); 1652 assert_equals(exception, null, "Unexpected exception when evaluating object");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 //@} 1684 //@}
1678 IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect ed_typeof) 1685 IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect ed_typeof)
1679 //@{ 1686 //@{
1680 { 1687 {
1681 // TODO: Indexed and named properties, more checks on interface members 1688 // TODO: Indexed and named properties, more checks on interface members
1682 this.already_tested = true; 1689 this.already_tested = true;
1683 1690
1684 for (var i = 0; i < this.members.length; i++) 1691 for (var i = 0; i < this.members.length; i++)
1685 { 1692 {
1686 var member = this.members[i]; 1693 var member = this.members[i];
1694 if (member.untested) {
1695 continue;
1696 }
1687 if (!exposed_in(exposure_set(member, this.exposureSet))) { 1697 if (!exposed_in(exposure_set(member, this.exposureSet))) {
1688 test(function() { 1698 test(function() {
1689 assert_false(member.name in obj); 1699 assert_false(member.name in obj);
1690 }.bind(this), this.name + "interface: " + desc + 'must not have prop erty "' + member.name + '"'); 1700 }.bind(this), this.name + "interface: " + desc + 'must not have prop erty "' + member.name + '"');
1691 continue; 1701 continue;
1692 } 1702 }
1693 if (member.type == "attribute" && member.isUnforgeable) 1703 if (member.type == "attribute" && member.isUnforgeable)
1694 { 1704 {
1695 var a_test = async_test(this.name + " interface: " + desc + ' must h ave own property "' + member.name + '"'); 1705 var a_test = async_test(this.name + " interface: " + desc + ' must h ave own property "' + member.name + '"');
1696 a_test.step(function() { 1706 a_test.step(function() {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 } 1894 }
1885 1895
1886 // "The value of the Function object’s “length” property is the Number 1896 // "The value of the Function object’s “length” property is the Number
1887 // value 0." 1897 // value 0."
1888 assert_equals(desc.get.length, 0, "getter length must be 0"); 1898 assert_equals(desc.get.length, 0, "getter length must be 0");
1889 1899
1890 1900
1891 // TODO: Test calling setter on the interface prototype (should throw 1901 // TODO: Test calling setter on the interface prototype (should throw
1892 // TypeError in most cases). 1902 // TypeError in most cases).
1893 if (member.readonly 1903 if (member.readonly
1904 && !member.has_extended_attribute("LenientSetter")
1894 && !member.has_extended_attribute("PutForwards") 1905 && !member.has_extended_attribute("PutForwards")
1895 && !member.has_extended_attribute("Replaceable")) 1906 && !member.has_extended_attribute("Replaceable"))
1896 { 1907 {
1897 // "The attribute setter is undefined if the attribute is declared 1908 // "The attribute setter is undefined if the attribute is declared
1898 // readonly and has neither a [PutForwards] nor a [Replaceable] 1909 // readonly and has neither a [PutForwards] nor a [Replaceable]
1899 // extended attribute declared on it." 1910 // extended attribute declared on it."
1900 assert_equals(desc.set, undefined, "setter must be undefined for readonl y attributes"); 1911 assert_equals(desc.set, undefined, "setter must be undefined for readonl y attributes");
1901 } 1912 }
1902 else 1913 else
1903 { 1914 {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 /** The idlType that we are supposed to be typedeffing to. */ 2044 /** The idlType that we are supposed to be typedeffing to. */
2034 this.idlType = obj.idlType; 2045 this.idlType = obj.idlType;
2035 2046
2036 } 2047 }
2037 //@} 2048 //@}
2038 2049
2039 IdlTypedef.prototype = Object.create(IdlObject.prototype); 2050 IdlTypedef.prototype = Object.create(IdlObject.prototype);
2040 2051
2041 }()); 2052 }());
2042 // vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker: 2053 // vim: set expandtab shiftwidth=4 tabstop=4 foldmarker=@{,@} foldmethod=marker:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698