mirror of
https://github.com/servo/servo.git
synced 2025-08-23 14:25:33 +01:00
Update web-platform-tests to revision 3137d1d2d7757366a69f8a449b458b5057e0e81e
This commit is contained in:
parent
81ca858678
commit
d6ba94ca28
2339 changed files with 89274 additions and 9328 deletions
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Original file for data:uri... to test opening an data:uri path within an iframe.</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p id="p">This test passed.</p>
|
||||
<script>
|
||||
var observer = new PerformanceObserver(
|
||||
function (entryList) {
|
||||
document.getElementById("p").innerHTML = "This test failed because navigation intance is observed.";
|
||||
observer.disconnect();
|
||||
});
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Navigation Timing 2 IDL tests</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id='untested_idl' style='display:none'>
|
||||
|
||||
interface PerformanceResourceTiming : PerformanceEntry {
|
||||
readonly attribute DOMString initiatorType;
|
||||
readonly attribute DOMHighResTimeStamp workerStart;
|
||||
readonly attribute DOMHighResTimeStamp redirectStart;
|
||||
readonly attribute DOMHighResTimeStamp redirectEnd;
|
||||
readonly attribute DOMHighResTimeStamp fetchStart;
|
||||
readonly attribute DOMHighResTimeStamp domainLookupStart;
|
||||
readonly attribute DOMHighResTimeStamp domainLookupEnd;
|
||||
readonly attribute DOMHighResTimeStamp connectStart;
|
||||
readonly attribute DOMHighResTimeStamp connectEnd;
|
||||
readonly attribute DOMHighResTimeStamp secureConnectionStart;
|
||||
readonly attribute DOMHighResTimeStamp requestStart;
|
||||
readonly attribute DOMHighResTimeStamp responseStart;
|
||||
readonly attribute DOMHighResTimeStamp responseEnd;
|
||||
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long transferSize;
|
||||
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long encodedBodySize;
|
||||
[MeasureAs=PerformanceResourceTimingSizes] readonly attribute unsigned long long decodedBodySize;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<pre id='idl'>
|
||||
enum NavigationType {
|
||||
"navigate",
|
||||
"reload",
|
||||
"back_forward",
|
||||
"prerender"
|
||||
};
|
||||
|
||||
interface PerformanceNavigationTiming : PerformanceResourceTiming {
|
||||
readonly attribute DOMHighResTimeStamp unloadEventStart;
|
||||
readonly attribute DOMHighResTimeStamp unloadEventEnd;
|
||||
readonly attribute DOMHighResTimeStamp domInteractive;
|
||||
readonly attribute DOMHighResTimeStamp domContentLoadedEventStart;
|
||||
readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd;
|
||||
readonly attribute DOMHighResTimeStamp domComplete;
|
||||
readonly attribute DOMHighResTimeStamp loadEventStart;
|
||||
readonly attribute DOMHighResTimeStamp loadEventEnd;
|
||||
readonly attribute NavigationType type;
|
||||
readonly attribute unsigned short redirectCount;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<script>
|
||||
function test_idl() {
|
||||
var idl_array = new IdlArray();
|
||||
|
||||
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
|
||||
idl_array.add_idls(document.getElementById("idl").textContent);
|
||||
|
||||
idl_array.test();
|
||||
}
|
||||
test_idl();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that PerformanceObserver can observe nav timing 2 instance and that the expected attributes in nav timing 2 instance exist (but does not validate that the values are correct).</p>
|
||||
|
||||
<script>
|
||||
var navTiming2Attributes = [
|
||||
'connectEnd',
|
||||
'connectStart',
|
||||
'decodedBodySize',
|
||||
'domComplete',
|
||||
'domContentLoadedEventEnd',
|
||||
'domContentLoadedEventStart',
|
||||
'domInteractive',
|
||||
'domainLookupEnd',
|
||||
'domainLookupStart',
|
||||
'duration',
|
||||
'encodedBodySize',
|
||||
'entryType',
|
||||
'fetchStart',
|
||||
'initiatorType',
|
||||
'loadEventEnd',
|
||||
'loadEventStart',
|
||||
'name',
|
||||
'redirectCount',
|
||||
'redirectEnd',
|
||||
'redirectStart',
|
||||
'requestStart',
|
||||
'responseEnd',
|
||||
'responseStart',
|
||||
'secureConnectionStart',
|
||||
'transferSize',
|
||||
'type',
|
||||
'unloadEventEnd',
|
||||
'unloadEventStart',
|
||||
'workerStart'
|
||||
];
|
||||
async_test(function (t) {
|
||||
var observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
var entries = entryList.getEntries();
|
||||
assert_equals(entries.length, 1,
|
||||
"There should be only one navigation timing instance.");
|
||||
for (var i = 0; i < navTiming2Attributes.length; i++) {
|
||||
assert_true(navTiming2Attributes[i] in entries[0],
|
||||
"Expected attribute: " + navTiming2Attributes[i] + ".");
|
||||
}
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
|
||||
}, "Performance navigation timing entries are observable.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that the values of nav timing 2 instance's timing-related attributes are in certain order and the others are of expected values.</p>
|
||||
|
||||
<script>
|
||||
var navTiming2EventOrder1 = [
|
||||
'startTime',
|
||||
'redirectStart',
|
||||
//'unloadEventStart',
|
||||
'redirectEnd',
|
||||
//'unloadEventEnd',
|
||||
'fetchStart',
|
||||
'domainLookupStart',
|
||||
'domainLookupEnd',
|
||||
'connectStart',
|
||||
//'secureConnectionStart',
|
||||
'connectEnd',
|
||||
'requestStart',
|
||||
'responseStart',
|
||||
'responseEnd',
|
||||
'domInteractive',
|
||||
'domContentLoadedEventStart',
|
||||
'domContentLoadedEventEnd',
|
||||
'domComplete',
|
||||
'loadEventStart',
|
||||
'loadEventEnd'
|
||||
];
|
||||
|
||||
var navTiming2EventOrder2 = [
|
||||
'redirectStart',
|
||||
'unloadEventStart',
|
||||
'redirectEnd',
|
||||
'unloadEventEnd',
|
||||
'fetchStart'
|
||||
];
|
||||
|
||||
var navTiming2EventOrder3 = [
|
||||
'connectStart',
|
||||
'secureConnectionStart',
|
||||
'connectEnd'
|
||||
];
|
||||
|
||||
function verifyTimingEventOrder(eventOrder, timingEntry) {
|
||||
for (var i = 0; i < eventOrder.length - 1; i++) {
|
||||
assert_true(timingEntry[eventOrder[i]] <= timingEntry[eventOrder[i + 1]],
|
||||
"Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + ".");
|
||||
}
|
||||
}
|
||||
|
||||
async_test(function (t) {
|
||||
var observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
var entries = entryList.getEntries();
|
||||
assert_equals(entries[0].entryType, "navigation",
|
||||
"Expected entryType to be: navigation.");
|
||||
assert_equals(entries[0].name, "document",
|
||||
"Expected name to be: document.");
|
||||
assert_equals(entries[0].startTime, 0,
|
||||
"Expected startTime to be: 0.");
|
||||
assert_equals(entries[0].duration, entries[0].loadEventEnd,
|
||||
"Expected duration to be equal to loadEventEnd.");
|
||||
assert_equals(entries[0].initiatorType, "navigation",
|
||||
"Expected initiatorType to be: navigation.");
|
||||
// This test may fail when response is from cach. Disable or clean cach before
|
||||
// running this test.
|
||||
assert_true(entries[0].transferSize > entries[0].encodedBodySize,
|
||||
"Expected transferSize to be greater than encodedBodySize in uncached navigation.");
|
||||
assert_equals(entries[0].encodedBodySize, 4140);
|
||||
assert_equals(entries[0].decodedBodySize, 4140);
|
||||
verifyTimingEventOrder(entries[0], navTiming2EventOrder1);
|
||||
// When unloadEvent happens
|
||||
if (entries[0]["unloadEventStart"] != 0) {
|
||||
verifyTimingEventOrder(entries[0], navTiming2EventOrder2);
|
||||
}
|
||||
// When a secure transport is used
|
||||
if (entries[0]["secureConnectionStart"] != 0) {
|
||||
verifyTimingEventOrder(entries[0], navTiming2EventOrder3);
|
||||
}
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
|
||||
}, "Performance navigation timing instance's value is reasonable.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,100 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var navTiming2Attributes = [
|
||||
'connectEnd',
|
||||
'connectStart',
|
||||
'decodedBodySize',
|
||||
'domComplete',
|
||||
'domContentLoadedEventEnd',
|
||||
'domContentLoadedEventStart',
|
||||
'domInteractive',
|
||||
'domainLookupEnd',
|
||||
'domainLookupStart',
|
||||
'duration',
|
||||
'encodedBodySize',
|
||||
'entryType',
|
||||
'fetchStart',
|
||||
'initiatorType',
|
||||
'loadEventEnd',
|
||||
'loadEventStart',
|
||||
'name',
|
||||
'redirectCount',
|
||||
'redirectEnd',
|
||||
'redirectStart',
|
||||
'requestStart',
|
||||
'responseEnd',
|
||||
'responseStart',
|
||||
'secureConnectionStart',
|
||||
'transferSize',
|
||||
'type',
|
||||
'unloadEventEnd',
|
||||
'unloadEventStart',
|
||||
'workerStart'
|
||||
];
|
||||
|
||||
var originalTiming = {};
|
||||
var didOpen = false;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
if (!didOpen) {
|
||||
setTimeout(testTimingWithDocumentOpen, 0);
|
||||
didOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
function testTimingWithDocumentOpen()
|
||||
{
|
||||
var subcontentWindow = document.getElementById("frameContext").contentWindow;
|
||||
|
||||
var timing = subcontentWindow.performance.getEntriesByType("navigation")[0];
|
||||
for (i in navTiming2Attributes) {
|
||||
originalTiming[navTiming2Attributes[i]] = timing[navTiming2Attributes[i]];
|
||||
}
|
||||
|
||||
var subdocument = subcontentWindow.document;
|
||||
subdocument.open();
|
||||
subdocument.write('<!DOCTYPE HTML>');
|
||||
subdocument.write('<html>');
|
||||
subdocument.write('<head>');
|
||||
subdocument.write('<meta charset="utf-8" />');
|
||||
subdocument.write('<title><Green Test Page</title>');
|
||||
subdocument.write('</head>');
|
||||
subdocument.write('<body style="background-color:#00FF00;">');
|
||||
subdocument.write('</body>');
|
||||
subdocument.write('</html>');
|
||||
subdocument.close();
|
||||
|
||||
setTimeout(function() {
|
||||
var timing = subcontentWindow.performance.getEntriesByType("navigation")[0];
|
||||
for (var i in navTiming2Attributes) {
|
||||
assert_equals(originalTiming[navTiming2Attributes[i]], timing[navTiming2Attributes[i]],
|
||||
navTiming2Attributes[i] + " is the same after document open.");
|
||||
}
|
||||
done();
|
||||
}, 0);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates window.performance.getEntriesByType("navigation") remains constant when a
|
||||
document is replaced using document.open.</p>
|
||||
|
||||
<p>This page should be loaded with a yellow frame below. It then replaces the
|
||||
document in that frame with a green document.</p>
|
||||
|
||||
<p>The test passes if all of the checks to performance.getEntriesByType("navigation") are correct and
|
||||
the frame below ends with a green background.</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_yellow.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that nav timing 2 instance can be accessed by three different accessors once available: window.performance.getEntries()/getEntriesByType("navigation")/getEntriesByName("document")</p>
|
||||
|
||||
<script>
|
||||
var navTiming2Attributes = [
|
||||
'connectEnd',
|
||||
'connectStart',
|
||||
'decodedBodySize',
|
||||
'domComplete',
|
||||
'domContentLoadedEventEnd',
|
||||
'domContentLoadedEventStart',
|
||||
'domInteractive',
|
||||
'domainLookupEnd',
|
||||
'domainLookupStart',
|
||||
'duration',
|
||||
'encodedBodySize',
|
||||
'entryType',
|
||||
'fetchStart',
|
||||
'initiatorType',
|
||||
'loadEventEnd',
|
||||
'loadEventStart',
|
||||
'name',
|
||||
'redirectCount',
|
||||
'redirectEnd',
|
||||
'redirectStart',
|
||||
'requestStart',
|
||||
'responseEnd',
|
||||
'responseStart',
|
||||
'secureConnectionStart',
|
||||
'transferSize',
|
||||
'type',
|
||||
'unloadEventEnd',
|
||||
'unloadEventStart',
|
||||
'workerStart'
|
||||
];
|
||||
|
||||
async_test(function (t) {
|
||||
var observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
var instance1 = performance.getEntries()[0];
|
||||
var instance2 = performance.getEntriesByType("navigation")[0];
|
||||
var instance3 = performance.getEntriesByName("document")[0];
|
||||
|
||||
assert_equals(performance.getEntriesByType("navigation").length, 1, "Expected there is only one navigation timing instance.");
|
||||
assert_equals(performance.getEntriesByName("document").length, 1, "Expected there is only one navigation timing instance.");
|
||||
|
||||
for (var i = 0; i < navTiming2Attributes.length; i++) {
|
||||
assert_equals(instance1[navTiming2Attributes[i]], instance2[navTiming2Attributes[i]]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < navTiming2Attributes.length; i++) {
|
||||
assert_equals(instance1[navTiming2Attributes[i]], instance3[navTiming2Attributes[i]]);
|
||||
}
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
|
||||
}, "Performance navigation timing entries are accessible through three different accessors.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" >
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that all of the window.performance.getEntriesByType("navigation") attributes remain unchanged after an in document navigation (URL fragment change).</p>
|
||||
|
||||
<script>
|
||||
var navTiming2Attributes = [
|
||||
'connectEnd',
|
||||
'connectStart',
|
||||
'decodedBodySize',
|
||||
'domComplete',
|
||||
'domContentLoadedEventEnd',
|
||||
'domContentLoadedEventStart',
|
||||
'domInteractive',
|
||||
'domainLookupEnd',
|
||||
'domainLookupStart',
|
||||
'duration',
|
||||
'encodedBodySize',
|
||||
'entryType',
|
||||
'fetchStart',
|
||||
'initiatorType',
|
||||
'loadEventEnd',
|
||||
'loadEventStart',
|
||||
'name',
|
||||
'redirectCount',
|
||||
'redirectEnd',
|
||||
'redirectStart',
|
||||
'requestStart',
|
||||
'responseEnd',
|
||||
'responseStart',
|
||||
'secureConnectionStart',
|
||||
'transferSize',
|
||||
'type',
|
||||
'unloadEventEnd',
|
||||
'unloadEventStart',
|
||||
'workerStart'
|
||||
];
|
||||
|
||||
var initial_timing = {};
|
||||
|
||||
function check_timing_not_changed()
|
||||
{
|
||||
var timing = window.performance.getEntriesByType("navigation")[0];
|
||||
for (var i = 0; i < navTiming2Attributes.length; ++i)
|
||||
{
|
||||
var property = navTiming2Attributes[i];
|
||||
assert_equals(timing[property], initial_timing[property],
|
||||
property + " is the same after in document navigation.");
|
||||
}
|
||||
done();
|
||||
}
|
||||
|
||||
function save_timing_after_load()
|
||||
{
|
||||
var timing = window.performance.getEntriesByType("navigation")[0];
|
||||
for (var i = 0; i < navTiming2Attributes.length; ++i)
|
||||
{
|
||||
var property = navTiming2Attributes[i];
|
||||
initial_timing[property] = timing[property];
|
||||
}
|
||||
window.location.href = "#1";
|
||||
setTimeout("check_timing_not_changed()", 0);
|
||||
}
|
||||
|
||||
function load_handler()
|
||||
{
|
||||
window.removeEventListener("load", load_handler);
|
||||
setTimeout("save_timing_after_load()", 0);
|
||||
}
|
||||
|
||||
window.addEventListener("load", load_handler, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
// do this with a timeout to see the visuals of the navigations.
|
||||
setTimeout("nav_frame();", 100);
|
||||
}
|
||||
|
||||
var step = 1;
|
||||
function nav_frame()
|
||||
{
|
||||
var navigation_frame = document.getElementById("frameContext").contentWindow;
|
||||
switch (step)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
navigation_frame.location.href = '/navigation-timing/resources/blank_page_green_with_onunload.html';
|
||||
step++;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
assert_equals(navigation_frame.performance.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
'Expected navigation type to be navigate.');
|
||||
navigation_frame.history.back();
|
||||
step++;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
assert_equals(navigation_frame.performance.getEntriesByType("navigation")[0].type,
|
||||
"back_forward",
|
||||
'Expected navigation type to be back_forward.');
|
||||
step++;
|
||||
navigation_frame.history.forward();
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
assert_equals(navigation_frame.performance.getEntriesByType("navigation")[0].type,
|
||||
"back_forward",
|
||||
'Expected navigation type to be back_forward.');
|
||||
done();
|
||||
step++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
Description</h1>
|
||||
<p>
|
||||
This test validates the value of window.performance.getEntriesByType("navigation")[0].type with a forward
|
||||
and back navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a yellow background frame below. It should turn green for a starting
|
||||
navigation, back to yellow for a back navigation and then back to green again for a forward navigation.</p>
|
||||
|
||||
<p>Along the navigation timeline the window.performance.getEntriesByType("navigation")[0].type is checked for back_forward.</p>
|
||||
|
||||
<p>This test passes if all of the checks to the window.performance.getEntriesByType("navigation")[0].type are correct throughout the navigation
|
||||
scenario and the frame below ends with a green background. Otherwise, this test fails.</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_yellow_with_onunload.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
var observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
assert_equals(entryList.getEntries()[0].type, "navigate", "Expected navigation type to be navigate.");
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
|
||||
}, "Navigation type to be navigate.");
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
Description</h1>
|
||||
<p>
|
||||
This test validates the value of window.performance.getEntriesByType("navigation")[0].type to be navigate.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
var reload_frame;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = function() {
|
||||
setTimeout(do_test, 0);
|
||||
}
|
||||
setTimeout("reload_the_frame();", 100);
|
||||
}
|
||||
|
||||
function reload_the_frame()
|
||||
{
|
||||
reload_frame.contentWindow.location.reload(true);
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "reload", "Expected navigation type to be reload.");
|
||||
assert_true(newNavTiming.unloadEventStart > 0, "Expected unloadEventStart to be greater than 0.");
|
||||
assert_true(newNavTiming.unloadEventEnd > 0, "Expected unloadEventEnd to be greater than 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onload_test();">
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "reload" after reload</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart > 0 after reload</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd > 0 after reload</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var iframe_performance = document.getElementById("frameContext").contentWindow.performance;
|
||||
assert_equals(iframe_performance.getEntriesByType("navigation").length, 0, "Expected there is no navigation timing instance");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates there does not exist a navigation timing instance when opening internal pages like about:blank.</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="about:blank" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates there does not exist a navigation timing instance when opening a data uri. This data uri points to nav2_data_uri.html. This test passes when it displays so in the iframe below.</p>
|
||||
|
||||
<iframe id="frameContext" src="data:text/html;base64,PCFET0NUWVBFIGh0bWw+CjxodG1sPgogICAgPGhlYWQ+CiAgICAgICAgPG1ldGEgY2hhcnNldD0idXRmLTgiPgogICAgICAgIDx0aXRsZT5PcmlnaW5hbCBmaWxlIGZvciBkYXRhOnVyaS4uLiB0byB0ZXN0IG9wZW5pbmcgYW4gZGF0YTp1cmkgcGF0aCB3aXRoaW4gYW4gaWZyYW1lLjwvdGl0bGU+CiAgICAgICAgPGxpbmsgcmVsPSJhdXRob3IiIHRpdGxlPSJHb29nbGUiIGhyZWY9Imh0dHA6Ly93d3cuZ29vZ2xlLmNvbS8iIC8+CiAgICAgICAgPGxpbmsgcmVsPSJoZWxwIiBocmVmPSJodHRwOi8vd3d3LnczLm9yZy9UUi9uYXZpZ2F0aW9uLXRpbWluZy0yLyNzZWMtUGVyZm9ybWFuY2VOYXZpZ2F0aW9uVGltaW5nIi8+CiAgICA8L2hlYWQ+CiAgICA8Ym9keT4KICAgICAgICA8aDE+RGVzY3JpcHRpb248L2gxPgogICAgICAgIDxwIGlkPSJwIj5UaGlzIHRlc3QgcGFzc2VkLjwvcD4KICAgICAgICA8c2NyaXB0PgogICAgICAgICAgICAgICAgdmFyIG9ic2VydmVyID0gbmV3IFBlcmZvcm1hbmNlT2JzZXJ2ZXIoCiAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gKGVudHJ5TGlzdCkgewogICAgICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgicCIpLmlubmVySFRNTCA9ICJUaGlzIHRlc3QgZmFpbGVkIGNhdXNlIG5hdmlnYXRpb24gaW50YW5jZSBpcyBvYnNlcnZlZC4iOwogICAgICAgICAgICAgICAgICAgICAgICBvYnNlcnZlci5kaXNjb25uZWN0KCk7CiAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICBvYnNlcnZlci5vYnNlcnZlKHtlbnRyeVR5cGVzOiBbIm5hdmlnYXRpb24iXX0pOwogICAgICAgIDwvc2NyaXB0PgogICAgPC9ib2R5Pgo8L2h0bWw+Cg==" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that the value of the window.performance.getEntriesByType("navigation")[0].redirectCount attribute, as well as the window.performance.getEntriesByType("navigation")[0].redirectStart and redirectEnd attributes on a non-redirected navigation.</p>
|
||||
|
||||
<script>
|
||||
|
||||
async_test(function (t) {
|
||||
var observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
var navTiming = performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(navTiming.redirectCount, 0, "Expected redirectCount to be 0.");
|
||||
assert_equals(navTiming.redirectStart, 0, "Expected redirectStart to be 0.");
|
||||
assert_equals(navTiming.redirectEnd, 0, "Expected redirectEnd to be 0.");
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
|
||||
}, "Naivation without redirects.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
function verifyTimingEventOrder(eventOrder, timingEntry) {
|
||||
for (var i = 0; i < eventOrder.length - 1; i++) {
|
||||
assert_true(timingEntry[eventOrder[i]] < timingEntry[eventOrder[i + 1]],
|
||||
"Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + ".");
|
||||
}
|
||||
}
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var frame_performance = document.getElementById("frameContext").contentWindow.performance;
|
||||
assert_equals(frame_performance.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
"Expected navigation type to be navigate.");
|
||||
assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 1, "Expected redirectCount to be 1.");
|
||||
|
||||
var timgingEvents = [
|
||||
'startTime',
|
||||
'redirectStart',
|
||||
'redirectEnd',
|
||||
];
|
||||
verifyTimingEventOrder(timgingEvents, frame_performance.getEntriesByType("navigation")[0]);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the values of the window.performance.redirectCount and the
|
||||
window.performance.timing.redirectStart/End times for a same-origin server side redirect navigation.</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="/common/redirect.py?location=/navigation-timing/resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var performanceNamespace = document.getElementById("frameContext").contentWindow.performance;
|
||||
assert_equals(performanceNamespace.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
"Expected navigation type to be navigate.");
|
||||
assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectCount, 0,
|
||||
"Expected redirectCount to be 0.");
|
||||
assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectStart, 0,
|
||||
"Expected redirectStart to be 0.");
|
||||
assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectEnd, 0,
|
||||
"Expected redirectEnd to be 0.");
|
||||
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the
|
||||
window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation.</p>
|
||||
|
||||
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
|
||||
<script>
|
||||
// combine the page origin and redirect origin into the IFRAME's src URL
|
||||
var destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_green.html"})
|
||||
});
|
||||
var frameContext = document.getElementById("frameContext");
|
||||
frameContext.onload = onload_test;
|
||||
frameContext.src = destUrl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
function verifyTimingEventOrder(eventOrder, timingEntry) {
|
||||
for (var i = 0; i < eventOrder.length - 1; i++) {
|
||||
assert_true(timingEntry[eventOrder[i]] < timingEntry[eventOrder[i + 1]],
|
||||
"Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + ".");
|
||||
}
|
||||
}
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var frame_performance = document.getElementById("frameContext").contentWindow.performance;
|
||||
assert_equals(frame_performance.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
"Expected navigation type to be navigate.");
|
||||
assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 1, "Expected redirectCount to be 1.");
|
||||
|
||||
var timgingEvents = [
|
||||
'startTime',
|
||||
'redirectStart',
|
||||
'redirectEnd',
|
||||
];
|
||||
verifyTimingEventOrder(timgingEvents, frame_performance.getEntriesByType("navigation")[0]);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the
|
||||
window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation when the redirect chooses to opt-in.</p>
|
||||
|
||||
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
|
||||
<script>
|
||||
// combine the page origin and redirect origin into the IFRAME's src URL
|
||||
var destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect-opt-in.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_green.html"})
|
||||
});
|
||||
var frameContext = document.getElementById("frameContext");
|
||||
frameContext.onload = onload_test;
|
||||
frameContext.src = destUrl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,76 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates that each window has a unique nav timing 2 instance.</p>
|
||||
<iframe id="frameContext" src="resources/blank_page_green.html" style="display:none;";></iframe>
|
||||
<script>
|
||||
|
||||
var navTiming2Attributes = [
|
||||
'connectEnd',
|
||||
'connectStart',
|
||||
'decodedBodySize',
|
||||
'domComplete',
|
||||
'domContentLoadedEventEnd',
|
||||
'domContentLoadedEventStart',
|
||||
'domInteractive',
|
||||
'domainLookupEnd',
|
||||
'domainLookupStart',
|
||||
'duration',
|
||||
'encodedBodySize',
|
||||
'entryType',
|
||||
'fetchStart',
|
||||
'initiatorType',
|
||||
'loadEventEnd',
|
||||
'loadEventStart',
|
||||
'name',
|
||||
'redirectCount',
|
||||
'redirectEnd',
|
||||
'redirectStart',
|
||||
'requestStart',
|
||||
'responseEnd',
|
||||
'responseStart',
|
||||
'secureConnectionStart',
|
||||
'transferSize',
|
||||
'type',
|
||||
'unloadEventEnd',
|
||||
'unloadEventStart',
|
||||
'workerStart'
|
||||
];
|
||||
|
||||
function not_same_instance(instance1, instance2, attributes) {
|
||||
for (var i in attributes) {
|
||||
if (instance1[attributes[i]] != instance2[attributes[i]])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
async_test(function (t) {
|
||||
var observer = new PerformanceObserver(
|
||||
t.step_func(function (entryList) {
|
||||
assert_equals(entryList.getEntriesByType("navigation").length, 1, "Only one nav timing instance exists.");
|
||||
assert_equals(document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation").length, 1,
|
||||
"Only one nav timing instance exists.");
|
||||
var main_frame_instance = entryList.getEntriesByType("navigation")[0];
|
||||
var iframe_instance = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_true(not_same_instance(main_frame_instance, iframe_instance, navTiming2Attributes),
|
||||
"Two nav timing instances are not the same instance.");
|
||||
observer.disconnect();
|
||||
t.done();
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ["navigation"]});
|
||||
|
||||
}, "Each window has a unique nav timing 2 instance.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var frame = document.getElementById("frameContext");
|
||||
|
||||
assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
"Expected navigation type to be navigate.");
|
||||
|
||||
assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventStart, 0,
|
||||
"Expected unloadEventStart to be 0.");
|
||||
assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventEnd, 0,
|
||||
"Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the unload event times are 0 when there is no previous document.</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
reload_frame.contentWindow.location.href = "resources/blank_page_green.html";
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate.");
|
||||
assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0.");
|
||||
assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a navigation on top of a cross-origin document.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "navigate"</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart = 0</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd = 0</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="http://www.apple.com" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
var reload_frame;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
setTimeout("reload_the_frame();", 100);
|
||||
}
|
||||
|
||||
function reload_the_frame()
|
||||
{
|
||||
var destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_yellow.html"})
|
||||
});
|
||||
reload_frame.contentWindow.location.href = destUrl;
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate.");
|
||||
assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0.");
|
||||
assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "navigate"</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
reload_frame.contentWindow.location.reload(true);
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_true(newNavTiming.unloadEventStart > 0, "Expected unloadEventStart to be greater than 0.");
|
||||
assert_true(newNavTiming.unloadEventEnd > 0, "Expected unloadEventEnd to be greater than 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart > 0 after reload</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd > 0 after reload</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue