Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -88,28 +88,29 @@ function test_resource_entries(entries, expected_entries)
}
}
}
function performance_entrylist_checker(type)
{
var entryType = type;
const entryType = type;
function entry_check(entry, expectedNames)
function entry_check(entry, expectedNames, testDescription = '')
{
var msg = 'Entry \"' + entry.name + '\" should be one that we have set.';
const msg = testDescription + 'Entry \"' + entry.name + '\" should be one that we have set.';
wp_test(function() { assert_in_array(entry.name, expectedNames, msg); }, msg);
test_equals(entry.entryType, entryType, 'entryType should be \"' + entryType + '\".');
test_equals(entry.entryType, entryType, testDescription + 'entryType should be \"' + entryType + '\".');
if (type === "measure") {
test_true(isFinite(entry.startTime), 'startTime should be a number.');
test_true(isFinite(entry.duration), 'duration should be a number.');
test_true(isFinite(entry.startTime), testDescription + 'startTime should be a number.');
test_true(isFinite(entry.duration), testDescription + 'duration should be a number.');
} else if (type === "mark") {
test_greater_than(entry.startTime, 0, 'startTime should greater than 0.');
test_equals(entry.duration, 0, 'duration of mark should be 0.');
test_greater_than(entry.startTime, 0, testDescription + 'startTime should greater than 0.');
test_equals(entry.duration, 0, testDescription + 'duration of mark should be 0.');
}
}
function entrylist_order_check(entryList)
{
var inOrder = true;
for (var i = 0; i < entryList.length - 1; ++i)
let inOrder = true;
for (let i = 0; i < entryList.length - 1; ++i)
{
if (entryList[i + 1].startTime < entryList[i].startTime) {
inOrder = false;
@ -119,13 +120,13 @@ function performance_entrylist_checker(type)
return inOrder;
}
function entrylist_check(entryList, expectedLength, expectedNames)
function entrylist_check(entryList, expectedLength, expectedNames, testDescription = '')
{
test_equals(entryList.length, expectedLength, 'There should be ' + expectedLength + ' entries.');
test_true(entrylist_order_check(entryList), 'Entries in entrylist should be in order.');
for (var i = 0; i < entryList.length; ++i)
test_equals(entryList.length, expectedLength, testDescription + 'There should be ' + expectedLength + ' entries.');
test_true(entrylist_order_check(entryList), testDescription + 'Entries in entrylist should be in order.');
for (let i = 0; i < entryList.length; ++i)
{
entry_check(entryList[i], expectedNames);
entry_check(entryList[i], expectedNames, testDescription + 'Entry_list ' + i + '. ');
}
}