blob: 60a7ef1564b788ab529b8d1f5e35429d82f76911 [file] [log] [blame]
<!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.');
test_greater_than(entry.responseEnd, entry.fetchStart, 'responseEnd should be greater than fetchStart 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>