Update web-platform-tests to revision e45156b5e558c062a609356905c83a0258c516e3

This commit is contained in:
WPT Sync Bot 2019-05-02 21:47:51 -04:00
parent 9f6005be16
commit 5fcf52d946
199 changed files with 4430 additions and 530 deletions

View file

@ -17,7 +17,9 @@ function onload_test()
{
const entrylist_checker = new performance_entrylist_checker('mark');
const string_mark_names = mark_names.map(function (x) { return String(x)});
mark_names.forEach(performance.mark, performance);
mark_names.forEach(function(name) {
performance.mark(name);
});
for (let i = 0; i < mark_names.length; ++i)
{
@ -30,13 +32,19 @@ function onload_test()
'First loop: marks that we cleared for "' + mark_names[i] + '" should not exist anymore.');
}
mark_names.forEach(performance.mark, performance);
mark_names.forEach(function(name) {
performance.mark(name);
});
performance.clearMarks();
test_equals(performance.getEntriesByType('mark').length, 0, 'No marks should exist after we clear all.');
// Following cases test clear existed mark name that is tied for two times.
mark_names.forEach(performance.mark, performance);
mark_names.forEach(performance.mark, performance);
mark_names.forEach(function(name) {
performance.mark(name);
});
mark_names.forEach(function(name) {
performance.mark(name);
});
for (let i = 0; i < mark_names.length; ++i)
{
@ -50,8 +58,12 @@ function onload_test()
}
// Following cases test clear functionality when mark names are tied for two times.
mark_names.forEach(performance.mark, performance);
mark_names.forEach(performance.mark, performance);
mark_names.forEach(function(name) {
performance.mark(name);
});
mark_names.forEach(function(name) {
performance.mark(name);
});
var entry_number_before_useless_clear = performance.getEntriesByType('Mark').length;
performance.clearMarks('NonExist');
var entry_number_after_useless_clear = performance.getEntriesByType('Mark').length;

View file

