Update web-platform-tests to revision 1e4fe87a7f01c0b5c614c8f601ffa68b4a00662a

This commit is contained in:
WPT Sync Bot 2018-02-13 20:15:58 -05:00
parent 4c3f1756da
commit 432648745e
164 changed files with 8354 additions and 595 deletions

View file

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates the functionality of clearResourceTimings method in resource timing.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({ explicit_done: true });
const context = new PerformanceContext(performance);
function onload_test()
{
test_equals(context.getEntriesByType('resource').length, 4, 4 + ' resource timing entries should be stored in this page.');
context.clearResourceTimings();
test_equals(context.getEntriesByType('resource').length, 0, 'No resource timing entries should be stored after clearResourceTimings.');
done();
}
</script>
</head>
<body onload=onload_test()>
</body>
</html>

View file

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates the values in resource timing for a timing allowed cross-origin redirect.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({explicit_done: true});
function onload_test() {
const context = new PerformanceContext(performance);
const entry = context.getEntriesByName(document.getElementById('frameContext').src, 'resource')[0];
test_greater_than(entry.redirectStart, 0, 'redirectStart should be greater than 0 in timing allowed cross-origin redirect.');
test_equals(entry.redirectStart, entry.startTime, 'redirectStart should be equal to startTime in timing allowed cross-origin redirect.');
test_greater_or_equals(entry.redirectEnd, entry.redirectStart, 'redirectEnd should be no less than redirectStart in timing allowed cross-origin redirect.');
test_greater_or_equals(entry.fetchStart, entry.redirectEnd, 'fetchStart should be no less than redirectEnd in timing allowed cross-origin redirect.');
done();
}
</script>
</head>
<body>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<script>
const destUrl = '/common/redirect.py?location=/resource-timing/resources/iframe_TAO_match_origin.html';
const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test;
frameContext.src = destUrl;
</script>
</body>
</html>

View file

@ -0,0 +1,41 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<title>This test validates the functionality of onresourcetimingbufferfull in resource timing.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
</head>
<body onload=onload_test()>
<script>
const context = new PerformanceContext(performance);
const bufferSize = 5;
context.setResourceTimingBufferSize(bufferSize);
let bufferFullCount = 0;
function buffer_full_callback() {
bufferFullCount++;
}
context.registerResourceTimingBufferFullCallback(buffer_full_callback);
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
function appendScript(src) {
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
document.body.appendChild(script);
}
appendScript('resources/empty.js');
appendScript('resources/empty_script.js');
appendScript('resources/resource_timing_test0.js');
setup({ explicit_done: true });
function onload_test() {
test_equals(context.getEntriesByType('resource').length, bufferSize, 'There should only be |bufferSize| resource entries.');
test_equals(bufferFullCount, 1, 'onresourcetimingbufferfull should have been invoked once buffer is full.');
done();
}
</script>
</body>
</html>

View file

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates the functionality of onresourcetimingbufferfull in resource timing.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
const context = new PerformanceContext(performance);
let bufferFullCount = 0;
function buffer_full_call_back() {
bufferFullCount++;
}
context.registerResourceTimingBufferFullCallback(buffer_full_call_back);
setup({ explicit_done: true });
function onload_test() {
context.setResourceTimingBufferSize(3);
context.setResourceTimingBufferSize(0);
test_equals(context.getEntriesByType('resource').length, 4, 'There are 4 scripts, and setResourceTimingBufferSize does not reduce the size.');
test_equals(bufferFullCount, 0, 'onresourcetimingbufferfull should not be invoked during setResourceTimingBufferSize.');
done();
}
</script>
</head>
<body onload=onload_test()>
</body>
</html>

