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

Side by Side Diff: LayoutTests/http/tests/resources/testharness-helpers.js

Issue 821303006: bindings: Fixes layouttests when moving attributes to prototype chains. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed performance memory tests and addressed review comments. 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 /* 1 /*
2 * testharness-helpers contains various useful extensions to testharness.js to 2 * testharness-helpers contains various useful extensions to testharness.js to
3 * allow them to be used across multiple tests before they have been 3 * allow them to be used across multiple tests before they have been
4 * upstreamed. This file is intended to be usable from both document and worker 4 * upstreamed. This file is intended to be usable from both document and worker
5 * environments, so code should for example not rely on the DOM. 5 * environments, so code should for example not rely on the DOM.
6 */ 6 */
7 7
8 // Returns a promise that fulfills after the provided |promise| is fulfilled. 8 // Returns a promise that fulfills after the provided |promise| is fulfilled.
9 // The |test| succeeds only if |promise| rejects with an exception matching 9 // The |test| succeeds only if |promise| rejects with an exception matching
10 // |code|. Accepted values for |code| follow those accepted for assert_throws(). 10 // |code|. Accepted values for |code| follow those accepted for assert_throws().
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // elements as determined by assert_object_equals(). The corresponding elements 115 // elements as determined by assert_object_equals(). The corresponding elements
116 // must occupy corresponding indices in their respective arrays. 116 // must occupy corresponding indices in their respective arrays.
117 function assert_array_objects_equals(actual, expected, description) { 117 function assert_array_objects_equals(actual, expected, description) {
118 assert_true(Array.isArray(actual), description); 118 assert_true(Array.isArray(actual), description);
119 assert_equals(actual.length, expected.length, description); 119 assert_equals(actual.length, expected.length, description);
120 actual.forEach(function(value, index) { 120 actual.forEach(function(value, index) {
121 assert_object_equals(value, expected[index], 121 assert_object_equals(value, expected[index],
122 description + ' : object[' + index + ']'); 122 description + ' : object[' + index + ']');
123 }); 123 });
124 } 124 }
125
126 // Asserts that |object| that is an instance of some interface has the attribute
127 // |attribute_name| following the conditions specified by WebIDL, but it's
128 // acceptable that the attribute |attribute_name| is an own property of the
129 // object because we're in the middle of moving the attribute to a prototype
130 // chain. Once we complete the transition to prototype chains,
131 // assert_will_be_idl_attribute must be replaced with assert_idl_attribute
132 // defined in testharness.js.
133 //
134 // FIXME: Remove assert_will_be_idl_attribute once we complete the transition
135 // of moving the DOM attributes to prototype chains. (http://crbug.com/43394)
136 function assert_will_be_idl_attribute(object, attribute_name, description) {
137 assert_true(typeof object === "object", description);
138
139 assert_true("hasOwnProperty" in object, description);
140
141 // Do not test if |attribute_name| is not an own property because
142 // |attribute_name| is in the middle of the transition to a prototype
143 // chain. (http://crbug.com/43394)
144
145 assert_true(attribute_name in object, description);
146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698