@ -19,7 +19,9 @@ function onload_test()
const entrylist_checker = new performance_entrylist_checker('measure');
const measure_names = measures.map(function(x) {return x[0];});
mark_names.forEach(context.mark, context);
mark_names.forEach(function(name) {
context.mark(name);
});
measures.forEach(context.initialMeasures, context);
for (let i = 0; i < measures.length; ++i)
{
@ -38,7 +40,9 @@ function onload_test()
// Following cases test clear existed measure name that is tied twice.
measures.forEach(context.initialMeasures, context);
mark_names.forEach(context.mark, context);
mark_names.forEach(function(name) {
context.mark(name);
});
measures.forEach(context.initialMeasures, context);
for (let i = 0; i < measures.length; ++i)
{

View file

@ -1,8 +1,8 @@
test(function()
{
self.performance.mark("mark1", "responseStart");
self.performance.mark("mark1");
self.performance.measure("measure1", "mark1");
self.performance.mark("mark2", "responseStart");
self.performance.mark("mark2");
self.performance.measure("measure2", "mark2");
// test that two measures have been created

View file

@ -1,8 +1,8 @@
test(function()
{
self.performance.mark("mark1", "responseStart");
self.performance.mark("mark1");
self.performance.measure("measure1", "mark1");
self.performance.mark("mark2", "responseStart");
self.performance.mark("mark2");
self.performance.measure("measure2", "mark2");
// test that two measures have been created

View file

@ -1,8 +1,8 @@
test(function()
{
self.performance.mark("mark1", "responseStart");
self.performance.mark("mark1");
self.performance.measure("measure1", "mark1");
self.performance.mark("mark2", "responseStart");
self.performance.mark("mark2");
self.performance.measure("measure2", "mark2");
// test that two measures have been created

View file

@ -3,7 +3,7 @@
<title>User Timing L3: mark</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/user-timing-helpers.js"></script>
<script src="resources/user-timing-helper.js"></script>
<script>
async_test(function (t) {
let mark_entries = [];

View file

@ -19,7 +19,9 @@ function onload_test()
const string_mark_names = mark_names.map(function (x) { return String(x)});
test_equals(performance.getEntriesByType("mark").length, 0, 'There should be ' + 0 + ' marks');
mark_names.forEach(performance.mark, performance);
mark_names.forEach(function(name) {
performance.mark(name);
});
let mark_entrylist = performance.getEntriesByType('mark');
entrylist_checker.entrylist_check(mark_entrylist, mark_names.length, string_mark_names, 'Checking all entries.');
@ -31,7 +33,9 @@ function onload_test()
'First loop: checking entry of name "' + mark_entrylist[i].name + '".');
}
mark_names.forEach(performance.mark, performance);
mark_names.forEach(function(name) {
performance.mark(name);
});
mark_entrylist = performance.getEntriesByType('mark');
entrylist_checker.entrylist_check(mark_entrylist, mark_names.length * 2, string_mark_names, 'Checking all doubly marked entries.');

View file

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
This tests that 'performance.measure' throws exceptions with reasonable messages.
</head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
window.performance.clearMarks();
window.performance.clearMeasures();
window.performance.mark('mark');
const eventMarks = [
'unloadEventStart',
'unloadEventEnd',
'redirectStart',
'redirectEnd',
'secureConnectionStart',
'domInteractive',
'domContentLoadedEventStart',
'domContentLoadedEventEnd',
'domComplete',
'loadEventStart',
'loadEventEnd',
];
eventMarks.forEach(function(name) {
test(()=>{
assert_throws("InvalidAccessError", ()=>{
window.performance.measure("measuring", name, "mark");
}, "Should throw");
}, `Passing '${name}' as a mark to measure API should cause error when the mark is empty.`);
});
const args = [
51.15, // Verify that number is parsed as string, not number.
"DoesNotExist", // Non-existant mark name should cause error.
];
args.forEach(each => {
test(()=>{
assert_throws("SyntaxError", ()=>{
window.performance.measure("measuring", each, "mark");
}, "Should throw");
}, `Passing ${each} as a mark to measure API should cause error.`);
});
</script>
</body>
</html>

View file

@ -3,7 +3,7 @@
<title>User Timing L3: measure is customizable</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/user-timing-helpers.js"></script>
<script src="resources/user-timing-helper.js"></script>
<script>
async_test(function (t) {
let measureEntries = [];

View file

@ -25,7 +25,9 @@ function onload_test()
];
const context = new PerformanceContext(window.performance);
mark_names.forEach(context.mark, context);
mark_names.forEach(function(name) {
context.mark(name);
});
measures_for_timing_order.forEach(context.initialMeasures, context);
test_greater_than(context.getEntriesByName('nav2now', 'measure')[0].duration, 0, 'Measure of navigationStart to now should be positive value.');
test_greater_than(context.getEntriesByName('loadTime', 'measure')[0].duration, 0, 'Measure of navigationStart to loadEventEnd should be positive value.');
@ -33,7 +35,9 @@ function onload_test()
test_equals(context.getEntriesByName('loadTime', 'measure')[0].duration + context.getEntriesByName('loadEventEnd2a', 'measure')[0].duration, context.getEntriesByName('nav2a', 'measure')[0].duration, 'loadTime plus loadEventEnd to a mark "a" should equal to navigationStart to "a".');
// Following cases test for scenarios that measure names are tied twice.
mark_names.forEach(context.mark, context);
mark_names.forEach(function(name) {
context.mark(name);
});
measures_for_timing_order.forEach(context.initialMeasures, context);
test_greater_than(context.getEntriesByName('nav2now', 'measure')[1].duration, context.getEntriesByName('nav2now', 'measure')[0].duration, 'Second measure of current mark to navigationStart should be negative value.');

View file

@ -21,7 +21,9 @@ function onload_test()
test_equals(context.getEntriesByType('measure').length, 0, 'There should be ' + 0 + ' entries returned.');
mark_names.forEach(context.mark, context);
mark_names.forEach(function(name) {
context.mark(name);
});
measures.forEach(context.initialMeasures, context);
let measure_entrylist = context.getEntriesByType('measure');
@ -36,7 +38,9 @@ function onload_test()
}
// Following cases test for scenarios that measure names are tied for two times
mark_names.forEach(context.mark, context);
mark_names.forEach(function(name) {
context.mark(name);
});
measures.forEach(context.initialMeasures, context);
measure_entrylist = context.getEntriesByType('measure');