Revision f7aab0af8bf4ffc4aa24ce4bb5299b0a063ff8ef authored by Adam Rice on 05 April 2018, 15:11:00 UTC, committed by Adam Rice on 13 April 2018, 14:58:07 UTC
ReadableStream, WritableStream and TransformStream look up and validate properties on their arguments. Add tests to verify that these lookups and validations happen in the order specified by the standard. https://github.com/whatwg/streams/pull/922 adjusts some of the ordering of these operations. These tests correspond to that change. A new utility file streams/resources/constructor-ordering.js contains functions to construct objects which track property lookups and validations and can cause them to fail. For each constructor the constructor.js file contains a list of the expected operations in order, and a test case to verify it. A test in streams/transform-streams/properties.js already detected the ordering of property accesses by the TransformStream constructor. writableStrategy is now accessed before readableStrategy to match the order of the constructor arguments, and so the expectations of this test are changed to match.
1 parent 6e1b5f4
performance-timeline-utils.js
var performanceNamespace = window.performance;
var namespace_check = false;
function wp_test(func, msg, properties)
{
// only run the namespace check once
if (!namespace_check)
{
namespace_check = true;
if (performanceNamespace === undefined || performanceNamespace == null)
{
// show a single error that window.performance is undefined
test(function() { assert_true(performanceNamespace !== undefined && performanceNamespace != null, "window.performance is defined and not null"); }, "window.performance is defined and not null.", {author:"W3C http://www.w3.org/",help:"http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",assert:"The window.performance attribute provides a hosting area for performance related attributes. "});
}
}
test(func, msg, properties);
}
function test_true(value, msg, properties)
{
wp_test(function () { assert_true(value, msg); }, msg, properties);
}
function test_equals(value, equals, msg, properties)
{
wp_test(function () { assert_equals(value, equals, msg); }, msg, properties);
}
// assert for every entry in `expectedEntries`, there is a matching entry _somewhere_ in `actualEntries`
function test_entries(actualEntries, expectedEntries) {
test_equals(actualEntries.length, expectedEntries.length)
expectedEntries.forEach(function (expectedEntry) {
var foundEntry = actualEntries.find(function (actualEntry) {
return typeof Object.keys(expectedEntry).find(function (key) {
return actualEntry[key] !== expectedEntry[key]
}) === 'undefined'
})
test_true(!!foundEntry, `Entry ${JSON.stringify(expectedEntry)} could not be found.`)
if (foundEntry) {
assert_object_equals(foundEntry.toJSON(), expectedEntry)
}
})
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...