View file

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates the values in resource timing for a cross-origin redirect.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({explicit_done: true});
function onload_test() {
const context = new PerformanceContext(performance);
const entry = context.getEntriesByName(document.getElementById('frameContext').src, 'resource')[0];
test_equals(entry.redirectStart, 0, 'redirectStart should be 0 in cross-origin redirect.');
test_equals(entry.redirectEnd, 0, 'redirectEnd should be 0 in cross-origin redirect.');
test_equals(entry.domainLookupStart, 0, 'domainLookupStart should be 0 in cross-origin redirect.');
test_equals(entry.domainLookupEnd, 0, 'domainLookupEnd should be 0 in cross-origin redirect.');
test_equals(entry.connectStart, 0, 'connectStart should be 0 in cross-origin redirect.');
test_equals(entry.connectEnd, 0, 'connectEnd should be 0 in cross-origin redirect.');
test_equals(entry.requestStart, 0, 'requestStart should be 0 in cross-origin redirect.');
test_equals(entry.responseStart, 0, 'responseStart should be 0 in cross-origin redirect.');
test_equals(entry.secureConnectionStart, 0, 'secureConnectionStart should be 0 in cross-origin redirect.');
test_greater_than(entry.fetchStart, 0, 'fetchStart should be greater than 0 in cross-origin redirect.');
test_greater_than(entry.responseEnd, 0, 'responseEnd should be greater than 0 in cross-origin redirect.');
done();
}
</script>
</head>
<body>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<script>
let destUrl = '/common/redirect.py?location=';
// Add www to get a cross origin frame.
destUrl += 'http://www.' + document.location.host + '/resource-timing/resources/blank_page_green.htm';
const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test;
frameContext.src = destUrl;
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>This test validates the values of the redirectStart/End in resource timing for a same-origin resource redirect.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({explicit_done: true});
function onload_test() {
const context = new PerformanceContext(performance);
const entry = context.getEntriesByName(document.getElementById('frameContext').src, 'resource')[0];
test_greater_than(entry.redirectStart, 0, 'redirectStart should be greater than 0 in same-origin redirect.');
test_equals(entry.redirectStart, entry.startTime, 'redirectStart should be equal to startTime in same-origin redirect.');
test_noless_than(entry.redirectEnd, entry.redirectStart, 'redirectEnd should be no less than redirectStart in same-origin redirect.');
test_noless_than(entry.fetchStart, entry.redirectEnd, 'fetchStart should be no less than redirectEnd in same-origin redirect.');
done();
}
</script>
</head>
<body>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<script>
let destUrl = '/common/redirect.py';
destUrl += '?location=/resource-timing/resources/blank_page_green.htm';
const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test;
frameContext.src = destUrl;
</script>
</body>
</html>

View file

@ -0,0 +1,56 @@
<!DOCTYPE HTML>
<html>
<head onload>
<meta charset="utf-8" />
<title>This test validates the behavior of read and clear operation in onresourcetimingbufferfull callback of resource timing.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
</head>
<body onload=onload_test()>
<script>
const context = new PerformanceContext(performance);
const resource_timing_buffer_size = 1;
let global_buffer = [];
function store_and_clear() {
const entryList = context.getEntriesByType('resource');
entryList.forEach(function (entry) {
global_buffer.push(entry);
});
context.clearResourceTimings();
}
context.registerResourceTimingBufferFullCallback(store_and_clear);
context.setResourceTimingBufferSize(resource_timing_buffer_size);
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
function appendScript(src) {
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = src;
document.body.appendChild(script);
}
appendScript('resources/empty.js');
appendScript('resources/empty_script.js');
appendScript('resources/resource_timing_test0.js');
setup({ explicit_done: true });
function onload_test() {
test_equals(context.getEntriesByType('resource').length, 0, 'No entry should be stored in resource timing buffer since its cleared once an item arrived.');
// The entry for empty.js must not be in the global buffer, but all others should be.
test_equals(global_buffer.length, 6, '6 resource timing entries should be moved to global buffer.');
const index = window.location.pathname.lastIndexOf('resource-timing');
const pathname = window.location.pathname.substring(0, index);
let expected_entries = {};
expected_entries[pathname + 'resources/testharness.js'] = 'script';
expected_entries[pathname + 'resources/testharnessreport.js'] = 'script';
expected_entries[pathname + 'resource-timing/resources/webperftestharness.js'] = 'script';
expected_entries[pathname + 'resource-timing/resources/webperftestharnessextension.js'] = 'script';
expected_entries[pathname + 'resource-timing/resources/empty_script.js'] = 'script';
expected_entries[pathname + 'resource-timing/resources/resource_timing_test0.js'] = 'script';
test_resource_entries(global_buffer, expected_entries);
done();
}
</script>
</body>
</html>