Commit e711e1f8 authored by Nicolás Peña's avatar Nicolás Peña Committed by Commit Bot

Prepare to move last Intel resource-timing tests to WPT

This CL fixes wpt-nits in the two tests remaining in the folder
http/tests/w3c/webperf/submission/Intel/resource-timing

Bug: 498037
Change-Id: Iff5f79ddda48ac7e72988d35a40d6aff6e3c0751
Reviewed-on: https://chromium-review.googlesource.com/961921Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543231}
parent 2a1be7d6
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>resource timing information for cross-origin redirect chain</title> <title>This test validates resource timing information for a cross-origin redirect chain.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" /> <link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/> <link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/w3c/resources/testharness.js"></script> <script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script> <script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script> <script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script> <script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<script> <script>
setup({explicit_done: true}); setup({explicit_done: true});
setup({timeout: 30000}); test_namespace('getEntriesByName');
test_namespace(); const pageOrigin = '127.0.0.1:8000';
var pageOrigin = "127.0.0.1:8000"; const crossOrigin = 'localhost:8000';
var crossOrigin = "localhost:8000";
function onload_test() function onload_test()
{ {
var context = new PerformanceContext(performance); const context = new PerformanceContext(performance);
var entry = context.getEntriesByName(document.getElementById("frameContext").src, "resource")[0]; const entries = context.getEntriesByName(document.getElementById('frameContext').src, 'resource');
test_equals(entries.length, 1, 'There should be one entry.');
const entry = entries[0];
test_equals(entry.redirectStart, 0, "redirectStart should be 0 in cross-origin redirect! "); test_equals(entry.redirectStart, 0, 'redirectStart == 0 in cross-origin redirect.');
test_equals(entry.redirectEnd, 0, "redirectEnd should be 0 in cross-origin redirect! "); test_equals(entry.redirectEnd, 0, 'redirectEnd == 0 in cross-origin redirect.');
test_greater_or_equals(entry.fetchStart, 3000, "fetchStart should be 3 secs later than navigationStart"); test_greater_than(entry.fetchStart, 0, 'fetchStart > 0 in cross-origin redirect.');
test_equals(entry.startTime, entry.fetchStart, "startTime should be the same to fetchStart in cross-origin redirect!"); test_equals(entry.startTime, entry.fetchStart, 'startTime == fetchStart in cross-origin redirect.');
done(); done();
} }
</script> </script>
</head> </head>
<body> <body>
<h1>Description</h1> <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<p>This test validates the values in resource timing for cross-origin redirect chain.</p> <script>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> test_equals(document.location.host, pageOrigin, 'Starting document.location.hostname is correct (' + pageOrigin + ')');
<script>
test_equals(document.location.host, pageOrigin, 'Starting document.location.hostname is correct (' + pageOrigin + ')');
var destUrl = 'http://' + crossOrigin + '/w3c/webperf/resources/multi_redirect.php?'; let destUrl = 'http://' + crossOrigin + '/w3c/webperf/resources/multi_redirect.php?';
destUrl += 'pageOrigin=' + 'http://' + pageOrigin; destUrl += 'pageOrigin=' + 'http://' + pageOrigin;
destUrl += '&crossOrigin=' + 'http://' + crossOrigin; destUrl += '&crossOrigin=' + 'http://' + crossOrigin;
destUrl += '&timingAllow=0'; destUrl += '&timingAllow=0';
var frameContext = document.getElementById("frameContext"); const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test; frameContext.onload = onload_test;
frameContext.src = destUrl; frameContext.src = destUrl;
</script> </script>
<div id="log"></div> </body>
</body>
</html> </html>
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>resource timing information for timing allowed cross-origin redirect chain</title> <title>This test validates resource timing information for a timing allowed cross-origin redirect chain.</title>
<link rel="author" title="Intel" href="http://www.intel.com/" /> <link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/> <link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<script src="/w3c/resources/testharness.js"></script> <script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script> <script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script> <script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script> <script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<script> <script>
setup({explicit_done: true}); setup({explicit_done: true});
setup({timeout: 30000}); test_namespace('getEntriesByName');
test_namespace(); const pageOrigin = '127.0.0.1:8000';
var pageOrigin = "127.0.0.1:8000"; const crossOrigin = 'localhost:8000';
var crossOrigin = "localhost:8000";
function onload_test() function onload_test()
{ {
var context = new PerformanceContext(performance); const context = new PerformanceContext(performance);
var entry = context.getEntriesByName(document.getElementById("frameContext").src, "resource")[0]; const entries = context.getEntriesByName(document.getElementById('frameContext').src, 'resource');
test_equals(entries.length, 1, 'There should be one entry.');
const entry = entries[0];
test_greater_than(entry.redirectStart, 0, "redirectStart should be greater than 0 in timing allowed cross-origin redirect! "); test_greater_than(entry.redirectStart, 0, 'redirectStart > 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_equals(entry.redirectStart, entry.startTime, 'redirectStart == startTime in timing allowed cross-origin redirect.');
test_greater_or_equals(entry.redirectEnd, entry.redirectStart + 3000, "redirectEnd should be 3 secs later than redirectStart"); test_greater_than(entry.redirectEnd, entry.redirectStart, 'redirectEnd > 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!"); test_greater_or_equals(entry.fetchStart, entry.redirectEnd, 'fetchStart >= redirectEnd in timing allowed cross-origin redirect.');
done(); done();
} }
</script> </script>
</head> </head>
<body> <body>
<h1>Description</h1> <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
<p>This test validates the values in resource timing for a timing allowed cross-origin redirect chain.</p> <script>
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> test_equals(document.location.host, pageOrigin, 'Starting document.location.hostname is correct (' + pageOrigin + ')');
<script>
test_equals(document.location.host, pageOrigin, 'Starting document.location.hostname is correct (' + pageOrigin + ')');
var destUrl = 'http://' + crossOrigin + '/w3c/webperf/resources/multi_redirect.php?'; let destUrl = 'http://' + crossOrigin + '/w3c/webperf/resources/multi_redirect.php?';
destUrl += 'pageOrigin=' + 'http://' + pageOrigin; destUrl += 'pageOrigin=' + 'http://' + pageOrigin;
destUrl += '&crossOrigin=' + 'http://' + crossOrigin; destUrl += '&crossOrigin=' + 'http://' + crossOrigin;
destUrl += '&timingAllow=1'; destUrl += '&timingAllow=1';
var frameContext = document.getElementById("frameContext"); const frameContext = document.getElementById('frameContext');
frameContext.onload = onload_test; frameContext.onload = onload_test;
frameContext.src = destUrl; frameContext.src = destUrl;
</script> </script>
<div id="log"></div> </body>
</body>
</html> </html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment