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

Side by Side Diff: LayoutTests/resources/testharness.js

Issue 821303006: bindings: Fixes layouttests when moving attributes to prototype chains. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
OLDNEW
1 /*global self*/ 1 /*global self*/
2 /*jshint latedef: nofunc*/ 2 /*jshint latedef: nofunc*/
3 /* 3 /*
4 Distributed under both the W3C Test Suite License [1] and the W3C 4 Distributed under both the W3C Test Suite License [1] and the W3C
5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the 5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
6 policies and contribution forms [3]. 6 policies and contribution forms [3].
7 7
8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license 8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license 9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
10 [3] http://www.w3.org/2004/10/27-testcases 10 [3] http://www.w3.org/2004/10/27-testcases
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 * assert that object has own property property_name 383 * assert that object has own property property_name
384 * 384 *
385 * assert_inherits(object, property_name, description) 385 * assert_inherits(object, property_name, description)
386 * assert that object does not have an own property named property_name 386 * assert that object does not have an own property named property_name
387 * but that property_name is present in the prototype chain for object 387 * but that property_name is present in the prototype chain for object
388 * 388 *
389 * assert_idl_attribute(object, attribute_name, description) 389 * assert_idl_attribute(object, attribute_name, description)
390 * assert that an object that is an instance of some interface has the 390 * assert that an object that is an instance of some interface has the
391 * attribute attribute_name following the conditions specified by WebIDL 391 * attribute attribute_name following the conditions specified by WebIDL
392 * 392 *
393 * assert_will_be_idl_attribute(object, attribute_name, description)
394 * assert that an object that is an instance of some interface has the
395 * attribute attribute_name following the conditions specified by WebIDL,
396 * but it's acceptable that the attribute attribute_name is an own property
397 * of the object because we're in the middle of moving the attribute to
398 * a prototype chain.
399 *
393 * assert_readonly(object, property_name, description) 400 * assert_readonly(object, property_name, description)
394 * assert that property property_name on object is readonly 401 * assert that property property_name on object is readonly
395 * 402 *
396 * assert_throws(code, func, description) 403 * assert_throws(code, func, description)
397 * code - the expected exception: 404 * code - the expected exception:
398 * o string: the thrown exception must be a DOMException with the given 405 * o string: the thrown exception must be a DOMException with the given
399 * name, e.g., "TimeoutError" (for compatibility with existing 406 * name, e.g., "TimeoutError" (for compatibility with existing
400 * tests, a constant is also supported, e.g., "TIMEOUT_ERR") 407 * tests, a constant is also supported, e.g., "TIMEOUT_ERR")
401 * o object: the thrown exception must have a property called "name" that 408 * o object: the thrown exception must have a property called "name" that
402 * matches code.name 409 * matches code.name
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1351
1345 assert(property_name in object, 1352 assert(property_name in object,
1346 name, description, 1353 name, description,
1347 "property ${p} not found in prototype chain", 1354 "property ${p} not found in prototype chain",
1348 {p:property_name}); 1355 {p:property_name});
1349 }; 1356 };
1350 } 1357 }
1351 expose(_assert_inherits("assert_inherits"), "assert_inherits"); 1358 expose(_assert_inherits("assert_inherits"), "assert_inherits");
1352 expose(_assert_inherits("assert_idl_attribute"), "assert_idl_attribute"); 1359 expose(_assert_inherits("assert_idl_attribute"), "assert_idl_attribute");
1353 1360
1361 // FIXME: Remove assert_will_be_idl_attribute once we finish the transition
1362 // of moving the DOM attributes to prototype chains.
1363 function assert_will_be_idl_attribute(object, property_name, description) {
1364 assert(typeof object === "object",
1365 "assert_will_be_idl_attribute", description,
1366 "provided value is not an object");
1367
1368 assert("hasOwnProperty" in object,
1369 "assert_will_be_idl_attribute", description,
1370 "provided value is an object but has no hasOwnProperty method");
1371
1372 // Do not test if property_name is not an own property because
1373 // property_name is in the middle of the transition to a prototype
1374 // chain.
1375
1376 assert(property_name in object,
1377 "assert_will_be_idl_attribute", description,
1378 "property ${p} not found in the provided value",
1379 {p:property_name});
1380 }
1381 expose(assert_will_be_idl_attribute, "assert_will_be_idl_attribute");
1382
1354 function assert_readonly(object, property_name, description) 1383 function assert_readonly(object, property_name, description)
1355 { 1384 {
1356 var initial_value = object[property_name]; 1385 var initial_value = object[property_name];
1357 try { 1386 try {
1358 //Note that this can have side effects in the case where 1387 //Note that this can have side effects in the case where
1359 //the property has PutForwards 1388 //the property has PutForwards
1360 object[property_name] = initial_value + "a"; //XXX use some other v alue here? 1389 object[property_name] = initial_value + "a"; //XXX use some other v alue here?
1361 assert(same_value(object[property_name], initial_value), 1390 assert(same_value(object[property_name], initial_value),
1362 "assert_readonly", description, 1391 "assert_readonly", description,
1363 "changing property ${p} succeeded", 1392 "changing property ${p} succeeded",
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 } else if (!tests.allow_uncaught_exception) { 2792 } else if (!tests.allow_uncaught_exception) {
2764 tests.status.status = tests.status.ERROR; 2793 tests.status.status = tests.status.ERROR;
2765 tests.status.message = e.message; 2794 tests.status.message = e.message;
2766 } 2795 }
2767 }); 2796 });
2768 2797
2769 test_environment.on_tests_ready(); 2798 test_environment.on_tests_ready();
2770 2799
2771 })(); 2800 })();
2772 // vim: set expandtab shiftwidth=4 tabstop=4: 2801 // vim: set expandtab shiftwidth=4 tabstop=4:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698